// 管理员修改学生信息 public ActionResult AdminAlterStudentInfo() { string sqlNull = "2b婿s1jHh子1hl91"; //防止参数为空,使sql报错 string studentDepartment = Request["studentDepartment"]; ViewData["studentDepartment"] = studentDepartment; string studentDep = Request["studentDepartmentSave"]; //点击上一页下一页全局刷新时,保存选项值 if ((studentDepartment == null || studentDepartment == sqlNull) && studentDep != "") { studentDepartment = studentDep; ViewData["studentDepartment"] = studentDepartment; } string studentMajor = Request["majorlist"]; ViewData["majorlist"] = studentMajor; string studentMa = Request["majorlistSave"]; //点击上一页下一页全局刷新时,保存选项值 if ((studentMajor == null || studentMajor == "") && studentMa != "") { studentMajor = studentMa; ViewData["majorlist"] = studentMajor; } string studentClass = Request["classlist"]; ViewData["classlist"] = studentMajor; string studentCl = Request["classlistSave"]; //点击上一页下一页全局刷新时,保存选项值 if ((studentClass == null || studentClass == "") && studentCl != "") { studentClass = studentCl; ViewData["classlist"] = studentClass; } string studentName = Request["studentName"]; ViewData["studentName"] = studentName; string studentNa = Request["studentNameSave"]; //点击上一页下一页全局刷新时,保存选项值 if ((studentName == null || studentName == "") && studentNa != "") { studentName = studentNa; ViewData["studentName"] = studentName; } int size = Convert.ToInt32(Request["size"]); if (studentDepartment == null && studentName == null) //刚加载页面时不显示信息 { return(View()); } if (studentDepartment == null && studentName == "") //没有输入信息 { studentDepartment = studentName = studentMajor = studentClass = sqlNull; //赋值,防止sql报错 } if (studentDepartment != null && studentMajor == "" && studentName == "") //只输入学院信息 { studentName = studentMajor = studentClass = sqlNull; //赋值,防止sql报错 } if (studentMajor != "" && studentClass == "" && studentName == "") //只输入学院,专业 { studentName = studentClass = sqlNull; } if (studentClass != "" && studentName == "") //只输入学院,专业,班级 { studentName = sqlNull; } if (studentDepartment == null && studentName != "") //只输入姓名 { studentDepartment = studentMajor = studentClass = sqlNull; //赋值,防止sql报错 } if (studentDepartment != null && studentMajor == "" && studentName != "") //只输入学院,姓名 { studentMajor = studentClass = sqlNull; } if (studentMajor != null && studentClass == null && studentName != "") //只输入学院,专业,姓名 { studentClass = sqlNull; } int count = roleInfoService.SelectCountStudent(studentName, studentDepartment, studentMajor, studentClass); ViewData["totalPage"] = ((count - 1) / size) + 1; int page = Convert.ToInt32(Request["page"]); ViewData["page"] = page; List <Student> studentList = roleInfoService.SelectAllStudentInfo(studentName, studentDepartment, studentMajor, studentClass, page, size); ViewData["studentList"] = studentList; return(View()); }