/// <summary> /// 查询数据 /// </summary> private void readData() { if (this._teacherno > 0) { BLL.TEACHER_INFO teacherBll = new BLL.TEACHER_INFO(); Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO(); teacherMdl = teacherBll.GetModel(_teacherno); init_major(); if (teacherMdl == null) //新增教师信息功能时 { blankData(); } else //修改教师信息功能时 { BLL.MAJOR_INFO majorBll = new BLL.MAJOR_INFO(); Model.MAJOR_INFO majorMdl = new Model.MAJOR_INFO(); majorMdl = majorBll.GetModel((int)teacherMdl.MAJORNO); this.cbb_majorname.Text = majorMdl.MAJORNAME; this.te_name.Text = teacherMdl.NAME; this.te_workid.Text = teacherMdl.WORKID; this.cbb_sex.Text = teacherMdl.SEX; this.cbb_political.Text = teacherMdl.POLITICAL; this.cbb_nation.Text = teacherMdl.NATION; this.te_phone.Text = teacherMdl.PHONE; this.te_familyphone.Text = teacherMdl.FAMILYPHONE; this.te_email.Text = teacherMdl.EMAIL; this.te_idcard.Text = teacherMdl.IDCARD; this.te_qqno.Text = teacherMdl.QQNO; this.te_micromesageno.Text = teacherMdl.MICROMESSAGENO; this.te_familyaddress.Text = teacherMdl.FAMILYADDRESS; } } }
/// <summary> /// 初始化窗体,取得专业名称到列表 /// </summary> private void init_major() { Student.BLL.MAJOR_INFO majorBll = new BLL.MAJOR_INFO(); DataSet ds = majorBll.GetAllList(); cbb_majorname.Properties.Items.Clear(); cbb_majorname.EditValue = null; cbb_majorname.Properties.NullText = "--请选择--"; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string majorName = ds.Tables[0].Rows[i]["MAJORNAME"].ToString(); this.cbb_majorname.Properties.Items.Add(majorName); } this.cbb_majorname.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; }
/// <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); } }
/// <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); } }
/// <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; } } }
/// <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; } } }
/// <summary> /// 保存数据方法 /// </summary> /// <returns></returns> private bool saveData() { try { BLL.TEACHER_INFO teacherBll = new BLL.TEACHER_INFO(); Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO(); Student.BLL.MAJOR_INFO majorBll = new BLL.MAJOR_INFO(); Student.Model.MAJOR_INFO majorMdl = new Model.MAJOR_INFO(); if (this.cbb_majorname.SelectedIndex != -1) { majorMdl = majorBll.GetModel(this.cbb_majorname.Properties.Items[this.cbb_majorname.SelectedIndex].ToString()); teacherMdl.MAJORNO = majorMdl.MAJORNO; } else { MessageBox.Show("教师所属专业不能为空!", "提示信息"); return(false); } if (this.te_name.Text == "") { MessageBox.Show("教师姓名不能为空!", "提示信息"); return(false); } teacherMdl.NATION = cbb_nation.Text; teacherMdl.NAME = this.te_name.Text; teacherMdl.WORKID = this.te_workid.Text; teacherMdl.SEX = this.cbb_sex.Text; teacherMdl.POLITICAL = this.cbb_political.Text; teacherMdl.PHONE = this.te_phone.Text; teacherMdl.FAMILYPHONE = this.te_familyphone.Text; teacherMdl.EMAIL = this.te_email.Text; teacherMdl.IDCARD = this.te_idcard.Text; teacherMdl.QQNO = this.te_qqno.Text; teacherMdl.MICROMESSAGENO = this.te_micromesageno.Text; teacherMdl.FAMILYADDRESS = this.te_familyaddress.Text; if (this._enumStatus == StatusClass.AddNew) //新增教师信息 { if (teacherBll.Exists(this.te_name.Text)) { MessageBox.Show("当前教师姓名已经存在,请核查!", "提示信息"); return(false); } teacherBll.Add(teacherMdl); return(true); } else if (this._enumStatus == StatusClass.Edit) //修改教师信息 { teacherMdl.TEACHERNO = this._teacherno; teacherBll.Update(teacherMdl); return(true); } return(true); } catch (Exception exception) { MessageBox.Show("保存失败!", exception.Message); return(false); } }