예제 #1
0
 private void btnTaoTK_Click(object sender, EventArgs e)
 {
     if (txtTenDangNhap.Text.Length == 0 || txtMatKhau.Text.Length == 0)
     {
         MessageBox.Show("Chưa nhập tên đăng nhập hoặc mật khẩu", "Lỗi tạo tài khoản", MessageBoxButtons.OK, MessageBoxIcon.Error);
         btnReset.PerformClick();
         return;
     }
     if (txtMatKhau.Text != txtConfirmPass.Text)
     {
         MessageBox.Show("Mật khẩu không giống nhau, vui lòng nhập lại", "Lỗi tạo tài khoản", MessageBoxButtons.OK, MessageBoxIcon.Error);
         btnReset.PerformClick();
         return;
     }
     try
     {
         XuLyXml.LuuTaiKhoan(txtTenDangNhap.Text.ToLower(), MaHoaMatKhau.MaHoa(txtMatKhau.Text));
         MessageBox.Show("Đã tạo thành công tài khoản", "Tạo tài khoản", MessageBoxButtons.OK, MessageBoxIcon.Information);
         active = true;
         this.Close();
     }
     catch
     {
     }
 }
예제 #2
0
파일: frmDoiMatKhau.cs 프로젝트: mainam/XLT
 private void btnThayDoi_Click(object sender, EventArgs e)
 {
     if (!XuLyXml.DocTaiKhoan(txtTenDangNhap.Text, MaHoaMatKhau.MaHoa(txtMatKhauCu.Text)))
     {
         MessageBox.Show("Mật khẩu cũ không đúng vui lòng nhập lại", "Sai mật khẩu", MessageBoxButtons.OK, MessageBoxIcon.Error);
         btnReset.PerformClick();
         return;
     }
     if (txtMauKhauMoi.Text != txtConfirmPass.Text)
     {
         MessageBox.Show("Mật khẩu không giống nhau, vui lòng nhập lại", "Sai mật khẩu", MessageBoxButtons.OK, MessageBoxIcon.Error);
         btnReset.PerformClick();
         return;
     }
     try
     {
         XuLyXml.LuuTaiKhoan(txtTenDangNhap.Text.ToLower(), MaHoaMatKhau.MaHoa(txtMauKhauMoi.Text));
         MessageBox.Show("Đổi thành công thông tin tài khoản", "Đổi mật khẩu", MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnThoat.PerformClick();
     }
     catch
     { MessageBox.Show("Không thể đổi mật khẩu", "Lỗi đổi mật khẩu", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }