Beispiel #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (tbPwd.Text == "" || tbID.Text == "")
            {
                return;
            }
            // admin
            DataTable dt = SQLHelper.ExecuteQuery("select * from Admin where ID=@name and Password=@pwd",
                                                  new SqlParameter("@name", this.tbID.Text),
                                                  new SqlParameter("@pwd", this.tbPwd.Text));

            if (dt.DefaultView.Count == 1)
            {
                AdminForm f = new AdminForm(this);
                f.Show();
                this.Hide();
            }
            else
            {
                // student
                dt = SQLHelper.ExecuteQuery("select * from Login where ID=@name and Password=@pwd",
                                            new SqlParameter("@name", this.tbID.Text),
                                            new SqlParameter("@pwd", this.tbPwd.Text));
                if (dt.DefaultView.Count == 1)
                {
                    MainForm mf = new MainForm(this, dt.Rows[0]["ID"].ToString());
                    mf.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("您输入的账号或密码有误,请核对后仔细输入。", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.tbPwd.Text = "";
                }
            }
        }
Beispiel #2
0
 public SearchBooks(AdminForm f) : this()
 {
     this.f = f;
 }
Beispiel #3
0
 public SearchBorrow(AdminForm f) : this()
 {
     this.f = f;
 }
Beispiel #4
0
 public SerchStudent(AdminForm f) : this()
 {
     this.f = f;
 }