Ejemplo n.º 1
0
        private void btn_luuTaiKhoan_Click(object sender, EventArgs e)
        {
            if (txt_matKhauCu.Text.Trim() == "" || txt_matKhauMoi.Text.Trim() == "" || txt_nhapLaiMKMoi.Text.Trim() == "")

            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (tkBUS.CheckPassword(txt_tenDangNhap.Text, txt_matKhauCu.Text) != 1)
                {
                    XtraMessageBox.Show("Mật khẩu cũ không khớp!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (txt_matKhauMoi.Text.Trim() != txt_nhapLaiMKMoi.Text.Trim())
                    {
                        XtraMessageBox.Show("Mật khẩu mới không khớp!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (txt_matKhauMoi.Text == txt_matKhauCu.Text)
                        {
                            XtraMessageBox.Show("Mật khẩu mới không không được trùng với mật khẩu cũ!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            if (tkDTO != null)
                            {
                                GetDetail();

                                int kq = tkBUS.ChangePassword(tkDTO);
                                if (kq == 1)
                                {
                                    XtraMessageBox.Show("Đổi mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    ucQLTK.LoadTK();
                                    this.Dispose();
                                }
                                else
                                {
                                    XtraMessageBox.Show("Đổi mật khẩu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }
                            }
                        }
                    }
                }
            }
        }