Exemple #1
0
        public Model.AAdmin UserLogin(Model.AAdmin admin)
        {
            string sql = "select * from dbo.admin where id=@id and psw=@psw";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@id", admin.AdId),
                new SqlParameter("@psw", admin.AdPsd)
            };

            try
            {
                SqlDataReader reader = SqlDbHelper.GetDataReader(sql, paras);
                if (reader.Read())
                {
                    admin.AdId = reader["id"].ToString();
                }
                else
                {
                    admin = null;
                }
                reader.Close();
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(admin);
        }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     Model.AAdmin admin = new Model.AAdmin()
     {
         AdId  = this.textBox1.Text.Trim(),
         AdPsd = this.textBox2.Text.Trim()
     };
     Model.AAdmin adminLogin = adminLogic.UserLogin(admin);
     if (adminLogin == null)
     {
         MessageBox.Show("账号或密码错误,请重新输入");
         return;
     }
     else
     {
         this.DialogResult = DialogResult.OK;
         //MessageBox.Show("登陆成功");
         管理员 a = new 管理员(uid);//新窗体弹窗,旧的隐藏
         this.Hide();
         a.ShowDialog();
         this.Show();
     }
 }
Exemple #3
0
 public Model.AAdmin UserLogin(Model.AAdmin admin)
 {
     return(adminDao.UserLogin(admin));
 }