コード例 #1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         Song.Entities.ProductMaterial mm;
         if (id != 0)
         {
             mm = Business.Do <IProduct>().MaterialSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.ProductMaterial();
         }
         mm.Pmat_Name = tbName.Text.Trim();
         //说明
         mm.Pmat_Intro = tbIntro.Text;
         //是否使用与显示
         mm.Pmat_IsUse = cbIsUse.Checked;
         //确定操作
         if (id == 0)
         {
             Business.Do <IProduct>().MaterialAdd(mm);
         }
         else
         {
             Business.Do <IProduct>().MaterialSave(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
コード例 #2
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         Song.Entities.ProductMaterial mm;
         if (id != 0)
         {
             mm = Business.Do <IProduct>().MaterialSingle(id);
             //是否使用与显示
             cbIsUse.Checked = mm.Pmat_IsUse;
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.ProductMaterial();
             cbIsUse.Checked = true;
         }
         tbName.Text = mm.Pmat_Name;
         //说明
         this.tbIntro.Text = mm.Pmat_Intro;
     }
     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.ProductMaterial entity = Business.Do <IProduct>().MaterialSingle(id);
         entity.Pmat_IsUse = !entity.Pmat_IsUse;
         Business.Do <IProduct>().MaterialSave(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }