private void btnOk_Click(object sender, EventArgs e) { if (Check()) { CategoryInfoBLL bll = new CategoryInfoBLL(); CategoryInfo ct = new CategoryInfo(); ct.CatName = txtCName.Text; ct.CatNum = txtCNum.Text; ct.Remark = txtCRemark.Text; //新增还是修改 if (this.TP==1) { ct.DelFlag = 0; ct.SubBy = 1; ct.SubTime = System.DateTime.Now; } else if (this.TP==2) { ct.CatId = Convert.ToInt32(labId.Text); } string msg = bll.SaveCategoryInfo(ct, this.TP) ? "操作成功" : "操作失败"; MessageBox.Show(msg); this.Close(); } }