Пример #1
0
    protected void btnSure_Click(object sender, EventArgs e)
    {
        ProductDiscountInfo entity = new ProductDiscountInfo();

        WebFormHelper.GetDataFromForm(this, entity);
        entity.StartDate = Convert.ToDateTime(this.txtBeginDate.Value.ToString());
        entity.EndDate   = Convert.ToDateTime(this.txtEndDate.Value.ToString());
        if (entity.Id < 0)
        {
            if (SimpleOrmOperator.Create(entity))
            {
                WebTools.Alert(this, "添加成功!");
            }
            else
            {
                WebTools.Alert("添加失败!");
            }
        }
        else
        {
            if (SimpleOrmOperator.Update(entity))
            {
                WebTools.Alert(this, "修改成功!");
            }
            else
            {
                WebTools.Alert("修改失败!");
            }
        }
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GobalTools.BindProduct(this.cbProductIdValue);
         if (Request.Params["id"] != null)
         {
             ProductDiscountInfo entity = SimpleOrmOperator.Query <ProductDiscountInfo>(Convert.ToInt32(Request.Params["id"]));
             WebFormHelper.SetDataToForm(this, entity);
             this.txtBeginDate.Value = DateTimeHelper.DtToLongString(entity.StartDate);
             this.txtEndDate.Value   = DateTimeHelper.DtToLongString(entity.EndDate);
         }
         else
         {
             this.txtBeginDate.Value = DateTimeHelper.DtToLongString(System.DateTime.Now);
             this.txtEndDate.Value   = DateTimeHelper.DtToLongString(System.DateTime.Now);
         }
     }
 }