Esempio n. 1
0
        // 管理员修改教师信息
        public ActionResult AdminAlterTeacherInfo()
        {
            string sqlNull           = "2b婿s1jHh子1hl91";
            string teacherDepartment = Request["teacherDepartment"];

            ViewData["teacherDepartment"] = teacherDepartment;
            string teacherDep = Request["teacherDepartmentSave"];   //点击上一页下一页全局刷新时,保存选项值

            if ((teacherDepartment == null || teacherDepartment == sqlNull) && teacherDep != "")
            {
                teacherDepartment             = teacherDep;
                ViewData["teacherDepartment"] = teacherDepartment;
            }
            string teacherName = Request["teacherName"];

            ViewData["teacherName"] = teacherName;
            string teacherNa = Request["teacherNameSave"];      //点击上一页下一页全局刷新时,保存选项值

            if ((teacherName == null || teacherName == "") && teacherNa != "")
            {
                teacherName             = teacherNa;
                ViewData["teacherName"] = teacherName;
            }

            int size = Convert.ToInt32(Request["size"]);

            if (teacherName == null && teacherDepartment == null)   //刚加载页面时不显示信息
            {
                return(View());
            }
            if (teacherName == "" && teacherDepartment != null)                        //查询某学院教师
            {
                teacherName = sqlNull;                                                 //赋值,防止sql报错
            }
            if (teacherName != null && teacherName != "" && teacherDepartment == null) //查询姓名教师
            {
                teacherDepartment = sqlNull;                                           //赋值,防止sql报错
            }
            if (teacherName == "" && teacherDepartment == null)                        //即在页面没输入姓名和学院时,点击查询时查询所有信息
            {
                teacherDepartment = sqlNull;                                           //赋值,防止sql报错
                teacherName       = sqlNull;                                           //赋值,防止sql报错
            }

            int count = roleInfoService.SelectCountTeacher(teacherName, teacherDepartment);

            ViewData["totalPage"] = ((count - 1) / size) + 1;

            int page = Convert.ToInt32(Request["page"]);

            ViewData["page"] = page;

            List <Teacher> teacherList = roleInfoService.SelectAllTeacherInfo(teacherName, teacherDepartment, page, size);

            ViewData["teacherList"] = teacherList;
            return(View());
        }