Example #1
0
 private bool checkLogin()
 {
     DataLayer DL = new DataLayer();
     string sqlQuery = "update account set online=0 ";
     DL.updateData(sqlQuery);
     if (txtUserLogin.Text.Trim()=="")
     {
         MessageBox.Show("Chưa nhập tài khoản");
         txtUserLogin.Focus();
         return false;
     }
     if(txtPassLogin.Text.Trim()=="")
     {
         MessageBox.Show("Chưa nhập mật khẩu");
         txtPassLogin.Focus();
         return false;
     }
     sqlQuery = @"select * from account where Username=N'" + txtUserLogin.Text.Trim() + "' and pass=N'"+txtPassLogin.Text.Trim()+"'";
     int numberRow=DL.countRow(sqlQuery);
     if (numberRow==0)
     {
         MessageBox.Show("Tài khoản hoặc mật khẩu không đúng!!!!");
         return false;
     }
     else
     {
         sqlQuery = @"update account set online=1 where Username=N'" + txtUserLogin.Text.Trim() + "' and pass=N'" + txtPassLogin.Text.Trim() + "'";
         DL.updateData(sqlQuery);
     }
     frmMainA mainForm = new frmMainA();
     this.Hide();
     mainForm.ShowDialog();
     return true;
 }
Example #2
0
 private bool isExistAccount()
 {
     DataLayer DL = new DataLayer();
     string sqlQuery = @"select * from account where account=N' " + txtAccount.Text.Trim() +"'";
     int numberRow = DL.countRow(sqlQuery);
     if (numberRow >0)
     {
         MessageBox.Show("Tài khoản đã tồn tại!!!!");
         return true;
     }
     return false;
 }