示例#1
0
        private void toolDelete_Click(object sender, EventArgs e)
        {
            string tableName = BasicMgr.GetTableName(this.selectedTable);
            int    id        = int.Parse(this.dgvBasic.SelectedRows[0].Cells["编号"].Value.ToString());
            string discrip   = this.dgvBasic.SelectedRows[0].Cells["基本描述"].Value.ToString();

            if (untCommon.QuestionMsg("确定要删除\n" + id.ToString() + "." + discrip + "?"))
            {
                if (BasicMgr.DeleteBasic(tableName, id))
                {
                    untCommon.InfoMsg("删除成功");
                    fresh();
                }
                else
                {
                    untCommon.InfoMsg("删除失败");
                }
            }
        }
示例#2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (isAdd)
     {
         if (this.txtDiscrip.Text.Trim() == "")
         {
             untCommon.ErrorMsg("请填写项目名");
         }
         else
         if (BasicMgr.AddBasic(BasicMgr.GetTableName(table), this.txtDiscrip.Text))
         {
             untCommon.InfoMsg("添加成功");
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             untCommon.InfoMsg("添加失败");
         }
     }
     else
     {
         if (this.txtDiscrip.Text.Trim() == "")
         {
             untCommon.ErrorMsg("请填写项目名");
         }
         else
         if (BasicMgr.UpdateBasic(BasicMgr.GetTableName(table), int.Parse(this.txtId.Text), this.txtDiscrip.Text))
         {
             untCommon.InfoMsg("修改成功");
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             untCommon.InfoMsg("修改失败");
         }
     }
 }