Ejemplo n.º 1
0
 private void Button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (name.Text.Trim() == "" || id.Text.Trim() == "" || id.Text.Trim().Length != 18)
         {
             MessageBox.Show("请正确填写带*号的信息框");
         }
         else
         {
             var BLL     = new UpdateBLL();
             var Checked = BLL.Update(name.Text.Trim(), id.Text.Trim(), address.Text.Trim(), tel.Text.Trim(), remark.Text);
             if (Checked)
             {
                 MessageBox.Show("更改成功");
                 panel2.Enabled = false;
                 panel2.Visible = false;
                 panel1.Enabled = true;
                 panel1.Visible = true;
             }
             else
             {
                 MessageBox.Show("身份证校验不正确,请检查");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("更改失败,错误信息:\n" + ex);
     }
 }
Ejemplo n.º 2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (selectid.Text.Trim() == "")
         {
             MessageBox.Show("请填写身份证号");
             return;
         }
         var BLL    = new UpdateBLL();
         var Result = BLL.Select(selectid.Text.Trim());
         if (Result.Count == 0)
         {
             MessageBox.Show("无此身份证号");
         }
         else
         {
             panel1.Enabled = false;  //启用另一组控件
             panel1.Visible = false;
             panel2.Enabled = true;
             panel2.Visible = true;
             name.Text      = Result.Select(a => a.Name).FirstOrDefault();
             id.Text        = Result.Select(a => a.ID).FirstOrDefault();
             tel.Text       = Result.Select(a => a.Phone).FirstOrDefault();
             address.Text   = Result.Select(a => a.Address).FirstOrDefault();
             remark.Text    = Result.Select(a => a.Remark).FirstOrDefault(); //填充另一组控件文本框内容
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("操作失败,异常原因:\n" + ex);
     }
 }