Exemplo n.º 1
0
        private void btn_view_booking_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form16 f16 = new Form16(username1);

            f16.ShowDialog();
        }
Exemplo n.º 2
0
        /*
         *登录按钮触发事件
         */
        private void button1_Click(object sender, EventArgs e)
        {
            string          wa;
            OleDbConnection a1 = new OleDbConnection();
            OleDbCommand    a2 = new OleDbCommand();

            //数据库连接
            a1.ConnectionString = "Provider=Microsoft.ace.OLEDB.12.0;Data Source= 学生信息管理数据库.accdb";
            a1.Open();
            //在数据库中查找对应 的用户名和密码
            wa             = "Select * from 用户表 where 用户名='" + textBox1.Text.Trim() + "'and 密码='" + textBox2.Text.Trim() + "'and 角色='" + comboBox1.Text.Trim() + "'";
            a2.CommandText = wa;
            a2.Connection  = a1;
            a2.ExecuteScalar();
            //获取到数据证明输入账号正确
            if (null != a2.ExecuteScalar())
            {
                //判断账户类型是否为学生
                if (comboBox1.Text == "学生")
                {
                    MessageBox.Show("欢迎进入信息管理系统学生端!", "登录成功!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Visible = false;
                    Form2 f2 = new Form2();   //Form2为学生端主界面
                    f2.ShowDialog();
                    this.Visible = true;
                }
                else
                {
                    //判断账户类型是否为老师
                    if (comboBox1.Text == "老师")
                    {
                        MessageBox.Show("欢迎进入信息管理系统教师端!", "登录成功!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Visible = false;
                        Form4 f3 = new Form4();  //Form4为教师端主界面
                        f3.ShowDialog();
                        this.Visible = true;
                    }
                    else
                    {
                        //判断账户类型是否为管理员
                        MessageBox.Show("欢迎进入后台管理模式!", "登录成功!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Visible = false;
                        Form16 f4 = new Form16();  //Form2为后台管理主界面
                        f4.ShowDialog();
                        this.Visible = true;
                    }
                }
            }
            else  //账户或者密码错误
            {
                MessageBox.Show("登录失败!请输入正确的用户名、密码和角色!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection.Open();
            OleDbCommand command = new OleDbCommand();

            command.Connection = connection;
            int match, ticket;

            int.TryParse(txt_match.Text, out match);
            int.TryParse(txt_ticket.Text, out ticket);
            string query = "delete from Booking where MatchNo=" + match + " and Usernamee='" + username1 + "'";

            command.CommandText = query;
            command.ExecuteNonQuery();

            if (txt_ticket_type.Text == "GrandStand")
            {
                query = "update Venue_Capacity set Grand_Stand=Grand_Stand+" + ticket + " where MatchNo=" + matchno + "";
            }
            else if (txt_ticket_type.Text == "Business")
            {
                query = "update Venue_Capacity set Business_Class=Business_Class+" + ticket + " where MatchNo=" + matchno + "";
            }
            else if (txt_ticket_type.Text == "Lawn")
            {
                query = "update Venue_Capacity set Lawn=Lawn+" + ticket + " where MatchNo=" + matchno + "";
            }
            else if (txt_ticket_type.Text == "Economy")
            {
                query = "update Venue_Capacity set Economy_Class=Economy_Class+" + ticket + " where MatchNo=" + matchno + "";
            }

            command.CommandText = query;
            command.ExecuteNonQuery();

            connection.Close();

            this.Hide();
            Form16 f16 = new Form16(username1);

            f16.ShowDialog();
        }