예제 #1
0
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMatKhauCu.Text == O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Decrypt(currentUser.MatKhau, true))
                {
                    if (!string.IsNullOrEmpty(txtMatKhauMoi.Text) && txtMatKhauMoi.Text == txtMatKhauMoiAgain.Text)
                    {
                        currentUser.MatKhau = txtMatKhauMoi.Text;
                        TaiKhoanLogic.Update(currentUser);

                        MessageBox.Show("Đổi mật khẩu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Mật khẩu mới trống hoặc không khớp", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Mật khẩu cũ không chính xác", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                MessageBox.Show("Có lỗi xảy ra", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.TaiKhoan_Select != null)
                {
                    //Update TAIKHOAN: passs
                    this.TaiKhoan_Select.MatKhau = txtMatKhau.Text;

                    //Update PHANQUYENTAIKHOAN
                    List <PHANQUYENTAIKHOAN> _lstPQ_TK_All = new List <PHANQUYENTAIKHOAN>();
                    foreach (var _item in this.lstPQ_TK_ChucNang)
                    {
                        if (_item.IsCheck)
                        {
                            PHANQUYENTAIKHOAN _phanquyen = new PHANQUYENTAIKHOAN
                            {
                                TaiKhoanId = this.TaiKhoan_Select.TaiKhoanId,
                                ChucNangId = _item.ChucNangId,
                                Them       = _item.Them == true ? 1 : 0,
                                Sua        = _item.Sua == true ? 1 : 0,
                                Xoa        = _item.Xoa == true ? 1 : 0,
                                InAn       = _item.InAn == true ? 1 : 0,
                                XuatFile   = _item.XuatFile == true ? 1 : 0,
                            };
                            _lstPQ_TK_All.Add(_phanquyen);
                        }
                    }
                    foreach (var _item in this.lstPQ_TK_BaoCao)
                    {
                        if (_item.IsCheck)
                        {
                            PHANQUYENTAIKHOAN _phanquyen = new PHANQUYENTAIKHOAN
                            {
                                TaiKhoanId = this.TaiKhoan_Select.TaiKhoanId,
                                ChucNangId = _item.ChucNangId,
                                Them       = _item.Them == true ? 1 : 0,
                                Sua        = _item.Sua == true ? 1 : 0,
                                Xoa        = _item.Xoa == true ? 1 : 0,
                                InAn       = _item.InAn == true ? 1 : 0,
                                XuatFile   = _item.XuatFile == true ? 1 : 0,
                            };
                            _lstPQ_TK_All.Add(_phanquyen);
                        }
                    }

                    if (TaiKhoanLogic.Update(this.TaiKhoan_Select) && PhanQuyenTaiKhoanLogic.DeleteAndInsert(_lstPQ_TK_All, this.TaiKhoan_Select.TaiKhoanId))
                    {
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG);
                        frmthongbao.Show();
                    }
                    else
                    {
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI);
                        frmthongbao.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }