예제 #1
0
        public static List <SelectOption> ManagerTeacherSelect(int id)
        {
            string _cache_key           = cache_managerTeachers + id;
            List <SelectOption> options = (List <SelectOption>)DataCache.GetCache(_cache_key);

            if (options == null)
            {
                options = new List <SelectOption>();
                var t_s = ManagerRoles.getManagerTeacherList(id);
                if (t_s != null)
                {
                    foreach (var item in t_s)
                    {
                        options.Add(new SelectOption {
                            text = item.name, id = item.id.ToString()
                        });
                    }
                    DataCache.SetCache(_cache_key, options);
                }
            }
            return(options);
        }
예제 #2
0
        public ActionResult TeacherCourses([Bind(Include = "id,isAll")] TeacherSearch model)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "Index" }));
            }
            int manager_id = PageValidate.FilterParam(User.Identity.Name);

            if (model.id == 0)
            {
                ViewBag.msg        = "未选择任课老师或助教";
                ViewData["search"] = model;
                return(View());
            }
            if (!ManagerRoles.CheckHasManageTeacherRole(manager_id, model.id))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限!" }));
            }
            List <SelectOption> options = DropDownList.ManagerTeacherSelect(manager_id);

            ViewBag.Teachers          = DropDownList.SetDropDownList(options);
            ViewData["TeacherCourse"] = getTeacherCourse(model);
            return(View(model));
        }
예제 #3
0
        public ActionResult TeacherCourses(int?id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "Index" }));
            }
            int manager_id = PageValidate.FilterParam(User.Identity.Name);
            List <SelectOption> options = DropDownList.ManagerTeacherSelect(manager_id);

            ViewBag.Teachers = DropDownList.SetDropDownList(options);
            if (id == null)
            {
                id = manager_id;
            }
            if (!ManagerRoles.CheckHasManageTeacherRole(manager_id, (int)id))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限!" }));
            }
            TeacherSearch model = new TeacherSearch();

            model.id = (int)id;
            ViewData["TeacherCourse"] = getTeacherCourse(model);
            return(View(model));
        }