public MenuOptionPresenter(IUnityContainer container, IMenuOptionView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<MenuOptionModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<MenuOption>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetMenuOption(new MenuOption()); View.Model.Record = null; View.Model.MenuOptionTypeList = service.GetMenuOptionType(new MenuOptionType()); View.Model.OptionType = service.GetOptionType(new OptionType()); pw.Close(); }
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; }