private void ShowInfo(int Id) { Eva.BLL.Evaluation bll=new Eva.BLL.Evaluation(); Eva.Model.Evaluation model=bll.GetModel(Id); this.lblId.Text=model.Id.ToString(); this.lblStudentId.Text=model.StudentId.ToString(); this.lblAcademicYear.Text=model.AcademicYear.ToString(); this.lblAve.Text=model.Ave.ToString(); this.lblTeacherEvaluation.Text=model.TeacherEvaluation; this.lblSelfEvaluation.Text=model.SelfEvaluation; this.lblTeacherId.Text=model.TeacherId.ToString(); this.lblSchoolTerm.Text=model.SchoolTerm.ToString(); this.lblTotal.Text=model.Total.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtStudentId.Text)) { strErr+="StudentId格式错误!\\n"; } if(!PageValidate.IsNumber(txtAcademicYear.Text)) { strErr+="AcademicYear格式错误!\\n"; } if(!PageValidate.IsDecimal(txtAve.Text)) { strErr+="Ave格式错误!\\n"; } if(this.txtTeacherEvaluation.Text.Trim().Length==0) { strErr+="TeacherEvaluation不能为空!\\n"; } if(this.txtSelfEvaluation.Text.Trim().Length==0) { strErr+="SelfEvaluation不能为空!\\n"; } if(!PageValidate.IsNumber(txtTeacherId.Text)) { strErr+="TeacherId格式错误!\\n"; } if(!PageValidate.IsNumber(txtSchoolTerm.Text)) { strErr+="SchoolTerm格式错误!\\n"; } if(!PageValidate.IsDecimal(txtTotal.Text)) { strErr+="Total格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int StudentId=int.Parse(this.txtStudentId.Text); int AcademicYear=int.Parse(this.txtAcademicYear.Text); decimal Ave=decimal.Parse(this.txtAve.Text); string TeacherEvaluation=this.txtTeacherEvaluation.Text; string SelfEvaluation=this.txtSelfEvaluation.Text; int TeacherId=int.Parse(this.txtTeacherId.Text); int SchoolTerm=int.Parse(this.txtSchoolTerm.Text); decimal Total=decimal.Parse(this.txtTotal.Text); Eva.Model.Evaluation model=new Eva.Model.Evaluation(); model.StudentId=StudentId; model.AcademicYear=AcademicYear; model.Ave=Ave; model.TeacherEvaluation=TeacherEvaluation; model.SelfEvaluation=SelfEvaluation; model.TeacherId=TeacherId; model.SchoolTerm=SchoolTerm; model.Total=Total; Eva.BLL.Evaluation bll=new Eva.BLL.Evaluation(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }