private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (txtHoTen.Text != "" && txtSDT.Text != "" && txtGioiTinh.Text != "" && txtDate.Text != "" && txtDepartment.Text != "" &&
         txtSDT.Text != "")
     {
         DialogResult dialog = MessageBox.Show("Bạn có chắc chắn muốn cập nhật mục này không?", "Xác nhận cập nhật", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialog == DialogResult.Yes)
         {
             if (DNV.Update_NV(txtHoTen.Text, txtGioiTinh.Text, txtDate.Value, txtDiaChi.Text, txtSDT.Text, txtDepartment.Text, txtMaNv.Text))
             {
                 MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 DNV = new Data_NV();
                 Load_NV(DNV.Inf_Staff());
                 openButton(true);
             }
             else
             {
                 MessageBox.Show("Cập nhật thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 DNV = new Data_NV();
                 Load_NV(DNV.Inf_Staff());
             }
         }
     }
     else
     {
         MessageBox.Show("Vui lòng không để trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Bạn có chắc muốn thay đổi thông tin không?", "Xác nhận thay đổi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialog == DialogResult.Yes)
            {
                if (DNV.Update_NV(txtHoTen.Text, txtGioiTinh.Text, txtDate.Value, txtDiaChi.Text, txtSDT.Text, txtPhongBan.Text, txtAccount.Text) && DNV.Update_Account(txtPassword.Text, txtChucVu.Text, txtAccount.Text))
                {
                    if (Properties.Settings.Default.UserName == txtAccount.Text)
                    {
                        Properties.Settings.Default.Password = txtPassword.Text;
                        Properties.Settings.Default.Save();
                    }
                    MessageBox.Show("Cập nhật thông tin thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    enable(false);
                    Load_Inf();
                }
                else
                {
                    MessageBox.Show("Có lỗi xảy ra, vui lòng kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }