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; } } }
/// <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 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); }
/// <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); } }
/// <summary> /// 保存数据方法 /// </summary> /// <returns></returns> private bool saveData() { try { 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(); BLL.NODEMATERIALS nodematerialsBll = new BLL.NODEMATERIALS(); Model.NODEMATERIALS nodematerialsMdl = new Model.NODEMATERIALS(); if (this.cbb_materialname.Text == "") { MessageBox.Show("材料信息不能为空!", "提示信息"); return(false); } if (this.cbb_name.Text == "") { MessageBox.Show("负责教师不能为空!", "提示信息"); return(false); } if (this.de_begintime.Text == "") { MessageBox.Show("开始日期不能为空!", "提示信息"); return(false); } if (this.de_endtime.Text == "") { MessageBox.Show("截止日期不能为空!", "提示信息"); return(false); } //获取工作节点编号 worknodeMdl = worknodeBll.GetModel(this.te_nodename.Text); int nodeno = worknodeMdl.NODENO; nodematerialsMdl.NODENO = nodeno; //获取材料编号 materialMdl = materialBll.GetModel(this.cbb_materialname.Text); nodematerialsMdl.MATERIALNO = materialMdl.MATERIALNO; //获取教师编号 teacherMdl = teacherBll.GetModel(this.cbb_name.Text); nodematerialsMdl.TEACHERNO = teacherMdl.TEACHERNO; nodematerialsMdl.BEGINTIME = ToolHelper.ConvertToDateTime(this.de_begintime.Value); nodematerialsMdl.ENDTIME = ToolHelper.ConvertToDateTime(this.de_endtime.Value); nodematerialsMdl.MEMO = this.te_memo.Text; if (this._enumStatus == StatusClass.AddNew) //新增节点材料信息 { nodematerialsBll.Add(nodematerialsMdl); return(true); } else if (this._enumStatus == StatusClass.Edit) //修改节点材料信息 { nodematerialsMdl.NODEMATERIALSNO = _nodematerialsno; nodematerialsBll.Update(nodematerialsMdl); return(true); } return(true); } catch (Exception exception) { MessageBox.Show("保存失败!", exception.Message); return(false); } }