Example #1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (Them)
     {
         if (LoaiNvBUS.KtMaLNV(txtMa.Text) > 0)
         {
             MessageBox.Show("Mã nhân viên tồn tai. Nhập Mã nhân viên khác !");
             txtMa.ResetText();
             txtTenLoai.ResetText();
             txtMa.Focus();
         }
         else
         {
             LoaiNvBUS.ThemLNV(txtMa.Text, txtTenLoai.Text);
             LoadData();
             // Thông báo
             MessageBox.Show("Đã thêm xong!");
         }
     }
     else
     {
         int r = dgvLNV.CurrentCell.RowIndex;
         // MaNV hiện hành
         string strMaNV = dgvLNV.Rows[r].Cells[0].Value.ToString();
         LoaiNvBUS.SuaLNV(txtMa.Text, txtTenLoai.Text);
         LoadData();
         // Thông báo
         MessageBox.Show("Đã sửa xong!");
     }
 }