Beispiel #1
0
        public static List <SelectOption> FundsSelect(int user)
        {
            string       key   = cache_funds + user;
            List <Funds> funds = DBCaches <Funds> .getCache(cache_funds);

            List <SelectOption> options = (List <SelectOption>)DataCache.GetCache(key);

            if (options == null)
            {
                var query = from fund in funds
                            where fund.f_state == 1
                            select fund;
                if (user > 0 && !RoleCheck.CheckHasAuthority(user, db, "经费管理"))
                {
                    query = query.Where(x => x.f_manager == user);
                }
                options = (from fund in query
                           select new SelectOption
                {
                    id = fund.f_id.ToString(),
                    text = string.Format("{0}({1})", fund.f_name, fund.f_code)
                }).ToList();
                if (options.Count() > 0)
                {
                    DataCache.SetCache(key, options);
                }
            }
            return(options);
        }
Beispiel #2
0
        public static List <SelectOption> ContentSelect()
        {
            List <Dic_Reimbursement_Content> contents = DBCaches <Dic_Reimbursement_Content> .getCache(cache_content);

            List <SelectOption> option = (from content in contents
                                          select new SelectOption
            {
                id = content.content_id.ToString(),
                text = content.content_title
            }).ToList();

            return(option);
        }
Beispiel #3
0
        public static List <SelectOption> RespondStateSelect()
        {
            List <Dic_Respond_State> depts = DBCaches <Dic_Respond_State> .getCache(respond_state);

            List <SelectOption> option = (from ct in depts
                                          select new SelectOption
            {
                id = ct.drs_state_id.ToString(),
                text = ct.drs_state_name
            }).ToList();

            return(option);
        }
Beispiel #4
0
        public static List <SelectOption> ProcessSelect()
        {
            List <Process_Info> funds = DBCaches <Process_Info> .getCache(cache_process);

            List <SelectOption> option = (from fund in funds
                                          select new SelectOption
            {
                id = fund.process_id.ToString(),
                text = fund.process_name
            }).ToList();

            return(option);
        }
Beispiel #5
0
        public static List <SelectOption> CardTypeSelect()
        {
            List <Dic_CardType> depts = DBCaches <Dic_CardType> .getCache(cache_cardType);

            List <SelectOption> option = (from ct in depts
                                          select new SelectOption
            {
                id = ct.ctype_name,
                text = ct.ctype_name
            }).ToList();

            return(option);
        }
Beispiel #6
0
        public static List <SelectOption> RoleSelect(string ignor)
        {
            List <Dic_Role> depts = DBCaches <Dic_Role> .getCache(cache_role);

            List <SelectOption> option = (from ct in depts
                                          where ct.role_name != ignor
                                          select new SelectOption
            {
                id = ct.role_id.ToString(),
                text = ct.role_name
            }).ToList();

            return(option);
        }
Beispiel #7
0
        public ActionResult Role()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "LogOut" }));
            }
            int user = PageValidate.FilterParam(User.Identity.Name);

            if (!RoleCheck.CheckHasAuthority(user, db, "系统管理"))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限当前内容。" }));
            }
            ViewData["RoleList"] = DBCaches <Dic_Role> .getCache("cache_role");;
            return(View(new Dic_Role()));
        }
Beispiel #8
0
        public static List <SelectOption> PostSelect()
        {
            List <SelectOption> options = new List <SelectOption>();
            var post = DBCaches <Dic_Post> .getCache(cache_post);

            if (post != null)
            {
                foreach (var item in post)
                {
                    options.Add(new SelectOption {
                        text = item.post_name, id = item.post_id.ToString()
                    });
                }
            }
            return(options);
        }
Beispiel #9
0
        public static List <AuthInfo> AuthoritySelect()
        {
            List <Sys_Authority> funds = DBCaches <Sys_Authority> .getCache(cache_authority);

            List <AuthInfo> option = (from auth in funds
                                      select new AuthInfo
            {
                authId = auth.auth_id,
                authInfo = auth.auth_info,
                authName = auth.auth_name,
                isController = auth.auth_is_Controller,
                mapController = auth.auth_map_Controller
            }).ToList();

            return(option);
        }
Beispiel #10
0
        public static RoleInfo[] getRoleInfo()
        {
            object roles = DBCaches <Dic_Role> .getCache(cache_role);

            if (roles == null)
            {
                return(null);
            }
            var list_roles = (List <Dic_Role>)roles;
            var list       = (from role in list_roles
                              select new RoleInfo
            {
                id = role.role_id,
                name = role.role_name
            }).ToArray();

            return(list);
        }
Beispiel #11
0
        public ActionResult Role(Dic_Role model)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "LogOut" }));
            }
            int user = PageValidate.FilterParam(User.Identity.Name);

            if (!RoleCheck.CheckHasAuthority(user, db, "系统管理"))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限当前内容。" }));
            }

            model.role_name = PageValidate.InputText(model.role_name, 50);
            if (db.Dic_Role.Where(x => x.role_name == model.role_name).Count() > 0)
            {
                ViewBag.msg = "角色名称已存在";
            }
            else
            {
                db.Dic_Role.Add(model);
                try
                {
                    db.SaveChanges();
                    DBCaches <Dic_Role> .ClearCache("cache_role");
                }
                catch
                {
                    ViewBag.msg = "角色添加失败,请重试。";
                }
            }

            SysLog.WriteLog(user, string.Format("添加角色[{0}]", model.role_name), IpHelper.GetIP(), "", 5, "", db);
            ViewData["RoleList"] = DBCaches <Dic_Role> .getCache("cache_role");// db.Dic_Post.ToList();

            return(View(model));
        }