Пример #1
0
        internal static IList <ModuleRegion> GetMenuOptionsV2(StartModules module)
        {
            IList <ModuleRegion>    menuList    = new List <ModuleRegion>();
            IList <MenuOptionByRol> optionsList = null;

            //Crea el menu principal Con Los tipos de menu que debe Haber
            WMSServiceClient service = new WMSServiceClient();

            IList <MenuOptionType> typeList = service.GetMenuOptionType(new MenuOptionType());

            //Si es admin tiene permiso a todas las funcionalidades
            if (App.curRol.Rol.RolID == BasicRol.Admin)
            {
                //Guarda las opciones del menu en la session para reuso
                App.curMenuOptions = service.GetMenuOption(new MenuOption()).Where(f => f.Active != false && f.CreTerminal == App.currentLocation).ToList();
            }
            else
            {
                optionsList = service.GetMenuOptionByRol(new MenuOptionByRol
                {
                    Rol     = App.curRol.Rol,
                    Company = App.curCompany
                }).Where(f => f.Status.StatusID == EntityStatus.Active && f.MenuOption.Active != false && f.MenuOption.CreTerminal == App.currentLocation)
                              .OrderBy(f => f.MenuOption.NumOrder).ToList();

                //Guarda las opciones del menu en la session para reuso
                App.curMenuOptions = optionsList.Select(f => f.MenuOption).ToList();
            }

            ModuleRegion menuChild = null;

            foreach (MenuOptionType mType in typeList)
            {
                menuChild      = new ModuleRegion();
                menuChild.Name = mType.Name;

                if (App.curRol.Rol.RolID == BasicRol.Admin)
                {
                    // recorremos lista de opciones del rol, para organizar los menus
                    foreach (MenuOption mOption in App.curMenuOptions.Where(f => f.MenuOptionType.MenuOptionTypeID == mType.MenuOptionTypeID && f.OptionType.OpTypeID == OptionTypes.Application).OrderBy(f => f.NumOrder))
                    {
                        menuChild.Options.Add(new ModuleSubmenu
                        {
                            Name          = mOption.Name,
                            Module        = module,
                            Image         = GetImage(WmsSetupValues.IconPath48 + mOption.Icon),
                            PresenterType = Type.GetType("WpfFront.Presenters." + mOption.Url + ""),
                            IconPath      = WmsSetupValues.IconPath16 + mOption.Icon
                        });
                    }
                }
                else
                {
                    // recorremos lista de opciones del rol, para organizar los menus
                    foreach (MenuOptionByRol mOption in optionsList.Where(f => f.MenuOption.MenuOptionType.MenuOptionTypeID == mType.MenuOptionTypeID && f.MenuOption.OptionType.OpTypeID == OptionTypes.Application).OrderBy(f => f.MenuOption.NumOrder))
                    {
                        menuChild.Options.Add(new ModuleSubmenu
                        {
                            Name          = mOption.MenuOption.Name,
                            PresenterType = Type.GetType("WpfFront.Presenters." + mOption.MenuOption.Url + ""),
                            Image         = GetImage(WmsSetupValues.IconPath48 + mOption.MenuOption.Icon),
                            Module        = module,
                            IconPath      = WmsSetupValues.IconPath16 + mOption.MenuOption.Icon
                        });
                    }
                }

                menuList.Add(menuChild);
            }

            return(menuList);
        }
Пример #2
0
        internal static IList<ModuleRegion> GetMenuOptionsV2(StartModules module)
        {

            IList<ModuleRegion> menuList = new List<ModuleRegion>();
            IList<MenuOptionByRol> optionsList = null;

            //Crea el menu principal Con Los tipos de menu que debe Haber
            WMSServiceClient service = new WMSServiceClient();

            IList<MenuOptionType> typeList = service.GetMenuOptionType(new MenuOptionType());

            //Si es admin tiene permiso a todas las funcionalidades
            if (App.curRol.Rol.RolID == BasicRol.Admin)
            {
                //Guarda las opciones del menu en la session para reuso
                App.curMenuOptions = service.GetMenuOption(new MenuOption()).Where(f => f.Active != false && f.CreTerminal == App.currentLocation).ToList();
            }
            else
            {
                optionsList = service.GetMenuOptionByRol(new MenuOptionByRol
                {
                    Rol = App.curRol.Rol,
                    Company = App.curCompany
                }).Where(f => f.Status.StatusID == EntityStatus.Active && f.MenuOption.Active != false && f.MenuOption.CreTerminal == App.currentLocation)
                .OrderBy(f => f.MenuOption.NumOrder).ToList();

                //Guarda las opciones del menu en la session para reuso
                App.curMenuOptions = optionsList.Select(f => f.MenuOption).ToList();

            }

            ModuleRegion menuChild = null;

            foreach (MenuOptionType mType in typeList)
            {

                menuChild = new ModuleRegion();
                menuChild.Name = mType.Name;

                if (App.curRol.Rol.RolID == BasicRol.Admin)
                {
                    // recorremos lista de opciones del rol, para organizar los menus
                    foreach (MenuOption mOption in App.curMenuOptions.Where(f => f.MenuOptionType.MenuOptionTypeID == mType.MenuOptionTypeID && f.OptionType.OpTypeID == OptionTypes.Application).OrderBy(f => f.NumOrder))
                    {
                        menuChild.Options.Add(new ModuleSubmenu
                        {
                            Name = mOption.Name,
                            Module = module,
                            Image = GetImage(WmsSetupValues.IconPath48 + mOption.Icon),
                            PresenterType = Type.GetType("WpfFront.Presenters." + mOption.Url + ""),
                            IconPath = WmsSetupValues.IconPath16 + mOption.Icon
                        });

                    }
                }
                else
                {
                    // recorremos lista de opciones del rol, para organizar los menus
                    foreach (MenuOptionByRol mOption in optionsList.Where(f => f.MenuOption.MenuOptionType.MenuOptionTypeID == mType.MenuOptionTypeID && f.MenuOption.OptionType.OpTypeID == OptionTypes.Application).OrderBy(f => f.MenuOption.NumOrder))
                    {
                        menuChild.Options.Add(new ModuleSubmenu
                        {
                            Name = mOption.MenuOption.Name,
                            PresenterType = Type.GetType("WpfFront.Presenters." + mOption.MenuOption.Url + ""),
                            Image = GetImage(WmsSetupValues.IconPath48 + mOption.MenuOption.Icon),
                            Module = module,
                            IconPath = WmsSetupValues.IconPath16 + mOption.MenuOption.Icon
                        });

                    }
                }

                menuList.Add(menuChild);
            }

            return menuList;
        }