コード例 #1
0
 private void btn_luuMatKhau_Click(object sender, EventArgs e)
 {
     if (txt_matKhauMoi.Text.Trim() == "")
     {
         XtraMessageBox.Show("Chưa nhập mật khẩu!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         if (tkDTO != null)
         {
             tkDTO.TenDangNhap = txt_tenDangNhap.Text.Trim();
             tkDTO.MatKhau     = txt_matKhauMoi.Text.Trim();
             int kq = tkBUS.ChangePassword(tkDTO);
             if (kq == 1)
             {
                 XtraMessageBox.Show("Lưu mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 XtraMessageBox.Show("Lưu mật khẩu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
 }
コード例 #2
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);
                                }
                            }
                        }
                    }
                }
            }
        }