private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtmatkhau.Text == "" || txtreplymatkhau.Text == "")
     {
         MessageBox.Show("Mật khẩu không được bỏ trống được!!");
         return;
     }
     else
     {
         if (String.Compare(txtmatkhau.Text, txtreplymatkhau.Text) != 0)
         {
             MessageBox.Show("Mật khẩu bạn nhập phải trùng nhau!!!");
             return;
         }
         else
         {
             tbl_NguoiDung obj = new tbl_NguoiDung();
             obj.TenDangNhap = lst[0].TenDangNhap;
             obj.IdQuyen     = lst[0].IdQuyen;
             obj.MaCB        = lst[0].MaCB;
             obj.MatKhau     = EncryptorMD5.MD5Hash(txtmatkhau.Text);
             obj.Id          = ID_User;
             if (NguoiDungService.NguoiDung_Update(obj) == true)
             {
                 MessageBox.Show("Đổi mật khẩu thành công!", "Thông báo");
             }
         }
     }
     this.Close();
 }
Exemple #2
0
        void Dangnhap()
        {
            if (txttaikhoan.Text == string.Empty || txtmatkhau.Text == string.Empty)
            {
                MessageBox.Show("Bạn phải nhập đầy đủ thông tin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txttaikhoan.Focus();
                return;
            }
            List <Entity.tbl_NguoiDung> lst = new List <Entity.tbl_NguoiDung>();

            lst = NguoiDungService.NguoiDungGetByTop("", " TenDangNhap='" + txttaikhoan.Text + "' AND MatKhau='" + EncryptorMD5.MD5Hash(txtmatkhau.Text) + "'", "");
            if (lst.Count == 0)
            {
                MessageBox.Show("Bạn đã đăng nhập sai", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txttaikhoan.Focus();
            }
            else
            {
                frmHeThong ht = new frmHeThong();
                //ht.UserName = txttaikhoan.Text;
                this.Hide();
                MessageBox.Show("Bạn đã đăng nhập thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ht.Show();
            }
        }