示例#1
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);
        }