示例#1
0
 public agent loginAgent(string login, string password)
 {
     try
     {
         agent     o;
         DataTable dt = execQuery("select top 1 * from agent where login = '******'", "''") + "' and password='******'", "''") + "'").Tables[0];
         if (dt.Rows.Count > 0)
         {
             o          = new agent();
             o.id       = dt.Rows[0]["id"].ToString();
             o.name     = dt.Rows[0]["name"].ToString();
             o.login    = dt.Rows[0]["login"].ToString();
             o.password = dt.Rows[0]["password"].ToString();
             o.superid  = dt.Rows[0]["superid"].ToString();
             return(o);
         }
         return(null);
     }
     catch (Exception)
     {
         return(null);
     }
 }
示例#2
0
 private void btnDangnhap_Click(object sender, EventArgs e)
 {
     if (radMember.Checked)
     {
         m = db.loginMember(txtUsername.Text, txtPassword.Text);
         if (m != null)
         {
             frmMember frm = new frmMember();
             frm.Show();
             this.Hide();
         }
     }
     else if (radAgent.Checked)
     {
         a = db.loginAgent(txtUsername.Text, txtPassword.Text);
         if (a != null)
         {
             this.Hide();
             frmAgent frm = new frmAgent();
             frm.ShowDialog();
             this.Close();
         }
     }
 }