예제 #1
0
        public void ReadFromDb(SqlDataReader rdr)
        {
            Id         = (int)rdr["Id"];
            Advertiser = (string)rdr["Advertizer"];
            var rubId = (int)rdr["RubricId"];

            Rubric = ClassifiedRubric.GetById(rubId);
            Text   = (string)rdr["AdText"];

            Options = 0;
            if ((bool)rdr["IsBorder"])
            {
                Options |= OptionsFlags.IsBorder;
            }
            if ((bool)rdr["IsBold"])
            {
                Options |= OptionsFlags.IsBold;
            }
            if ((bool)rdr["IsBackground"])
            {
                Options |= OptionsFlags.IsBackground;
            }
            if ((bool)rdr["IsCentered"])
            {
                Options |= OptionsFlags.IsCentered;
            }

            Info          = (string)ResolveDbNull(rdr["Info"]);
            IsPaid        = (bool)rdr["IsPaid"];
            PaymentMethod = rdr["PaymentMethod"] is DBNull ? PaymentMethodEnum.NotSet : (PaymentMethodEnum)(byte)rdr["PaymentMethod"];
            Price         = (decimal)ResolveDbNull(rdr["Price"], 0m);

            StartIssue = new IssueNumber((int)rdr["StartIssueYear"], (short)rdr["StartIssueNumber"]);
            EndIssue   = new IssueNumber((int)rdr["EndIssueYear"], (short)rdr["EndIssueNumber"]);

            SM      = (string)ResolveDbNull(rdr["clasSM"]);
            Created = (DateTime)rdr["clasTimestamp"];

            WebsitePromitionPrice          = (decimal)ResolveDbNull(rdr["WebsitePromitionPrice"], 0m);
            WebsitePromotionExpirationDate = (DateTime?)ResolveDbNull(rdr["WebsitePromotionExpirationDate"]);
        }
예제 #2
0
 public ClassifiedAd()
 {
     StartIssue = new IssueNumber(DateTime.Now.Year, 1);
     EndIssue   = new IssueNumber(DateTime.Now.Year, 52);
 }