Exemplo n.º 1
0
        public List <Chain.Model.Promotions> DataTableToList(DataTable dt)
        {
            List <Chain.Model.Promotions> modelList = new List <Chain.Model.Promotions>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.Promotions model = new Chain.Model.Promotions();
                    if (dt.Rows[i]["PromotionsID"] != null && dt.Rows[i]["PromotionsID"].ToString() != "")
                    {
                        model.PromotionsID = int.Parse(dt.Rows[i]["PromotionsID"].ToString());
                    }
                    if (dt.Rows[i]["PromotionsTitle"] != null && dt.Rows[i]["PromotionsTitle"].ToString() != "")
                    {
                        model.PromotionsTitle = dt.Rows[i]["PromotionsTitle"].ToString();
                    }
                    if (dt.Rows[i]["PromotionsStart"] != null && dt.Rows[i]["PromotionsStart"].ToString() != "")
                    {
                        model.PromotionsStart = DateTime.Parse(dt.Rows[i]["PromotionsStart"].ToString());
                    }
                    if (dt.Rows[i]["PromotionsEnd"] != null && dt.Rows[i]["PromotionsEnd"].ToString() != "")
                    {
                        model.PromotionsEnd = DateTime.Parse(dt.Rows[i]["PromotionsEnd"].ToString());
                    }
                    if (dt.Rows[i]["PromotionsMemLevel"] != null && dt.Rows[i]["PromotionsMemLevel"].ToString() != "")
                    {
                        model.PromotionsMemLevel = int.Parse(dt.Rows[i]["PromotionsMemLevel"].ToString());
                    }
                    if (dt.Rows[i]["PromotionsType"] != null && dt.Rows[i]["PromotionsType"].ToString() != "")
                    {
                        model.PromotionsType = int.Parse(dt.Rows[i]["PromotionsType"].ToString());
                    }
                    if (dt.Rows[i]["PromotionsTime"] != null && dt.Rows[i]["PromotionsTime"].ToString() != "")
                    {
                        model.PromotionsTime = DateTime.Parse(dt.Rows[i]["PromotionsTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.BindPreferentialObject();
         this.rptShopBind();
         if (base.Request.QueryString["PromotionsID"] != null)
         {
             int PromotionsID = int.Parse(base.Request.QueryString["PromotionsID"]);
             Chain.BLL.Promotions   bllPromotions   = new Chain.BLL.Promotions();
             Chain.Model.Promotions modelPromotions = bllPromotions.GetModel(PromotionsID);
             this.txtPromotionsDesc.Value       = modelPromotions.PromotionsDesc;
             this.txtPromotionsID.Value         = PromotionsID.ToString();
             this.txtPromotionsRemark.Value     = modelPromotions.PromotionsRemark;
             this.txtUpdatePromotionsName.Value = modelPromotions.PromotionsPhoto;
             this.imgPromotionsPhoto.Src        = modelPromotions.PromotionsPhoto;
             this.txtPromotionsTitle.Value      = modelPromotions.PromotionsTitle;
             this.txtShopList.Value             = modelPromotions.ShopList;
             string[] shopList = this.txtShopList.Value.Split(new char[]
             {
                 ','
             });
             string shopname = "";
             for (int i = 0; i < shopList.Length; i++)
             {
                 Chain.BLL.SysShop   bllShop   = new Chain.BLL.SysShop();
                 Chain.Model.SysShop modelShop = bllShop.GetModel(int.Parse(shopList[i]));
                 shopname = shopname + modelShop.ShopName + ";";
             }
             shopname.TrimEnd(new char[]
             {
                 ';'
             });
             this.txtShopNameList.Value = shopname;
             this.ltlTitle.Text         = "微官网   >    优惠活动   >   优惠活动编辑 ";
         }
         else
         {
             this.ltlTitle.Text = "微官网   >   优惠活动   >   优惠活动新增 ";
         }
     }
 }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (base.Request.QueryString["PromotionsID"] != null)
         {
             int ProductID = int.Parse(base.Request.QueryString["PromotionsID"]);
             Chain.BLL.Promotions   bllPromotions   = new Chain.BLL.Promotions();
             Chain.Model.Promotions modelPromotions = bllPromotions.GetModel(ProductID);
             this.spPromotionsDesc.InnerHtml = modelPromotions.PromotionsDesc;
             string   shopnameLsit = modelPromotions.ShopList;
             string[] shopList     = shopnameLsit.Split(new char[]
             {
                 ','
             });
             string sql = " ShopType=3 ";
             if (shopList.Length > 0)
             {
                 string shopidList = "( ";
                 for (int i = 0; i < shopList.Length; i++)
                 {
                     shopidList = shopidList + shopList[i] + ",";
                 }
                 shopidList  = shopidList.Substring(0, shopidList.Length - 1);
                 shopidList += ")";
                 sql         = sql + " and ShopID in " + shopidList;
             }
             if (modelPromotions.PromotionsMemLevel == -1)
             {
                 this.spMemLevel.InnerHtml = "所有会员";
             }
             else
             {
                 Chain.BLL.MemLevel bllLevel = new Chain.BLL.MemLevel();
                 this.spMemLevel.InnerHtml = bllLevel.GetModel(modelPromotions.PromotionsMemLevel).LevelName;
             }
             this.rptShopBind(sql);
         }
     }
 }
Exemplo n.º 4
0
 public bool Update(Chain.Model.Promotions model)
 {
     return(this.dal.Update(model));
 }
Exemplo n.º 5
0
 public int Add(Chain.Model.Promotions model)
 {
     return(this.dal.Add(model));
 }