public ActionResult SubmitAddStudentInfo() { string studentID = CreateID(); string studentName = Request["studentName"]; string studentSex = Request["studentSex"]; string studentIDCard = Request["studentIDCard"]; string StudentAge = Request["studentAge"]; string studentDepartment = Request["studentDepartment"]; string studentMajor = Request["studentMajor"]; string studentGrade = Request["studentGrade"]; string studentType = Request["studentType"]; string studentAddress = Request["studentAddress"]; string studentNative = Request["studentNative"]; string studentBirthplace = Request["studentBirthplace"]; string studentPoliticsstatus = Request["studentPoliticsstatus"]; string studentContact = Request["studentContact"]; string studentFamily = Request["studentFamily"]; string studentAward = Request["studentAward"]; string studentOther = Request["studentOther"]; string StudentStatus = Request["studentStatus"]; string studentClass = Request["classlist"]; //数据类型转换 int studentAge = Convert.ToInt32(StudentAge); int studentStatus = Convert.ToInt32(StudentStatus); string result = roleInfoService.AddStudentInfo(studentID, studentName, studentSex, studentIDCard, studentAge, studentDepartment, studentMajor, studentGrade, studentType, studentAddress, studentNative, studentBirthplace, studentPoliticsstatus, studentContact, studentFamily, studentAward, studentOther, studentStatus, studentClass); return(View()); }
public ActionResult SubmitAddStudentInfo() { Login login = (Login)Session["loginInfo"]; if (login == null) { //未登录 //跳转到登录页面 Session["prePage"] = "/Admin/Index";//将当前页面地址放入session,登录后返回到该页面 return(RedirectToAction("Index", "Login")); } string studentID = CreateID(); string studentName = Request["studentName"]; string studentSex = Request["studentSex"]; string studentIDCard = Request["studentIDCard"]; string StudentAge = Request["studentAge"]; string studentDepartment = Request["studentDepartment"]; string studentMajor = Request["studentMajor"]; string studentGrade = Request["studentGrade"]; string studentType = Request["studentType"]; string studentAddress = Request["studentAddress"]; string studentNative = Request["studentNative"]; string studentBirthplace = Request["studentBirthplace"]; string studentPoliticsstatus = Request["studentPoliticsstatus"]; string studentContact = Request["studentContact"]; string studentFamily = Request["studentFamily"]; string studentAward = Request["studentAward"]; string studentOther = Request["studentOther"]; string StudentStatus = Request["studentStatus"]; string studentClass = Request["classlist"]; //数据类型转换 int studentAge = Convert.ToInt32(StudentAge); int studentStatus = Convert.ToInt32(StudentStatus); Administrator admin = roleInfoService.SelectAdministratorByID(login.username); string departement = admin.administrator_photo; //这里有问题 if (login.username == "123456") { string result = roleInfoService.AddStudentInfo(studentID, studentName, studentSex, studentIDCard, studentAge, studentDepartment, studentMajor, studentGrade, studentType, studentAddress, studentNative, studentBirthplace, studentPoliticsstatus, studentContact, studentFamily, studentAward, studentOther, studentStatus, studentClass); Response.Write("<script>alert('添加完成!');</script>"); return(View("AddStudentInfo")); } else { if (departement.Equals(studentDepartment)) { string result = roleInfoService.AddStudentInfo(studentID, studentName, studentSex, studentIDCard, studentAge, studentDepartment, studentMajor, studentGrade, studentType, studentAddress, studentNative, studentBirthplace, studentPoliticsstatus, studentContact, studentFamily, studentAward, studentOther, studentStatus, studentClass); Response.Write("<script>alert('添加完成!');</script>"); return(View("AddStudentInfo")); } else { Response.Write("<script>alert('您没有权限对其他学院信息进行更改操作!');</script>"); return(View("AddStudentInfo")); } } }