protected void BtnStudentSave_Click(object sender, EventArgs e) { ENTITY.Student student = new ENTITY.Student(); student.studentNumber = this.studentNumber.Value; student.studentName = studentName.Value; student.studentPassword = studentPassword.Value; student.studentSex = studentSex.Value; student.studentClassNumber = studentClassNumber.SelectedValue; student.studentBirthday = Convert.ToDateTime(studentBirthday.Text); student.studentState = studentState.Value; if (studentPhoto.Text == "") { studentPhoto.Text = "FileUpload\\NoImage.jpg"; } student.studentPhoto = studentPhoto.Text; student.studentTelephone = studentTelephone.Value; student.studentEmail = studentEmail.Value; student.studentQQ = studentQQ.Value; student.studentAddress = studentAddress.Value; student.studentMemo = studentMemo.Value; if (!string.IsNullOrEmpty(Common.GetMes.GetRequestQuery(Request, "studentNumber"))) { student.studentNumber = Request["studentNumber"]; if (BLL.bllStudent.EditStudent(student)) { Common.ShowMessage.myScriptMes(Page, "Suess", "if(confirm(\"信息修改成功,是否继续修改?否则返回信息列表。\")) {location.href=\"M_EditStudent.aspx?studentNumber=" + Request["studentNumber"] + "\"} else {location.href=\"M_StudentList.aspx\"} "); } else { Common.ShowMessage.Show(Page, "error", "信息修改失败,请重试或联系管理人员.."); } } else { if (BLL.bllStudent.AddStudent(student)) { Common.ShowMessage.myScriptMes(Page, "Suess", "if(confirm(\"信息添加成功,是否继续添加?否则返回信息列表。\")) {location.href=\"M_EditStudent.aspx\"} else {location.href=\"M_StudentList.aspx\"} "); } else { Common.ShowMessage.Show(Page, "error", "信息添加失败,请重试或联系管理人员.."); } } }
/*如果是需要对记录进行编辑需要在界面初始化显示数据*/ private void LoadData() { if (!string.IsNullOrEmpty(Common.GetMes.GetRequestQuery(Request, "studentNumber"))) { ENTITY.Student student = BLL.bllStudent.getSomeStudent(Common.GetMes.GetRequestQuery(Request, "studentNumber")); studentNumber.Text = student.studentNumber; studentName.Text = student.studentName; studentPassword.Text = student.studentPassword; studentSex.Text = student.studentSex; studentClassNumber.Text = BLL.bllClassInfo.getSomeClassInfo(student.studentClassNumber).className; studentBirthday.Text = student.studentBirthday.ToShortDateString(); studentState.Text = student.studentState; if (student.studentPhoto != "") { this.StudentPhotoImage.ImageUrl = "Admin\\" + student.studentPhoto; } studentTelephone.Text = student.studentTelephone; studentEmail.Text = student.studentEmail; studentQQ.Text = student.studentQQ; studentAddress.Text = student.studentAddress; studentMemo.Text = student.studentMemo; } }
/*更新学生信息*/ public static bool EditStudent(ENTITY.Student student) { return(DAL.dalStudent.EditStudent(student)); }
/*添加学生信息*/ public static bool AddStudent(ENTITY.Student student) { return(DAL.dalStudent.AddStudent(student)); }