Esempio n. 1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     //判断是新增还是修改
     if (CheckEmpty())
     {
         CategoryInfoBLL bll = new CategoryInfoBLL();
         CategoryInfo    cat = new CategoryInfo();
         cat.Catname = txtCName.Text;
         cat.Catnum  = txtCNum.Text;
         cat.Remark  = txtCRemark.Text;
         if (this.Tp == 1)
         {
             cat.Delflag = 0;
             cat.Subtime = DateTime.Now;
             cat.Subby   = 1;
         }
         else if (this.Tp == 2)
         {
             cat.Catid = Convert.ToInt32(labId.Text);
         }
         string msg = bll.SaveCategory(cat, this.Tp) ? "操作成功" : "操作失败";
         MessageBox.Show(msg);
         this.Close();
     }
 }
Esempio n. 2
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     //判断文本框不能为空
     if (IsCheck())
     {
         //判断是新增还是修改
         CategoryInfo cat = new CategoryInfo();
         cat.CatName = txtCName.Text;
         cat.CatNum  = txtCNum.Text;
         cat.Remark  = txtCRemark.Text;
         if (this.Tp == 1)//新增
         {
             cat.DelFlag = 0;
             cat.SubBy   = 1;
             cat.SubTime = DateTime.Now;
         }
         else if (this.Tp == 2)//修改
         {
             cat.CatId = Convert.ToInt32(labId.Text);
         }
         CategoryInfoBLL bll = new CategoryInfoBLL();
         string          msg = bll.SaveCategory(cat, this.Tp) ? "操作成功" : "操作失败";
         MessageBox.Show(msg);
         this.Close();
     }
 }