Example #1
0
 /// <summary>
 /// 赋值信息
 /// </summary>
 /// <param name="_id"></param>
 public void bind_date(int _id)
 {
     Cms.BLL.sc_Coupon   bll   = new Cms.BLL.sc_Coupon();
     Cms.Model.sc_Coupon model = bll.GetModel(_id);
     ddpid.SelectedValue         = model.type_id.ToString();
     tbtilte.Text                = model.cname;
     tbPrice.Text                = model.cmoney.ToString();
     tbnumber.Text               = model.number.ToString();
     photoUrl.Text               = model.picurl;
     tbstime.Text                = Convert.ToDateTime(model.stime).ToString("yyyy-MM-dd HH:mm:ss");
     tbetime.Text                = Convert.ToDateTime(model.etime).ToString("yyyy-MM-dd HH:mm:ss");
     cbluserDegree.SelectedValue = model.peson.ToString();
     txtusedContent.InnerText    = model.content.ToString();
 }
Example #2
0
 public void DataUpdate(int id)
 {
     Cms.BLL.sc_Coupon   bll = new Cms.BLL.sc_Coupon();
     Cms.Model.sc_Coupon bml = bll.GetModel(id);
     bml.type_id = int.Parse(ddpid.SelectedValue.ToString());
     bml.cname   = tbtilte.Text.Trim();
     bml.cmoney  = Convert.ToInt32(tbPrice.Text.Trim());
     bml.number  = Convert.ToInt32(tbnumber.Text.Trim());
     bml.stime   = DateTime.Parse(tbstime.Text);
     bml.etime   = DateTime.Parse(tbetime.Text);
     bml.picurl  = photoUrl.Text.Trim();
     bml.peson   = Convert.ToInt32(cbluserDegree.SelectedValue);
     bml.content = txtusedContent.InnerText;
     //bml.updatetime = DateTime.Now;
     if (bll.Update(bml))
     {
         adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改优惠卷" + tbtilte.Text); //记录日志
         if (bml.peson == 0)
         {
             DataTable               dt           = new Cms.BLL.C_user().GetList("").Tables[0];
             Cms.BLL.C_user_coupon   bll_coupon   = new Cms.BLL.C_user_coupon();
             Cms.Model.C_user_coupon model_coupon = new Cms.Model.C_user_coupon();
             if (dt != null && dt.Rows.Count > 0)
             {
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     for (int j = 0; j < bml.number; j++)
                     {
                         model_coupon.user_id    = Convert.ToInt32(dt.Rows[i]["id"]);
                         model_coupon.article_id = bml.article_id;
                         model_coupon.coupon_id  = id;
                         model_coupon.title      = bml.cname;
                         model_coupon.picUrl     = bml.picurl;
                         model_coupon.price      = Convert.ToDecimal(bml.cmoney);
                         model_coupon.stime      = bml.stime;
                         model_coupon.etime      = bml.etime;
                         model_coupon.number     = 1;
                         model_coupon.content    = bml.content;
                         model_coupon.status     = 0;
                         model_coupon.updatetime = DateTime.Now;
                         bll_coupon.Add(model_coupon);
                     }
                 }
             }
         }
         JscriptMsg("提交成功!", "couponlist.aspx", "Success");
     }
 }