예제 #1
0
        private void readData()
        {
            if (this._classno > 0)
            {
                BLL.CLASS_INFO   classBll = new BLL.CLASS_INFO();
                Model.CLASS_INFO classMdl = new Model.CLASS_INFO();

                classMdl = classBll.GetModel(_classno);
                if (classMdl == null)   //新增班级功能时
                {
                    blankData();
                }
                else                   //修改班级功能时
                {
                    BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
                    Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();

                    majordirctMdl            = majordirctBll.GetModel((int)classMdl.MAJORDIRCTNO);
                    this.cbb_majordirct.Text = majordirctMdl.MAJORDIRCTNAME;

                    BLL.TEACHER_INFO   teacherBll = new BLL.TEACHER_INFO();
                    Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO();
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO1);
                    this.cbb_master.Text     = teacherMdl.NAME;
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO2);
                    this.cbb_instructor.Text = teacherMdl.NAME;
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO3);
                    this.cbb_organizer.Text  = teacherMdl.NAME;

                    this.te_classname.Text = classMdl.CLASSNAME;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 初始化专业方向列表
        /// </summary>
        private void init_majordirct()
        {
            Student.BLL.MAJORDIRCT_INFO majordirctBll = new BLL.MAJORDIRCT_INFO();
            DataSet ds = majordirctBll.GetAllList();

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

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string majordirctName = ds.Tables[0].Rows[i]["MAJORDIRCTNAME"].ToString();
                this.cbb_majordirct.Properties.Items.Add(majordirctName);
            }
        }
예제 #3
0
        /// <summary>
        /// 保存数据方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.MAJOR_INFO                majorBll      = new BLL.MAJOR_INFO();
                Model.MAJOR_INFO              majorMdl      = new Model.MAJOR_INFO();
                Student.BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
                Student.Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();

                if (this.cbb_majorname.SelectedIndex != -1)
                {
                    majorMdl = majorBll.GetModel(this.cbb_majorname.Properties.Items[this.cbb_majorname.SelectedIndex].ToString());
                }

                if (this.te_majordirctname.Text == "")
                {
                    MessageBox.Show("专业方向名称不能为空!", "提示信息");
                    return(false);
                }
                if (this.cbb_majorname.SelectedIndex == -1)
                {
                    MessageBox.Show("所属专业不能为空!", "提示信息");
                    return(false);
                }
                if (this._enumStatus == StatusClass.AddNew)  //新增专业
                {
                    majordirctMdl.MAJORDIRCTNAME = this.te_majordirctname.Text;
                    majordirctMdl.MAJORNO        = majorMdl.MAJORNO;
                    majordirctBll.Add(majordirctMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改专业
                {
                    majordirctMdl.MAJORDIRCTNO   = this._majordirctno;
                    majordirctMdl.MAJORDIRCTNAME = this.te_majordirctname.Text;
                    majordirctMdl.MAJORNO        = majorMdl.MAJORNO;
                    majordirctBll.Update(majordirctMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }
예제 #4
0
 /// <summary>
 /// 查询数据
 /// </summary>
 private void readData()
 {
     if (this._majordirctno > 0)
     {
         BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
         Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();
         majordirctMdl = majordirctBll.GetModel(_majordirctno);
         if (majordirctMdl == null)   //新增专业方向功能时
         {
             init();
             blankData();
         }
         else                   //修改专业方向功能时
         {
             init();
             this.te_majordirctname.Text = majordirctMdl.MAJORDIRCTNAME;
             Student.Model.MAJOR_INFO majorMdl = new Model.MAJOR_INFO();
             Student.BLL.MAJOR_INFO   majorBll = new BLL.MAJOR_INFO();
             majorMdl = majorBll.GetModel((int)majordirctMdl.MAJORNO);
             this.cbb_majorname.EditValue = majorMdl.MAJORNAME;
         }
     }
 }
예제 #5
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.CLASS_INFO   classBll = new BLL.CLASS_INFO();
                Model.CLASS_INFO classMdl = new Model.CLASS_INFO();

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

                BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
                Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();


                if (this.cbb_majordirct.SelectedIndex == -1)
                {
                    MessageBox.Show("专业方向不能为空!", "提示信息");
                    return(false);
                }

                if (!ToolHelper.IsNumeric(this.te_classname.Text))
                {
                    MessageBox.Show("班级名称必须为数字!", "提示信息");
                    return(false);
                }

                if (this.cbb_instructor.SelectedIndex == -1)
                {
                    MessageBox.Show("辅导员姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_organizer.SelectedIndex == -1)
                {
                    MessageBox.Show("组织员姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_master.SelectedIndex == -1)
                {
                    MessageBox.Show("班主任姓名不能为空!", "提示信息");
                    return(false);
                }

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

                //取得专业编号
                majordirctMdl         = majordirctBll.GetModel(this.cbb_majordirct.Text);
                classMdl.MAJORDIRCTNO = majordirctMdl.MAJORDIRCTNO;
                //取得班主任编号
                teacherMdl          = teacherBll.GetModel(this.cbb_master.Text);
                classMdl.TEACHERNO1 = teacherMdl.TEACHERNO;
                //取得辅导员编号
                teacherMdl          = teacherBll.GetModel(this.cbb_instructor.Text);
                classMdl.TEACHERNO2 = teacherMdl.TEACHERNO;
                //取得组织员编号
                teacherMdl          = teacherBll.GetModel(this.cbb_organizer.Text);
                classMdl.TEACHERNO3 = teacherMdl.TEACHERNO;

                classMdl.CLASSNAME = te_classname.Text;

                if (this._enumStatus == StatusClass.AddNew)  //新增班级
                {
                    if (classBll.Exists(te_classname.Text))
                    {
                        MessageBox.Show("当前班级名称已经存在,请核查!", "提示信息");
                        return(false);
                    }
                    classBll.Add(classMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改班级
                {
                    classMdl.CLASSNO = _classno;
                    classBll.Update(classMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }