/// <summary> /// 保存方法 /// </summary> private bool saveData() { BLL.STU_WORKFLOW stuworkflowBll = new BLL.STU_WORKFLOW(); if (!ToolHelper.IsNumeric(this.te_grade.Text)) { MessageBox.Show("成绩必须为数值!", "提示信息"); return(false); } if (this.te_grade.Text.Length <= 0) { MessageBox.Show("成绩不能为空!", "提示信息"); return(false); } float grade = ToolHelper.ConvertToFloat(this.te_grade.Text); if (grade < 0 || grade > 100) { MessageBox.Show("成绩不合法,请核查!", "提示信息"); return(false); } BLL.ENTERPRISE_INFO enterpriseBll = new BLL.ENTERPRISE_INFO(); Model.ENTERPRISE_INFO enterpriseMdl = new Model.ENTERPRISE_INFO(); if (this.cbb_ent.SelectedIndex != -1) { string entname = this.cbb_ent.Properties.Items[this.cbb_ent.SelectedIndex].ToString(); enterpriseMdl = enterpriseBll.GetModel(entname); int entno = (int)enterpriseMdl.ENTNO; stuworkflowBll.Update(grade, _execno, entno); } else { string entname = this.cbb_ent.EditValue.ToString(); if (entname.Length > 0) { enterpriseMdl = enterpriseBll.GetModel(entname); if (enterpriseMdl == null) { MessageBox.Show("该企业不存在,请添加该企业信息!", "提示信息"); return(false); } else { int entno = (int)enterpriseMdl.ENTNO; stuworkflowBll.Update(grade, _execno, entno); } } else { stuworkflowBll.Update(grade, _execno); } } return(true); }
/// <summary> /// 保存方法 /// </summary> /// <returns></returns> private bool saveData() { try { BLL.COURSE_INFO courseBll = new BLL.COURSE_INFO(); Model.COURSE_INFO courseMdl = new Model.COURSE_INFO(); BLL.COURSE_TYPE coursetypeBll = new BLL.COURSE_TYPE(); Model.COURSE_TYPE coursetypeMdl = new Model.COURSE_TYPE(); if (this.cbb_coursetype.SelectedIndex != -1) { coursetypeMdl = coursetypeBll.GetModel(this.cbb_coursetype.Properties.Items[this.cbb_coursetype.SelectedIndex].ToString()); courseMdl.COURSETYPENO = coursetypeMdl.COURSETYPENO; } else { MessageBox.Show("课程类型不能为空!", "提示信息"); return(false); } if (this.te_coursename.Text == "") { MessageBox.Show("课程名称不能为空!", "提示信息"); return(false); } courseMdl.COURSENAME = te_coursename.Text; courseMdl.TOTALHOUR = ToolHelper.ConvertToInt(te_totalhour.Text); courseMdl.THEORYHOUR = ToolHelper.ConvertToInt(te_theoryhour.Text); courseMdl.EXPERIMENTHOUR = ToolHelper.ConvertToInt(te_experimenthour.Text); courseMdl.CREDIT = (decimal)ToolHelper.ConvertToFloat(te_credit.Text); courseMdl.MEMO = te_memo.Text; if (this._enumStatus == StatusClass.AddNew) { courseBll.Add(courseMdl); return(true); } else if (this._enumStatus == StatusClass.Edit) { courseMdl.COURSENO = this._courseno; courseBll.Update(courseMdl); return(true); } return(true); } catch (Exception exception) { MessageBox.Show("保存失败!" + exception.Message, exception.Message); return(false); } }