コード例 #1
0
        private void BtnDangKy_Click(object sender, EventArgs e)
        {
            TaiKhoan taiKhoan = new TaiKhoan();

            taiKhoan.Name = txtName.Text;
            taiKhoan.Pass = MD5Demo.GetMD5HashData(txtPass.Text);
            dbContext.TaiKhoans.Add(taiKhoan);
            dbContext.SaveChanges();
            MessageBox.Show("Tai tai khoan thanh cong!");
        }
コード例 #2
0
        private void BtnDangNhap_Click(object sender, EventArgs e)
        {
            TaiKhoan taiKhoan = dbContext.TaiKhoans.Where(x => x.Name == txtName.Text.Trim()).FirstOrDefault <TaiKhoan>();

            if (taiKhoan != null)
            {
                if (MD5Demo.ValidateMD5HashData(txtPass.Text, taiKhoan.Pass))
                {
                    EventSetControlEnable thongBao = new EventSetControlEnable();
                    thongBao.isUse = true;
                    loginSystemClick(this, thongBao);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Mat khau khong dung!");
                }
            }
            else
            {
                MessageBox.Show("Khong ton tai tai khoan nay!");
            }
        }