public ActionResult SubmitAddTeacherInfo() { Login login = (Login)Session["loginInfo"]; if (login == null) { //未登录 //跳转到登录页面 Session["prePage"] = "/Admin/Index";//将当前页面地址放入session,登录后返回到该页面 return(RedirectToAction("Index", "Login")); } string teacherID = CreateID(); string teacherName = Request["teacherName"]; string teacherSex = Request["teacherSex"]; string teacherIDCard = Request["teacherIDCard"]; string TeacherAge = Request["teacherAge"]; string teacherDepartment = Request["teacherDepartment"]; string teacherTitle = Request["teacherTitle"]; string teacherNative = Request["teacherNative"]; string teacherBirthplace = Request["teacherBirthplace"]; string teacherPoliticsstatus = Request["teacherPoliticsstatus"]; string teacherTeachingtime = Request["teacherTeachingtime"]; string teacherContact = Request["teacherContact"]; string teacherOther = Request["teacherOther"]; string TeacherStatus = Request["teacherStatus"]; // 转换数据类型 int teacherAge = Convert.ToInt32(TeacherAge); int teacherStatus = Convert.ToInt32(TeacherStatus); Administrator admin = roleInfoService.SelectAdministratorByID(login.username); string departement = admin.administrator_department; if (login.username == "123456") { string result = roleInfoService.AddTeacherInfo(teacherID, teacherName, teacherSex, teacherIDCard, teacherAge, teacherDepartment, teacherTitle, teacherNative, teacherBirthplace, teacherPoliticsstatus, teacherTeachingtime, teacherContact, teacherOther, teacherStatus); Response.Write("<script>alert('添加完成!');</script>"); return(View("AddTeacherInfo")); } else { if (departement.Equals(teacherDepartment)) { string result = roleInfoService.AddTeacherInfo(teacherID, teacherName, teacherSex, teacherIDCard, teacherAge, teacherDepartment, teacherTitle, teacherNative, teacherBirthplace, teacherPoliticsstatus, teacherTeachingtime, teacherContact, teacherOther, teacherStatus); Response.Write("<script>alert('添加完成!');</script>"); return(View("AddTeacherInfo")); } else { Response.Write("<script>alert('您没有权限对其他学院信息进行更改操作!');</script>"); return(View("AddTeacherInfo")); } } }
public ActionResult SubmitAddTeacherInfo() { string teacherID = CreateID(); string teacherName = Request["teacherName"]; string teacherSex = Request["teacherSex"]; string teacherIDCard = Request["teacherIDCard"]; string TeacherAge = Request["teacherAge"]; string teacherDepartment = Request["teacherDepartment"]; string teacherTitle = Request["teacherTitle"]; string teacherNative = Request["teacherNative"]; string teacherBirthplace = Request["teacherBirthplace"]; string teacherPoliticsstatus = Request["teacherPoliticsstatus"]; string teacherTeachingtime = Request["teacherTeachingtime"]; string teacherContact = Request["teacherContact"]; string teacherOther = Request["teacherOther"]; string TeacherStatus = Request["teacherStatus"]; // 转换数据类型 int teacherAge = Convert.ToInt32(TeacherAge); int teacherStatus = Convert.ToInt32(TeacherStatus); string result = roleInfoService.AddTeacherInfo(teacherID, teacherName, teacherSex, teacherIDCard, teacherAge, teacherDepartment, teacherTitle, teacherNative, teacherBirthplace, teacherPoliticsstatus, teacherTeachingtime, teacherContact, teacherOther, teacherStatus); return(View()); }