Пример #1
0
        public static string GetRouteUrl(int amId)
        {
            string str    = string.Empty;
            Module module = ModuleUtils.GetModule(amId);
            bool   flag   = module != null;

            if (flag)
            {
                str = module.Url;
            }
            return(str);
        }
Пример #2
0
        public static List <Module> GetModules(ModuleType moduleType)
        {
            List <Module> list = new List <Module>();

            DataRowView[] array = ((ModuleCache) new ModuleCache().GetData()).dvModuleBy_Type.FindRows(moduleType.ToString());
            for (int i = 0; i < array.Length; i++)
            {
                DataRowView dataRowView = array[i];
                Module      module      = new Module();
                Module      @object     = ModuleUtils.GetObject(dataRowView.Row);
                list.Add(@object);
            }
            return(list);
        }
Пример #3
0
        public static Module GetModule(int moduleId)
        {
            Module      module      = null;
            ModuleCache moduleCache = (ModuleCache) new ModuleCache().GetData();
            int         index       = moduleCache.dvModuleBy_MdId.Find(moduleId);
            bool        flag        = index >= 0;

            if (flag)
            {
                Module module2 = new Module();
                module = ModuleUtils.GetObject(moduleCache.dvModuleBy_MdId[index].Row);
            }
            return(module);
        }
Пример #4
0
        public static int GetMdId(int amId)
        {
            Module module = ModuleUtils.GetModule(amId);
            bool   flag   = module != null;
            int    result;

            if (flag)
            {
                result = module.StdMdId;
            }
            else
            {
                result = 0;
            }
            return(result);
        }
Пример #5
0
        public static List <Module> GetPermissionModules(string componentId)
        {
            List <Module> list = new List <Module>();

            DataRowView[] array = ((ModuleCache) new ModuleCache().GetData()).dvModuleBy_ComId.FindRows(componentId);
            for (int i = 0; i < array.Length; i++)
            {
                DataRowView dataRowView = array[i];
                Module      module      = new Module();
                Module      @object     = ModuleUtils.GetObject(dataRowView.Row);
                bool        flag        = ModuleUtils.IsRequirePermission(@object);
                if (flag)
                {
                    list.Add(@object);
                }
            }
            return(list);
        }
Пример #6
0
        public static UserModulePermission GetUserModulePermission(string userId, int amId)
        {
            UserModulePermission modulePermission = new UserModulePermission();
            User user = UserUtils.GetUser(userId);
            bool flag = user == null;
            UserModulePermission result;

            if (flag)
            {
                result = modulePermission;
            }
            else
            {
                Module module = ModuleUtils.GetModule(amId);
                bool   flag2  = module == null;
                if (flag2)
                {
                    result = modulePermission;
                }
                else
                {
                    modulePermission.UserId = user.UserId;
                    modulePermission.AmId   = module.MdId;
                    bool flag3 = (user.Type == UserType.S && amId >= 102010001 && amId <= 102019999) || !ModuleUtils.IsRequirePermission(module);
                    if (flag3)
                    {
                        modulePermission.View = (modulePermission.Insert = (modulePermission.Edit = (modulePermission.Delete = (modulePermission.Print = (modulePermission.Design = true)))));
                        result = modulePermission;
                    }
                    else
                    {
                        Permission permission = PermissionUtils.GetPermission(PermissionType.U, userId, amId);
                        bool       flag4      = permission != null;
                        if (flag4)
                        {
                            modulePermission.Insert = permission.Insert;
                            modulePermission.Edit   = permission.Edit;
                            modulePermission.Delete = permission.Delete;
                            modulePermission.Print  = permission.Print;
                            modulePermission.View   = permission.View;
                            modulePermission.Design = permission.Design;
                            modulePermission.View   = (modulePermission.Insert || modulePermission.Edit || modulePermission.Delete || modulePermission.Print || modulePermission.View || modulePermission.Design);
                        }
                        foreach (RoleUser roleUser in RoleUserUtils.GetRoles(userId))
                        {
                            Permission permission2 = PermissionUtils.GetPermission(PermissionType.R, roleUser.RoleId, amId);
                            bool       flag5       = permission2 != null;
                            if (flag5)
                            {
                                modulePermission.Insert = (permission2.Insert || modulePermission.Insert);
                                modulePermission.Edit   = (permission2.Edit || modulePermission.Edit);
                                modulePermission.Delete = (permission2.Delete || modulePermission.Delete);
                                modulePermission.Print  = (permission2.Print || modulePermission.Print);
                                modulePermission.View   = (permission2.View || modulePermission.View);
                                modulePermission.Design = (permission2.Design || modulePermission.Design);
                                modulePermission.View   = (modulePermission.Insert || modulePermission.Edit || modulePermission.Delete || modulePermission.Print || modulePermission.View || modulePermission.Design);
                            }
                        }
                        result = modulePermission;
                    }
                }
            }
            return(result);
        }
Пример #7
0
        public static string GetParamValue(int amId, string pmId)
        {
            string str  = string.Empty;
            bool   flag = string.IsNullOrEmpty(pmId);

            if (flag)
            {
                throw new Exception("参数名不允许为空");
            }
            pmId = pmId.ToUpper();
            bool flag2 = amId == 0 && LogicContext.Current != null && LogicContext.Current.AmId != 0;

            if (flag2)
            {
                amId = LogicContext.Current.AmId;
            }
            bool flag3 = ModuleUtils.IsExtModule(amId);

            if (flag3)
            {
            }
            Parameter parameter = ParameterUtils.GetParameter(pmId);
            bool      flag4     = parameter == null;

            if (flag4)
            {
                throw new Exception(string.Format("参数【{0}】不存在,无法获取对应参数值!", pmId.ToString().Trim()));
            }
            bool   flag5 = parameter != null && parameter.Type != ParameterType.S;
            string result;

            if (flag5)
            {
                string userId = LogicContext.Current.UserId;
                bool   flag6  = UserUtils.GetUser(userId) == null;
                if (flag6)
                {
                    result = string.Empty;
                    return(result);
                }
                List <RoleUser> roles    = RoleUserUtils.GetRoles(userId);
                PmConfig        pmConfig = PmConfigUtils.GetPmConfig("", userId, amId, pmId);
                bool            flag7    = pmConfig != null;
                if (flag7)
                {
                    result = pmConfig.Value;
                    return(result);
                }
                foreach (RoleUser roleUser in roles)
                {
                    PmConfig pmConfig2 = PmConfigUtils.GetPmConfig(roleUser.RoleId, "", amId, pmId);
                    bool     flag8     = pmConfig2 != null;
                    if (flag8)
                    {
                        result = pmConfig2.Value;
                        return(result);
                    }
                }
                PmConfig pmConfig3 = PmConfigUtils.GetPmConfig("", userId, 0, pmId);
                bool     flag9     = pmConfig3 != null;
                if (flag9)
                {
                    result = pmConfig3.Value;
                    return(result);
                }
                foreach (RoleUser roleUser2 in roles)
                {
                    PmConfig pmConfig4 = PmConfigUtils.GetPmConfig(roleUser2.RoleId, "", 0, pmId);
                    bool     flag10    = pmConfig4 != null;
                    if (flag10)
                    {
                        result = pmConfig4.Value;
                        return(result);
                    }
                }
                PmConfig pmConfig5 = PmConfigUtils.GetPmConfig("", "", amId, pmId);
                bool     flag11    = pmConfig5 != null;
                if (flag11)
                {
                    result = pmConfig5.Value;
                    return(result);
                }
            }
            PmConfig pmConfig6 = PmConfigUtils.GetPmConfig("", "", 0, pmId);
            bool     flag12    = pmConfig6 != null;

            if (flag12)
            {
                result = pmConfig6.Value;
            }
            else
            {
                bool flag13 = parameter != null;
                if (flag13)
                {
                    result = parameter.DefaultValue;
                }
                else
                {
                    result = str;
                }
            }
            return(result);
        }
Пример #8
0
        public static bool IsExtModule(int amId)
        {
            Module module = ModuleUtils.GetModule(amId);

            return(module != null && (module.Type == ModuleType.E || module.Type == ModuleType.J));
        }