Beispiel #1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     en_nv.TenNV       = txtTennv.Text;
     en_nv.GT          = cboGt.Text;
     en_nv.DiaChi      = txtDiachi.Text;
     en_nv.SDT         = txtSdt.Text;
     en_nv.TenDangNhap = txtTendn.Text;
     en_nv.MatKhau     = txtMk.Text;
     if (them == true)
     {
         if (txtManv.Text != "")
         {
             try
             {
                 en_nv.MaNV = con.SinhMa("NHANVIEN", "NV");
                 nv.ThemNhanVien(en_nv);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else
         {
             MessageBox.Show("ban chua nhap manv");
         }
     }
     else
     {
         try
         {
             en_nv.MaNV = txtManv.Text.ToString();
             nv.SuaNhanVien(en_nv);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     khoadk();
     dgvNhanvien.DataSource = nv.HienThiNhanVien("");
     gannull();
 }