Esempio n. 1
0
        public static List <Promotion> GetPromostionCode()
        {
            DataTable        dt        = VistaDAL.GetPromostionCode();
            List <Promotion> listPromo = new List <Promotion>();
            Promotion        objPromotion;

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (!String.IsNullOrEmpty(row["Regex"].ToString()))
                    {
                        objPromotion = new Promotion();
                        if (!row.IsNull("Promotion Code"))
                        {
                            objPromotion.PromotionCode = row["Promotion Code"].ToString();
                        }
                        if (!row.IsNull("Start Date"))
                        {
                            objPromotion.StartDate = Convert.ToDateTime(row["Start Date"]);
                        }
                        if (!row.IsNull("End date"))
                        {
                            objPromotion.EndDate = Convert.ToDateTime(row["End date"]);
                        }
                        if (!row.IsNull("Discount %"))
                        {
                            objPromotion.DiscountPercentage = Convert.ToDecimal(row["Discount %"]);
                        }
                        if (!row.IsNull("RegEx"))
                        {
                            objPromotion.RegexValidator = Convert.ToString(row["RegEx"]);
                        }
                        if (!row.IsNull("CO"))
                        {
                            objPromotion.CO = Convert.ToInt16(row["CO"]);
                        }
                        if (!row.IsNull("BZ"))
                        {
                            objPromotion.BZ = Convert.ToInt16(row["BZ"]);
                        }
                        if (!row.IsNull("DM"))
                        {
                            objPromotion.DM = Convert.ToInt16(row["DM"]);
                        }
                        if (!row.IsNull("GL"))
                        {
                            objPromotion.GL = Convert.ToInt16(row["GL"]);
                        }
                        if (!row.IsNull("SL"))
                        {
                            objPromotion.SL = Convert.ToInt16(row["SL"]);
                        }
                        if (!row.IsNull("PL"))
                        {
                            objPromotion.PL = Convert.ToInt16(row["PL"]);
                        }

                        listPromo.Add(objPromotion);
                    }
                }
            }
            return(listPromo);
        }