Exemple #1
0
        /// <summary>
        /// 初始化所有教师列表
        /// </summary>
        private void init_teacher()
        {
            Student.BLL.TEACHER_INFO teacherBll = new BLL.TEACHER_INFO();
            DataSet ds = teacherBll.GetAllList();

            this.cbb_master.Properties.Items.Clear();
            this.cbb_organizer.Properties.Items.Clear();
            this.cbb_instructor.Properties.Items.Clear();
            cbb_master.EditValue                         = null;
            cbb_master.Properties.NullText               = "--请选择--";
            cbb_organizer.EditValue                      = null;
            cbb_organizer.Properties.NullText            = "--请选择--";
            cbb_instructor.EditValue                     = null;
            cbb_instructor.Properties.NullText           = "--请选择--";
            this.cbb_master.Properties.TextEditStyle     = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.cbb_organizer.Properties.TextEditStyle  = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.cbb_instructor.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string teacherName = ds.Tables[0].Rows[i]["NAME"].ToString();
                this.cbb_master.Properties.Items.Add(teacherName);
                this.cbb_organizer.Properties.Items.Add(teacherName);
                this.cbb_instructor.Properties.Items.Add(teacherName);
            }
        }
        //新增时初始化节点列表
        public void init()
        {
            BLL.MATERIAL_INFO   materialBll = new BLL.MATERIAL_INFO();
            Model.MATERIAL_INFO materialMdl = new Model.MATERIAL_INFO();

            BLL.WORKNODE   worknodeBll = new BLL.WORKNODE();
            Model.WORKNODE worknodeMdl = new Model.WORKNODE();

            BLL.TEACHER_INFO   teacherBll = new BLL.TEACHER_INFO();
            Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO();

            if (_enumStatus == StatusClass.AddNew)
            {
                //初始化材料名称下拉列表数据
                worknodeMdl = worknodeBll.GetModel(nodematerialsaddMdl.NODENAME);
                int     nodeno     = worknodeMdl.NODENO;
                DataSet materialds = materialBll.GetList(" MATERIALNO not in(select MATERIALNO from NODEMATERIALS  where NODENO  = " + nodeno.ToString() + " and MATERIALNO is not null)");
                this.cbb_materialname.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                cbb_materialname.Properties.Items.Clear();
                cbb_materialname.EditValue           = null;
                cbb_materialname.Properties.NullText = "--请选择--";
                for (int i = 0; i < materialds.Tables[0].Rows.Count; i++)
                {
                    string materialname = materialds.Tables[0].Rows[i]["MATERIALNAME"].ToString();
                    this.cbb_materialname.Properties.Items.Add(materialname);
                }

                //初始化教师姓名下拉列表数据
                DataSet teacherds = teacherBll.GetAllList();
                this.cbb_name.Properties.Items.Clear();
                cbb_name.EditValue           = null;
                cbb_name.Properties.NullText = "--请选择--";
                for (int i = 0; i < teacherds.Tables[0].Rows.Count; i++)
                {
                    string teachername = teacherds.Tables[0].Rows[i]["NAME"].ToString();
                    this.cbb_name.Properties.Items.Add(teachername);
                }
            }
            else if (_enumStatus == StatusClass.Edit)
            {
                //初始化材料名称下拉列表数据
                worknodeMdl = worknodeBll.GetModel(nodematerialsaddMdl.NODENAME);
                int     nodeno     = worknodeMdl.NODENO;
                DataSet materialds = materialBll.GetList(" MATERIALNO not in(select MATERIALNO from NODEMATERIALS  where NODENO  = " + nodeno.ToString() + " and MATERIALNO is not null)");
                this.cbb_materialname.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                cbb_materialname.Properties.Items.Clear();
                cbb_materialname.EditValue = nodematerialsaddMdl.MATERIALNAME;
                for (int i = 0; i < materialds.Tables[0].Rows.Count; i++)
                {
                    string materialname = materialds.Tables[0].Rows[i]["MATERIALNAME"].ToString();
                    this.cbb_materialname.Properties.Items.Add(materialname);
                }
                this.cbb_materialname.Properties.Items.Add(nodematerialsaddMdl.MATERIALNAME);

                //初始化教师姓名下拉列表数据
                DataSet teacherds = teacherBll.GetAllList();
                this.cbb_name.Properties.Items.Clear();
                cbb_name.EditValue = nodematerialsaddMdl.NAME;
                for (int i = 0; i < teacherds.Tables[0].Rows.Count; i++)
                {
                    string teachername = teacherds.Tables[0].Rows[i]["NAME"].ToString();
                    this.cbb_name.Properties.Items.Add(teachername);
                }

                this.te_nodename.Text  = nodematerialsaddMdl.NODENAME;
                this.de_begintime.Text = nodematerialsaddMdl.BEGINTIME.ToString();
                this.de_endtime.Text   = nodematerialsaddMdl.ENDTIME.ToString();
                this.te_memo.Text      = nodematerialsaddMdl.MEMO;
            }
        }