Exemplo n.º 1
0
        // 管理员修改个人信息界面
        public ActionResult AlterAdminInfo()
        {
            string sqlNull         = "2b婿s1jHh子1hl91"; // 赋值,防止sql报错
            string adminDepartment = Request["adminDepartment"];

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

            if ((adminDepartment == null || adminDepartment == sqlNull) && adminDep != "")
            {
                adminDepartment             = adminDep;
                ViewData["adminDepartment"] = adminDepartment;
            }
            string adminName = Request["adminName"];

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

            if ((adminName == null || adminName == "") && adminNa != "")
            {
                adminName             = adminNa;
                ViewData["adminName"] = adminName;
            }
            int size = Convert.ToInt32(Request["size"]);

            if (adminName == null && adminDepartment == null)   //一开始加载不显示
            {
                return(View());
            }
            if (adminName == "" && adminDepartment == null)  //都没有输入
            {
                adminDepartment = adminName = sqlNull;
            }
            if (adminName == "" && adminDepartment != null)     //只输入院系
            {
                adminName = sqlNull;
            }
            if (adminName != "" && adminDepartment == null) //只输入姓名
            {
                adminDepartment = sqlNull;
            }

            int count = roleInfoService.SelectCountAdmin(adminName, adminDepartment);

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

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

            ViewData["page"] = page;

            List <Administrator> administratorList = roleInfoService.SelectAllAdminInfo(adminName, adminDepartment, page, size);

            ViewData["adminList"] = administratorList;
            return(View());
        }