예제 #1
0
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     if (txt_MatKhau.Text.Trim() != "")
     {
         string a = txtTaiKhoan.Text;
         string b = dn.Layquyen1(a).Tables[0].Rows[0][0].ToString(); ///
         if (b == "Admin")
         {
             bool f = dn.KiemTraTaiKhoan(txtTaiKhoan.Text, txt_MatKhau.Text);
             if (f)
             {
                 MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 DangNhap.ActiveForm.Hide();
                 Home Form2 = new Home();
                 Form2.Text = txtTaiKhoan.Text;
                 Form2.ShowDialog();
             }
             else
             {
                 MessageBox.Show("Mật khẩu không đúng!\nHãy thử lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txt_MatKhau.ResetText();
                 txt_MatKhau.Focus();
             }
         }
         else
         {
             bool f = dn.KiemTraTaiKhoan(txtTaiKhoan.Text, txt_MatKhau.Text);
             if (f)
             {
                 MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 DangNhap.ActiveForm.Hide();
                 Home_NV Form2 = new Home_NV();
                 Form2.Text = txtTaiKhoan.Text;
                 Form2.ShowDialog();
             }
             else
             {
                 MessageBox.Show("Mật khẩu không đúng!\nHãy thử lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txt_MatKhau.ResetText();
                 txt_MatKhau.Focus();
             }
         }
     }
     else
     {
         MessageBox.Show("Không được để trống mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txt_MatKhau.Focus();
     }
 }
예제 #2
0
 public frmTrailer1(Home_NV a)
 {
     InitializeComponent();
     home1 = a;
 }