예제 #1
0
        private void btnKhoiPhucNV_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Khôi phục nhân viên " + dgvNV["Tên nhân viên", dgvNV.CurrentRow.Index].Value.ToString() + "?",
                                                  "THÔNG BÁO!",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                int      rowIndex = dgvNV.CurrentRow.Index;
                string   ma       = dgvNV["Mã nhân viên", rowIndex].Value.ToString();
                string   ten      = dgvNV["Tên nhân viên", rowIndex].Value.ToString();
                bool     gioitinh = (bool)dgvNV["Giới tính", rowIndex].Value;
                DateTime ngaysinh = (DateTime)dgvNV["Ngày sinh", rowIndex].Value;
                string   sdt      = dgvNV["Số điện thoại", rowIndex].Value.ToString();
                string   diaChi   = dgvNV["Địa chỉ", rowIndex].Value.ToString();

                if (dgvNV["Action", rowIndex].Value.ToString().Trim() == "D")
                {
                    nvbll.KhoiPhuc(ma, ten, gioitinh, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục nhân viên " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dgvNV["Action", rowIndex].Value.ToString().Trim() == "U")
                {
                    nvbll.NhanVien_Update(ma, ten, gioitinh, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục thông tin nhân viên " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #2
0
 private void btnSuaNV_Click(object sender, EventArgs e)
 {
     try
     {
         bool GioiTinh;
         if (rdoNam.Checked)
         {
             GioiTinh = true;
         }
         else
         {
             GioiTinh = false;
         }
         dgvNV.DataSource = nvbll.NhanVien_Update(tbxMaNV.Text, tbxTenNV.Text, GioiTinh, dtpNgaySinhNV.Value, tbxSdtNV.Text, tbxDiaChiNV.Text);
         MessageBox.Show("Cập Nhật Thành công!");
     }
     catch (Exception LOI)
     {
         MessageBox.Show(LOI.Message, "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }