Пример #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtPass.Text != "" && txtUser.Text != "")
     {
         DataTable dt = new DataTable();
         try
         {
             dt = busACCOUNT.GetAccountOfPass(txtUser.Text, txtPass.Text);
         }
         catch (Exception)
         {
             XtraMessageBox.Show("Lấy dữ liệu từ database thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (dt.Rows.Count > 0)
         {
             DataRow row = dt.Rows[0];
             Form    frm = new frmMain(row);
             this.Hide();
             frm.ShowDialog();
             this.Close();
         }
         else
         {
             XtraMessageBox.Show("Sai tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         XtraMessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }