Ejemplo n.º 1
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.DEPARTMENT_INFO   departmentbll = new BLL.DEPARTMENT_INFO();
                Student.Model.DEPARTMENT_INFO departmentmdl = new Model.DEPARTMENT_INFO();
                if (this.cbb_department.SelectedIndex != -1)
                {
                    departmentmdl = departmentbll.GetModel(this.cbb_department.Properties.Items[this.cbb_department.SelectedIndex].ToString());
                }

                if (this.te_majorname.Text == "")
                {
                    MessageBox.Show("专业名称不能为空!", "提示信息");
                    return(false);
                }
                if (this.cbb_department.SelectedIndex == -1)
                {
                    MessageBox.Show("所属学院不能为空!", "提示信息");
                    return(false);
                }

                majormdl.MAJORNAME    = te_majorname.Text;
                majormdl.DEPARTMENTNO = departmentmdl.DEPARTMENTNO;

                if (this._enumStatus == StatusClass.AddNew)  //新增专业
                {
                    majorbll.Add(majormdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改专业
                {
                    majormdl.MAJORNO = this._majorno;
                    majorbll.Update(majormdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }
Ejemplo n.º 2
0
 private void readData()
 {
     if (this._departmentno > 0)
     {
         BLL.DEPARTMENT_INFO   departmentbll = new BLL.DEPARTMENT_INFO();
         Model.DEPARTMENT_INFO departmentmdl = new Model.DEPARTMENT_INFO();
         departmentmdl = departmentbll.GetModel(_departmentno);
         if (departmentmdl == null)
         {
             blankData();
         }
         else
         {
             this.te_departmentname.Text = departmentmdl.DEPARTMENTNAME;
             this.te_departmentno.Text   = ToolHelper.ConvertToString(departmentmdl.DEPARTMENTNO);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 查询数据
 /// </summary>
 private void readData()
 {
     if (this._majorno > 0)
     {
         BLL.MAJOR_INFO   majorbll = new BLL.MAJOR_INFO();
         Model.MAJOR_INFO majormdl = new Model.MAJOR_INFO();
         majormdl = majorbll.GetModel(_majorno);
         if (majormdl == null)   //新增专业功能时
         {
             blankData();
         }
         else                   //修改专业功能时
         {
             init_department();
             this.te_majorname.Text = majormdl.MAJORNAME;
             Student.Model.DEPARTMENT_INFO departmentmdl = new Model.DEPARTMENT_INFO();
             Student.BLL.DEPARTMENT_INFO   departmentbll = new BLL.DEPARTMENT_INFO();
             departmentmdl = departmentbll.GetModel(majormdl.DEPARTMENTNO);
             this.cbb_department.EditValue = departmentmdl.DEPARTMENTNAME;
         }
     }
 }