Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     Maticsoft.Model.Shop.PromoteSales.CountDown model = new Maticsoft.Model.Shop.PromoteSales.CountDown();
     long productId = Globals.SafeLong(this.ddlProduct.SelectedValue, (long) 0L);
     if (productId == 0L)
     {
         MessageBox.ShowFailTip(this, "请选择限时抢购商品!");
     }
     else
     {
         decimal target = Globals.SafeDecimal(this.txtPrice.Text, (decimal) -1M);
         if (target == -1M)
         {
             MessageBox.ShowFailTip(this, "请填写商品价格");
         }
         else if (string.IsNullOrWhiteSpace(this.txtEndDate.Text))
         {
             MessageBox.ShowFailTip(this, "请选择活动结束时间");
         }
         else if (this.downBll.IsExists(productId))
         {
             MessageBox.ShowFailTip(this, "该商品已加入限时抢购活动");
         }
         else
         {
             model.Description = this.txtDesc.Text;
             model.EndDate = Globals.SafeDateTime(this.txtEndDate.Text, DateTime.Now);
             model.Price = Globals.SafeDecimal(target, (decimal) 0M);
             model.ProductId = productId;
             model.Sequence = Globals.SafeInt(this.txtSequence.Text, 0);
             model.Status = this.chkStatus.Checked ? 1 : 0;
             if (this.downBll.Add(model) > 0)
             {
                 MessageBox.ShowSuccessTip(this, "操作成功", "CountDownList.aspx");
             }
             else
             {
                 MessageBox.ShowFailTip(this, "操作失败");
             }
         }
     }
 }
Esempio n. 2
0
 public Maticsoft.Model.Shop.PromoteSales.CountDown DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Shop.PromoteSales.CountDown down = new Maticsoft.Model.Shop.PromoteSales.CountDown();
     if (row != null)
     {
         if ((row["CountDownId"] != null) && (row["CountDownId"].ToString() != ""))
         {
             down.CountDownId = int.Parse(row["CountDownId"].ToString());
         }
         if ((row["ProductId"] != null) && (row["ProductId"].ToString() != ""))
         {
             down.ProductId = long.Parse(row["ProductId"].ToString());
         }
         if ((row["EndDate"] != null) && (row["EndDate"].ToString() != ""))
         {
             down.EndDate = DateTime.Parse(row["EndDate"].ToString());
         }
         if (row["Description"] != null)
         {
             down.Description = row["Description"].ToString();
         }
         if ((row["Sequence"] != null) && (row["Sequence"].ToString() != ""))
         {
             down.Sequence = int.Parse(row["Sequence"].ToString());
         }
         if ((row["Price"] != null) && (row["Price"].ToString() != ""))
         {
             down.Price = decimal.Parse(row["Price"].ToString());
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             down.Status = int.Parse(row["Status"].ToString());
         }
     }
     return down;
 }