Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "update Yy set Sh='" + comboBox2.Text + "'where Sjd='" + str[3] + "'";
            Dao1   dao = new Dao1();

            dao.Execute(sql);
            this.Hide();
            ShenHe shenhe = new ShenHe();

            shenhe.Show();
        }
Esempio n. 2
0
        private void 取消预约ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string Id, Name;

            Id   = dataGridView1.SelectedCells[0].Value.ToString();
            Name = dataGridView1.SelectedCells[1].Value.ToString();
            string sql = "delete from Yy where Id='" + Id + "'and Name='" + Name + "'";
            Dao1   dao = new Dao1();

            MessageBox.Show("取消成功");
            dao.Execute(sql);
        }
Esempio n. 3
0
        private void  除账号ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string Name, Password;

            Name     = dataGridView1.SelectedCells[0].Value.ToString();
            Password = dataGridView1.SelectedCells[1].Value.ToString();
            string sql = "delete from YH where Name='" + Name + "'and Password='******'";
            Dao1   dao = new Dao1();

            MessageBox.Show("删除成功!");
            dao.Execute(sql);
        }
Esempio n. 4
0
        private bool login()
        {
            if (textBox1.Text == "" || textBox2.Text == "" || comboBox1.Text == "")
            {
                MessageBox.Show("输入不完整或者错误,请重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            if (comboBox1.Text == "学生")
            {
                string      sql = "select *from student where Name='" + textBox1.Text + "'and Password='******'";
                Dao1        dao = new Dao1();
                IDataReader dr  = dao.read(sql);
                if (dr.Read())
                {
                    return(true);
                }
                else
                {
                    MessageBox.Show("输入有误,请检查后重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
            }
            if (comboBox1.Text == "老师")
            {
                string      sql = "select *from Teacher where Name='" + textBox1.Text + "'and Password='******'";
                Dao1        dao = new Dao1();
                IDataReader dr  = dao.read(sql);
                if (dr.Read())
                {
                    return(true);
                }
                else
                {
                    MessageBox.Show("输入有误,请检查后重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
            }
            if (comboBox1.Text == "管理员")
            {
                if (textBox1.Text == "admin" && textBox2.Text == "123456")
                {
                    return(true);
                }
                else
                {
                    MessageBox.Show("输入有误,请检查后重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
            }
            return(false);
        }
Esempio n. 5
0
        private void  除实验室ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string Sjd, Date, Id;

            Date = dataGridView1.SelectedCells[0].Value.ToString();
            Sjd  = dataGridView1.SelectedCells[1].Value.ToString();
            Id   = dataGridView1.SelectedCells[2].Value.ToString();
            string sql = "delete from class where Date='" + Date + "'and Sjd='" + Sjd + "'and Id='" + Id + "'";
            Dao1   dao = new Dao1();

            MessageBox.Show("删除成功");
            dao.Execute(sql);
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == null || textBox2.Text == null || comboBox1.Text == null)
            {
                MessageBox.Show("输入不完整,请重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            string sql = "insert into class values('" + textBox1.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "')";
            Dao1   dao = new Dao1();
            int    i   = dao.Execute(sql);

            if (i > 0)
            {
                MessageBox.Show("添加成功!");
                this.Hide();
            }
        }
Esempio n. 7
0
        private void Table()
        {
            string      sql = "select*from class";
            Dao1        dao = new Dao1();
            IDataReader dr  = dao.read(sql);

            while (dr.Read())
            {
                string a, b, c;
                a = dr["Date"].ToString();
                b = dr["Sjd"].ToString();
                c = dr["Id"].ToString();
                string[] str = { a, b, c };
                dataGridView1.Rows.Add(str);
            }
            dr.Close();
        }
Esempio n. 8
0
        private void Table()
        {
            dataGridView1.Rows.Clear();
            string      sql = "select*from Yy";
            Dao1        dao = new Dao1();
            IDataReader dr  = dao.read(sql);

            while (dr.Read())
            {
                string a, b, c, d, o;
                a = dr["Id"].ToString();
                b = dr["Name"].ToString();
                c = dr["Date"].ToString();
                d = dr["Sjd"].ToString();
                o = dr["Classid"].ToString();
                string[] str = { a, b, c, d, o };
                dataGridView1.Rows.Add(str);
            }
            dr.Close();
        }
Esempio n. 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "" || textBox2.Text == "")
     {
         MessageBox.Show("学号和姓名不能为空,请重新输入!");
     }
     else
     {
         string      sql = "select *from Yy where Id='" + textBox1.Text + "'and Name='" + textBox2.Text + "'";
         Dao1        dao = new Dao1();
         IDataReader dr  = dao.read(sql);
         if (dr.Read())
         {
             table();
         }
         else
         {
             MessageBox.Show("没有查询到信息,请检查后重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }