public teacher_check(ConnectionPool CP, teacher teacherDemo)
        {
            InitializeComponent();
            pictureBox7.Hide();
            label3.Hide();
            this.CP          = CP;
            this.teacherDemo = teacherDemo;
            string sql = $"select * from tb_apply where tutor_ID={teacherDemo.getTeacher_ID()} " +
                         $"or instructor_ID={teacherDemo.getTeacher_ID()}";
            selecter        selecterDemo = new selecter(CP, sql);
            apply           applyDemo;
            MySqlDataReader reader = selecterDemo.execute();

            while (reader.Read())
            {
                applyDemo = new apply();
                applyDemo.setApply_ID(reader.GetInt32("apply_ID"));
                applyDemo.setStu_ID(reader.GetInt32("stu_ID"));
                applyDemo.setTutor_ID(reader.GetInt32("tutor_ID"));
                applyDemo.setInstructor_ID(reader.GetInt32("instructor_ID"));
                applyDemo.setApply_time(reader.GetDateTime("apply_time"));
                applyDemo.setApply_start(reader.GetDateTime("apply_start"));
                applyDemo.setApply_end(reader.GetDateTime("apply_end"));
                applyDemo.setApply_reason(reader.GetString("apply_reason"));
                applyDemo.setCheck_tutor(reader.GetInt32("check_tutor"));
                applyDemo.setCheck_instructor(reader.GetInt32("check_instructor"));
                if (teacherDemo.getTeacher_pos() == 1)
                {
                    if (applyDemo.getCheck_tutor() == 0 && applyDemo.getTutor_ID() == teacherDemo.getTeacher_ID())
                    {
                        applyList.Add(applyDemo);
                    }
                }
                else
                {
                    if (applyDemo.getCheck_instructor() == 0 && applyDemo.getCheck_tutor() == 1 && applyDemo.getInstructor_ID() == teacherDemo.getTeacher_ID())
                    {
                        applyList.Add(applyDemo);
                    }
                }
            }
            selecterDemo.end();
            sql_student     ss = new sql_student(CP);
            DataGridViewRow dr = new DataGridViewRow();

            foreach (apply ap in applyList)
            {
                int index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells[0].Value = ss.getNumByID(ap.getStu_ID());
                dataGridView1.Rows[index].Cells[1].Value = ss.getNameByID(ap.getStu_ID());
                dataGridView1.Rows[index].Cells[2].Value = ap.getApply_start();
                dataGridView1.Rows[index].Cells[3].Value = ap.getApply_end();
                dataGridView1.Rows[index].Cells[4].Value = ap.getApply_reason();
                dataGridView1.Rows[index].Cells[5].Value = ap.getApply_time();
            }
        }
        public infor_stu(ConnectionPool CP, student studentDemo)
        {
            InitializeComponent();
            this.CP          = CP;
            this.studentDemo = studentDemo;
            List <apply>    applyList    = new List <apply>();
            string          sql          = $"select * from tb_apply where stu_ID={studentDemo.getStu_ID()}";
            selecter        selecterDemo = new selecter(CP, sql);
            apply           applyDemo;
            MySqlDataReader reader = selecterDemo.execute();

            while (reader.Read())
            {
                applyDemo = new apply();
                applyDemo.setApply_ID(reader.GetInt32("apply_ID"));
                applyDemo.setStu_ID(reader.GetInt32("stu_ID"));
                applyDemo.setTutor_ID(reader.GetInt32("tutor_ID"));
                applyDemo.setInstructor_ID(reader.GetInt32("instructor_ID"));
                applyDemo.setApply_time(reader.GetDateTime("apply_time"));
                applyDemo.setApply_start(reader.GetDateTime("apply_start"));
                applyDemo.setApply_end(reader.GetDateTime("apply_end"));
                applyDemo.setApply_reason(reader.GetString("apply_reason"));
                applyDemo.setCheck_tutor(reader.GetInt32("check_tutor"));
                applyDemo.setCheck_instructor(reader.GetInt32("check_instructor"));
                if (applyDemo.getCheck_tutor() == 2 || applyDemo.getCheck_instructor() == 2)
                {
                    applyDemo.setApply_refuse(reader.GetString("apply_refuse"));
                }
                if (applyDemo.getCheck_tutor() == 1 && applyDemo.getCheck_instructor() == 1)
                {
                    applyDemo.setApply_refuse("申请通过");
                }
                applyList.Add(applyDemo);
            }
            selecterDemo.end();
            sql_student ss = new sql_student(CP);

            foreach (apply ap in applyList)
            {
                int index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells[0].Value = ap.getApply_time();
                dataGridView1.Rows[index].Cells[1].Value = ap.getApply_reason();
                dataGridView1.Rows[index].Cells[2].Value = ap.getApply_start();
                dataGridView1.Rows[index].Cells[3].Value = ap.getApply_end();
                dataGridView1.Rows[index].Cells[4].Value = ss.getState_tutor(ap.getCheck_tutor());
                dataGridView1.Rows[index].Cells[5].Value = ss.getState_instructor(ap.getCheck_tutor(), ap.getCheck_instructor());
                dataGridView1.Rows[index].Cells[6].Value = ap.getApply_refuse();
            }
        }
示例#3
0
        public apply_detail(ConnectionPool CP, apply app, teacher teacherDemo)
        {
            InitializeComponent();
            pictureBox7.Hide();
            label10.Hide();
            this.CP          = CP;;
            this.teacherDemo = teacherDemo;
            this.applyDemo   = app;
            sql_student ss = new sql_student(CP);

            label4.Text       = ss.getNumByID(applyDemo.getStu_ID());
            label5.Text       = ss.getNameByID(applyDemo.getStu_ID());
            richTextBox1.Text = applyDemo.getApply_reason();
            label6.Text       = applyDemo.getApply_start().ToString() + "——" + applyDemo.getApply_end().ToString();
        }
        public int insert(apply applyDemo)
        {
            MySqlConnection conn = CP.getConnection();
            string          sql;

            sql = "insert into tb_apply(stu_ID,tutor_ID,instructor_ID,apply_time,apply_start,apply_end," +
                  "apply_reason,check_tutor,check_instructor,apply_editTime) values" +
                  $"({applyDemo.getStu_ID()},{applyDemo.getTutor_ID()},{applyDemo.getInstructor_ID()}," +
                  $"'{applyDemo.getApply_time()}','{applyDemo.getApply_start()}','{applyDemo.getApply_end()}'," +
                  $"'{applyDemo.getApply_reason()}',{applyDemo.getCheck_tutor()},{applyDemo.getCheck_instructor()}," +
                  $"'{applyDemo.getApply_editTime()}')";
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            int          j   = cmd.ExecuteNonQuery();

            CP.closeConnection(CP.getConnection());
            return(j);
        }
        public int check_refuse(apply applyDemo, teacher teacherDemo, string refuse)
        {
            MySqlConnection conn = CP.getConnection();
            DateTime        DT   = DateTime.Now;
            string          sql;

            if (teacherDemo.getTeacher_pos() == 1)
            {
                sql = $"update tb_apply set check_tutor=2,apply_editTime='{DT}',apply_refuse='{refuse}' where apply_ID={applyDemo.getApply_ID()}";
            }
            else
            {
                sql = $"update tb_apply set check_instructor=2,apply_editTime='{DT}',apply_refuse='{refuse}' where apply_ID={applyDemo.getApply_ID()}";
            }
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            int          j   = cmd.ExecuteNonQuery();

            CP.closeConnection(conn);
            return(j);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (richTextBox1.Text == "")
     {
         pictureBox2.Show();
         label6.Show();
         flag = false;
         return;
     }
     else
     {
         pictureBox2.Hide();
         label6.Hide();
         flag = true;
     }
     if (flag == true)//验证通过
     {
         apply applyDemo = new apply();
         applyDemo.setStu_ID(studentDemo.getStu_ID());
         applyDemo.setApply_start(dateTimePicker1.Value);
         applyDemo.setApply_end(dateTimePicker2.Value);
         applyDemo.setApply_reason(richTextBox1.Text);
         applyDemo.setCheck_tutor(0);
         applyDemo.setInstructor_ID(0);
         applyDemo.setApply_refuse("");
         applyDemo.setApply_editTime(DateTime.Now);
         applyDemo.setApply_time(DateTime.Now);
         applyDemo.setTutor_ID(tutor_ID);
         applyDemo.setInstructor_ID(instructor_ID);
         applyDemo.setApply_editTime(DateTime.Now);
         sql_apply sa = new sql_apply(CP);
         sa.insert(applyDemo);
         MessageBox.Show("添加成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         this.Hide();
     }
 }
        public info_clazz(ConnectionPool CP)
        {
            InitializeComponent();
            pictureBox7.Hide();
            label3.Hide();
            this.CP = CP;
            string sql;

            sql = "select count(*),clazz_name from tb_apply,tb_student,tb_clazz " +
                  "where tb_apply.stu_ID=tb_student.stu_ID and tb_student.clazz_ID=tb_clazz.clazz_ID " +
                  "GROUP BY clazz_name ORDER BY count(*)";
            selecter        selecterDemo = new selecter(CP, sql);
            MySqlDataReader reader       = selecterDemo.execute();

            while (reader.Read())
            {
                int index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells[0].Value = reader.GetString("clazz_name");
                dataGridView1.Rows[index].Cells[1].Value = reader.GetInt32("count(*)");
            }
            reader.Dispose();
            selecterDemo.end();
            string sql2;

            sql2         = "select * from tb_apply";
            selecterDemo = new selecter(CP, sql2);
            reader       = selecterDemo.execute();
            apply applyDemo;

            while (reader.Read())
            {
                applyDemo = new apply();
                applyDemo.setApply_ID(reader.GetInt32("apply_ID"));
                applyDemo.setStu_ID(reader.GetInt32("stu_ID"));
                applyDemo.setTutor_ID(reader.GetInt32("tutor_ID"));
                applyDemo.setInstructor_ID(reader.GetInt32("instructor_ID"));
                applyDemo.setApply_time(reader.GetDateTime("apply_time"));
                applyDemo.setApply_start(reader.GetDateTime("apply_start"));
                applyDemo.setApply_end(reader.GetDateTime("apply_end"));
                applyDemo.setApply_reason(reader.GetString("apply_reason"));
                applyDemo.setCheck_tutor(reader.GetInt32("check_tutor"));
                applyDemo.setCheck_instructor(reader.GetInt32("check_instructor"));
                if (applyDemo.getCheck_tutor() == 0 || applyDemo.getCheck_instructor() == 0)
                {
                    applyDemo.setApply_refuse("审核中");
                }
                if (applyDemo.getCheck_tutor() == 2 || applyDemo.getCheck_instructor() == 2)
                {
                    applyDemo.setApply_refuse(reader.GetString("apply_refuse"));
                }
                if (applyDemo.getCheck_tutor() == 1 && applyDemo.getCheck_instructor() == 1)
                {
                    applyDemo.setApply_refuse("申请通过");
                }
                applyList.Add(applyDemo);
            }
            selecterDemo.end();
            sql_student ss = new sql_student(CP);

            foreach (apply ap in applyList)
            {
                int index = dataGridView2.Rows.Add();
                dataGridView2.Rows[index].Cells[0].Value = ss.getNumByID(ap.getStu_ID());
                dataGridView2.Rows[index].Cells[1].Value = ss.getNameByID(ap.getStu_ID());
                dataGridView2.Rows[index].Cells[2].Value = ap.getApply_time();
                dataGridView2.Rows[index].Cells[3].Value = ap.getApply_reason();
                dataGridView2.Rows[index].Cells[4].Value = ap.getApply_refuse();
            }
        }