/// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         Song.Entities.ProductOrigin mm;
         if (id != 0)
         {
             mm = Business.Do <IProduct>().OriginSingle(id);
             //是否使用与显示
             cbIsUse.Checked = mm.Pori_IsUse;
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.ProductOrigin();
             cbIsUse.Checked = true;
         }
         tbName.Text = mm.Pori_Name;
         //说明
         this.tbIntro.Text = mm.Pori_Intro;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         Song.Entities.ProductOrigin mm;
         if (id != 0)
         {
             mm = Business.Do <IProduct>().OriginSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.ProductOrigin();
         }
         mm.Pori_Name = tbName.Text.Trim();
         //说明
         mm.Pori_Intro = this.tbIntro.Text;
         //是否使用与显示
         mm.Pori_IsUse = cbIsUse.Checked;
         //确定操作
         if (id == 0)
         {
             Business.Do <IProduct>().OriginAdd(mm);
         }
         else
         {
             Business.Do <IProduct>().OriginSave(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Пример #3
0
 /// <summary>
 /// 修改是否使用的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void sbUse_Click(object sender, EventArgs e)
 {
     try
     {
         StateButton ub    = (StateButton)sender;
         int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
         int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());
         //
         Song.Entities.ProductOrigin entity = Business.Do <IProduct>().OriginSingle(id);
         entity.Pori_IsUse = !entity.Pori_IsUse;
         Business.Do <IProduct>().OriginSave(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }