private void btnUpdate_Click(object sender, EventArgs e) { if (txtPassword.Text != "" && txtRole.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_Account(txtPassword.Text, txtRole.Text, txtMaNv.Text)) { if (Properties.Settings.Default.UserName == txtMaNv.Text) { Properties.Settings.Default.Password = txtPassword.Text; Properties.Settings.Default.Save(); } MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Load_Account(DNV.Account_Staff()); openButton(true); } else { MessageBox.Show("Cập nhật thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Load_Account(DNV.Account_Staff()); } } } else { MessageBox.Show("Vui lòng không để trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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); } } }