示例#1
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (string.IsNullOrEmpty(txtClientName.Text))
     {
         MessageBox.Show("请输入客户姓名");
     }
     if (string.IsNullOrEmpty(txtClientPhone.Text))
     {
         MessageBox.Show("请输入客户手机");
     }
     //插入
     if (_opearType == "添加")
     {
         var sql = InsertSQL.InsertClient(txtClientName.Text, txtClientPhone.Text);
         MessageBox.Show(InsertData.InsertIntoData(sql) ? "添加客户成功" : "添加客户失败");
     }
     //更新
     if (_opearType == "修改")
     {
         var updatesql = UpdateSQL.UpdateClient(txtClientName.Text, txtClientPhone.Text, _clientId);
         MessageBox.Show(UpdateData.UpdateInfo(updatesql) ? "更新客户成功" : "更新客户失败");
     }
     Close();
 }