private void cbb_Term_SelectedIndexChanged(object sender, EventArgs e)
 {
     BLL.TERM_INFO   termBll = new BLL.TERM_INFO();
     Model.TERM_INFO termMdl = new Model.TERM_INFO();
     termMdl = termBll.GetModel(this.cbb_Term.Properties.Items[this.cbb_Term.SelectedIndex].ToString());
     init_workflow(termMdl.TERMNO);
 }
        /// <summary>
        /// 读取数据
        /// </summary>
        private void readData()
        {
            if (this._termno > 0)
            {
                BLL.TERM_INFO   termBll = new BLL.TERM_INFO();
                Model.TERM_INFO termMdl = new Model.TERM_INFO();

                termMdl = termBll.GetModel(_termno);
                if (termMdl == null)   //新增学期功能时
                {
                    blankData();
                }
                else                   //修改学期功能时
                {
                    this.te_termname.Text  = termMdl.TERMNAME;
                    this.dt_begintime.Text = termMdl.BEGINTIME.ToString();
                    this.dt_endtime.Text   = termMdl.ENDTIME.ToString();
                    if (termMdl.FLAG == 0)
                    {
                        this.cbb_flag.Text = "非当前学期";
                    }
                    else
                    {
                        this.cbb_flag.Text = "当前学期";
                    }
                }
            }
        }
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.TERM_INFO   termBll = new BLL.TERM_INFO();
                Model.TERM_INFO termMdl = new Model.TERM_INFO();

                if (this.te_termname.Text == "")
                {
                    MessageBox.Show("学期名称不能为空!", "提示信息");
                    return(false);
                }

                if (dt_begintime.Value >= dt_endtime.Value)
                {
                    MessageBox.Show("起始时间不能大于截止日期!", "提示信息");
                    return(false);
                }

                if (cbb_flag.Text == "")
                {
                    MessageBox.Show("学期标志不能为空!", "提示信息");
                    return(false);
                }

                if (this._enumStatus == StatusClass.AddNew)  //新增学期
                {
                    termMdl.TERMNAME  = te_termname.Text;
                    termMdl.BEGINTIME = Student.DBUtility.ToolHelper.ConvertToDateTime(dt_begintime.Value);
                    termMdl.ENDTIME   = Student.DBUtility.ToolHelper.ConvertToDateTime(dt_endtime.Value);
                    if (cbb_flag.Text == "当前学期")
                    {
                        termMdl.FLAG = 1;
                    }
                    else
                    {
                        termMdl.FLAG = 0;
                    }

                    termBll.Add(termMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改信息
                {
                    termMdl.TERMNO    = this._termno;
                    termMdl.TERMNAME  = te_termname.Text;
                    termMdl.BEGINTIME = Student.DBUtility.ToolHelper.ConvertToDateTime(dt_begintime.Value);
                    termMdl.ENDTIME   = Student.DBUtility.ToolHelper.ConvertToDateTime(dt_endtime.Value);
                    termBll.Update(termMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// 增加数据方法
        /// </summary>
        private void Add()
        {
            int termno, teacherno, workflowno;

            if (this.cbb_teacher.SelectedIndex == -1)
            {
                MessageBox.Show("请选择指导教师!", "提示信息");
                return;
            }

            BLL.STUDENT_INFO   studentBll  = new BLL.STUDENT_INFO();
            BLL.TERM_INFO      termBll     = new BLL.TERM_INFO();
            Model.TERM_INFO    termMdl     = new Model.TERM_INFO();
            BLL.WORKFLOW       workflowBll = new BLL.WORKFLOW();
            Model.WORKFLOW     workflowMdl = new Model.WORKFLOW();
            BLL.TEACHER_INFO   teacherBll  = new BLL.TEACHER_INFO();
            Model.TEACHER_INFO teacherMdl  = new Model.TEACHER_INFO();
            BLL.TEA_STU        teastuBll   = new BLL.TEA_STU();
            Model.TEA_STU      teastuMdl   = new Model.TEA_STU();

            termMdl = termBll.GetModel(this.cbb_term.Properties.Items[this.cbb_term.SelectedIndex].ToString());
            termno  = termMdl.TERMNO;

            workflowMdl = workflowBll.GetModel(this.cbb_workflow.Properties.Items[this.cbb_workflow.SelectedIndex].ToString());
            workflowno  = workflowMdl.WORKFLOWNO;

            teacherMdl = teacherBll.GetModel(this.cbb_teacher.Properties.Items[this.cbb_teacher.SelectedIndex].ToString());
            teacherno  = teacherMdl.TEACHERNO;

            teastuMdl.TEACHERNO  = teacherno;
            teastuMdl.TERMNO     = termno;
            teastuMdl.WORKFLOWNO = workflowno;

            //获取所选学生学号列表
            this.lstCheckedStudentNo.Clear();

            if (this.tl_student.Nodes.Count > 0)
            {
                foreach (TreeListNode root in tl_student.Nodes)
                {
                    GetCheckedStudentNo(root);
                }
            }

            //将所选学生插入该教师所指导学生列表中
            string idStr = string.Empty;

            foreach (string stuno in lstCheckedStudentNo)
            {
                teastuMdl.STUNO = stuno;
                teastuBll.Add(teastuMdl);
            }
            //显示更新数据
            readData(2);
        }
        /// <summary>
        /// 读取数据
        /// </summary>
        private void readData(int flag)
        {
            int termno, teacherno, workflowno;

            BLL.STUDENT_INFO   studentBll  = new BLL.STUDENT_INFO();
            BLL.TERM_INFO      termBll     = new BLL.TERM_INFO();
            Model.TERM_INFO    termMdl     = new Model.TERM_INFO();
            BLL.WORKFLOW       workflowBll = new BLL.WORKFLOW();
            Model.WORKFLOW     workflowMdl = new Model.WORKFLOW();
            BLL.TEACHER_INFO   teacherBll  = new BLL.TEACHER_INFO();
            Model.TEACHER_INFO teacherMdl  = new Model.TEACHER_INFO();

            termMdl = termBll.GetModel(this.cbb_term.Properties.Items[this.cbb_term.SelectedIndex].ToString());
            termno  = termMdl.TERMNO;

            workflowMdl = workflowBll.GetModel(this.cbb_workflow.Properties.Items[this.cbb_workflow.SelectedIndex].ToString());
            workflowno  = workflowMdl.WORKFLOWNO;

            //初始化学生列表
            this.tl_student.DataSource                  = studentBll.GetStudentNodeList(termno, workflowno).Tables[0];
            this.tl_student.KeyFieldName                = "nodeid";
            this.tl_student.ParentFieldName             = "parentid";
            this.tl_student.Columns["nodename"].Caption = "学生列表";

            //初始化教师指导学生列表
            string condition = "";

            condition += " and D.TERMNO = '" + termno.ToString() + "' ";
            condition += " and E.WORKFLOWNO = '" + workflowno.ToString() + "' ";
            if (flag == 2)
            {
                teacherMdl = teacherBll.GetModel(this.cbb_teacher.Properties.Items[this.cbb_teacher.SelectedIndex].ToString());
                teacherno  = teacherMdl.TEACHERNO;
                condition += " and C.TEACHERNO = '" + teacherno.ToString() + "' ";
            }

            BLL.TEA_STU teastuBll = new BLL.TEA_STU();
            this.gridControl1.DataSource = teastuBll.GetList(condition).Tables[0];
            this.gridView1.BestFitColumns();
            DBUtility.ToolHelper.DrawRowIndicator(gridView1, 50);
            DBUtility.ToolHelper.SetLineColorofGridView(this.gridView1);
        }