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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        public main_teacher(ConnectionPool CP, string user, string username)
        {
            InitializeComponent();
            this.CP     = CP;
            label3.Text = username;
            MySqlDataReader reader;
            string          sql          = $"select * from tb_teacher where teacher_num={user}";
            selecter        selecterDemo = new selecter(CP, sql);

            reader = selecterDemo.execute();
            reader.Read();
            teacherDemo.setTeacher_ID(reader.GetInt32("teacher_ID"));
            teacherDemo.setTeacher_num(user);
            teacherDemo.setTeacher_name(username);
            teacherDemo.setTeacher_pos(reader.GetInt32("teacher_pos"));
            teacherDemo.setTeacher_tel(reader.GetString("teacher_tel"));
            selecterDemo.end();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            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();

            dataGridView1.Rows.Clear();
            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(*)");
            }
            selecterDemo.end();
        }
Exemplo n.º 5
0
        public apply_add(ConnectionPool CP, student studentDemo)
        {
            InitializeComponent();
            this.CP          = CP;
            this.studentDemo = studentDemo;
            pictureBox7.Hide();
            label10.Hide();
            pictureBox2.Hide();
            label6.Hide();
            sql_student ss = new sql_student(CP);

            ss.getID(studentDemo);
            string          sql          = $"select * from tb_student,tb_clazz where tb_student.clazz_ID=tb_clazz.clazz_ID and tb_student.stu_ID={studentDemo.getStu_ID()}";
            selecter        selecterDemo = new selecter(CP, sql);
            MySqlDataReader reader       = selecterDemo.execute();

            reader.Read();
            tutor_ID      = reader.GetInt32("tutor_ID");
            instructor_ID = reader.GetInt32("instructor_ID");
            reader.Dispose();
            selecterDemo.end();
        }
Exemplo n.º 6
0
        public main_student(ConnectionPool CP, string user, string username)
        {
            InitializeComponent();
            this.CP     = CP;
            label3.Text = username;
            stu_num     = user;
            stu_name    = username;
            MySqlDataReader reader;
            string          sql          = $"select * from tb_student where stu_num={stu_num}";
            selecter        selecterDemo = new selecter(CP, sql);

            reader = selecterDemo.execute();
            reader.Read();
            studentDemo.setClazz_ID(reader.GetInt32("clazz_ID"));
            studentDemo.setStu_ID(reader.GetInt32("stu_ID"));
            studentDemo.setStu_num(reader.GetString("stu_num"));
            studentDemo.setStu_name(reader.GetString("stu_name"));
            studentDemo.setStu_sex(reader.GetInt32("stu_sex"));
            studentDemo.setStu_tel(reader.GetString("stu_tel"));
            studentDemo.setStu_password(reader.GetString("stu_password"));
            selecterDemo.end();
        }
        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();
            }
        }
Exemplo n.º 8
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Boolean flag;

            flag = true;
            student newstu = new student();

            if (textBox3.Text != textBox4.Text)//判密码
            {
                pictureBox3.Show();
                label11.Show();
                flag = false;
                return;
            }
            else
            {
                pictureBox3.Hide();
                label11.Hide();
            }
            if (textBox3.Text == "")
            {
                flag = false;
                pictureBox5.Show();
                label13.Show();
                return;
            }
            else
            {
                pictureBox5.Hide();
                label13.Hide();
            }

            if (textBox5.Text.Length != 11 || textBox5.Text.Substring(0, 1) != "1")//验手机号
            {
                flag = false;
                pictureBox4.Show();
                label12.Show();
                return;
            }
            else
            {
                pictureBox4.Hide();
                label12.Hide();
            }
            string   sql          = $"select * from tb_student where stu_num = '{textBox1.Text}'";;
            selecter selecterDemo = new selecter(CP, sql);

            try
            {
                if (selecterDemo.getNum() != 0)
                {
                    pictureBox7.Show();
                    label10.Show();
                    flag = false;
                    return;
                }
                else
                {
                    pictureBox7.Hide();
                    label10.Hide();//到此成功注册
                    newstu.setClazz_ID(comboBox1.SelectedIndex + 1);
                    newstu.setStu_name(textBox2.Text);
                    newstu.setStu_num(textBox1.Text);
                    newstu.setStu_sex(comboBox2.SelectedIndex);
                    newstu.setStu_password(pw.lockstring(textBox3.Text));
                    newstu.setStu_tel(textBox5.Text);
                    newstu.setStu_addTime(DateTime.Now);
                    newstu.setStu_editTime(DateTime.Now);
                }
            }
            finally
            {
                selecterDemo.end();
            }
            sql_student ss = new sql_student(CP);
            int         j  = ss.insert(newstu);

            this.Hide();
            MessageBox.Show("注册成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
Exemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            Boolean         flag = true;
            MySqlDataReader reader;

            user = textBox1.Text;
            string password;

            if (!radioButton1.Checked && !radioButton2.Checked)
            {
                label4.Show();
                pictureBox9.Show();
                flag = false;
                return;
            }
            else
            {
                label4.Hide();
                pictureBox9.Hide();
            }


            if (radioButton2.Checked)//学生
            {
                string   sql          = $"select * from tb_student where stu_num = '{user}'";
                selecter selecterDemo = new selecter(CP, sql);
                try
                {
                    if (0 == selecterDemo.getNum())
                    {
                        label3.Show();
                        pictureBox7.Show();
                        flag = false;
                        return;
                    }
                    else
                    {
                        label3.Hide();
                        pictureBox7.Hide();
                    }
                    reader = selecterDemo.execute();
                    reader.Read();
                    password = reader.GetString("stu_password");
                    username = reader.GetString("stu_name");
                    reader.Dispose();
                    if (pw.unlockstring(password) != textBox2.Text)
                    {
                        label2.Show();
                        pictureBox8.Show();
                        flag = false;
                        return;
                    }
                    else
                    {
                        label2.Hide();
                        pictureBox8.Hide();//到此学生成功登陆
                    }
                }
                finally
                {
                    selecterDemo.end();
                }
                this.Hide();
                main_student ms = new main_student(CP, user, username);
                ms.ShowDialog(this);
                this.Show();
            }
            if (radioButton1.Checked)//教师
            {
                string   sql          = $"select * from tb_teacher where teacher_num = '{user}'";
                selecter selecterDemo = new selecter(CP, sql);
                try
                {
                    if (0 == selecterDemo.getNum())
                    {
                        label3.Show();
                        pictureBox7.Show();
                        flag = false;
                        return;
                    }
                    else
                    {
                        label3.Hide();
                        pictureBox7.Hide();
                    }
                    reader = selecterDemo.execute();
                    reader.Read();
                    password = reader.GetString("teacher_password");
                    username = reader.GetString("teacher_name");
                    reader.Dispose();
                    if (pw.unlockstring(password) != textBox2.Text)
                    {
                        label2.Show();
                        pictureBox8.Show();
                        flag = false;
                        return;
                    }
                    else
                    {
                        label2.Hide();
                        pictureBox8.Hide();//到此教师成功登陆
                    }
                }
                finally
                {
                    selecterDemo.end();
                }
                this.Hide();
                main_teacher mt = new main_teacher(CP, user, username);
                mt.ShowDialog(this);
                this.Show();
            }
        }