示例#1
0
        public ActionResult Edit(string Name, int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            IMenusService menuSrv = IoC.Resolve <IMenusService>();
            Menu          model   = menuSrv.Getbykey(id);

            try
            {
                TryUpdateModel <Menu>(model);
                model.Name = Name;
                menuSrv.Save(model);
                menuSrv.CommitChanges();
                Messages.AddFlashMessage("Cập nhật thành công!");
                log.Info("Update menu by:" + HttpContext.User.Identity.Name + ", Date:" + DateTime.Now);
                MenuModels.ResetMenu();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                log.Error("Update menu error", ex);
                ViewBag.ParentMenus = menuSrv.GetParent(model.ComID);
                Messages.AddErrorMessage("Có lỗi trong quá trình xử lý, vui lòng thực hiện lại!");
                return(View(model));
            }
        }
示例#2
0
 public MenusController(
     IMenusService _menusService,
     IOptions <AppsettingModel> setting)
     : base(setting)
 {
     menusService = _menusService;
 }
示例#3
0
        public static IList <Menu> GetRoots(int comId, int position)
        {
            IMenusService menuSrv = IoC.Resolve <IMenusService>();
            IList <Menu>  menus   = menuSrv.GetRoots(comId, position);

            return(menus);
        }
示例#4
0
 public MenuServiceIntegrationTests()
 {
     _menusService = new MenusService(new LoggerFactory(),
                                      new MenuValidator(),
                                      new MenuItemValidator(),
                                      _menuDataAccess);
 }
示例#5
0
        public MenuServiceTests()
        {
            _menuDataAccess.Setup(m => m.SaveAsync(It.IsAny <Menu>(), It.IsAny <DataAccessActions>()))
            .Returns(Task.FromResult(_menuCounter)) //<-- returning the input value from task.
            .Callback(
                (Menu menu, DataAccessActions action) =>
            {
                if (action == DataAccessActions.Insert)
                {
                    _menus.Add(menu);
                    _menuCounter++;
                }
                else if (action == DataAccessActions.Update)
                {
                }
                else
                {
                    // delete
                }
            });


            _menusService = new MenusService(new LoggerFactory(),
                                             new MenuValidator(),
                                             new MenuItemValidator(),
                                             _menuDataAccess.Object);
        }
示例#6
0
 public MenuController(IMenusService menusService, IMenuInfoService menuInfoService, GeneralFunctions generalFunctions, IListInfoService listInfoService, IListsService listsService)
 {
     _menusService     = menusService;
     _menuInfoService  = menuInfoService;
     _generalFunctions = generalFunctions;
     _listsService     = listsService;
     _listInfoService  = listInfoService;
 }
示例#7
0
 public CacheLoadService(ISiteService siteService,
                         IPageService pageService,
                         IMenusService menuService)
 {
     _siteService = siteService;
     _pageService = pageService;
     _menuService = menuService;
 }
示例#8
0
 public CmsController(ILoggerFactory logginFactory, ISiteService siteService,
                      IPageService pageService, IMenusService menusService)
 {
     _logger       = logginFactory.CreateLogger <CmsController>();
     _siteService  = siteService;
     _pageService  = pageService;
     _menusService = menusService;
 }
示例#9
0
        public MPageViewModel(IMenusService menusService, NavigationService navigation)
        {
            this._menusService = menusService;
            IsOpen = false;
            Pjs = new Projects();
            Project pj1 = new Project();
            List<Project> list = new List<Project>();
            pj1.PCode = "行政绩效";
            pj1.PName = "行政绩效";
            pj1.PColor = "#b571cb";
            pj1.Image = @"Assets\行政绩效.png";
            list.Add(pj1);
            Project pj2 = new Project();
            pj2.PCode = "OA";
            pj2.PName = "办公自动化";
            pj2.PColor = "#b571cb";
            pj2.Image = @"Assets\OA.png";
            list.Add(pj2);
            Pjs.ProjectList = list;
            LoadMenus("行政绩效");
            MenuClickCommand = new RelayCommand<object>((e) =>
            {
                var parameter = e as Menu;
                if (parameter.MCode == "cszbjd")
                {
                    navigation.Navigate<Views.DeptPage>();
                }
                else if (parameter.MCode == "zbgs")
                {
                    navigation.Navigate<Views.PublishKpiPage>();
                }
                else if (parameter.MCode == "ldrc")
                {
                    navigation.Navigate<Views.OALDRCPage>();
                }
            });
            
            ButtonClickCommand = new RelayCommand<object>((e) =>
            {
                var p = e as Project;
                var ssxt = string.Empty;
                if (p == null)
                {
                    ssxt = "行政绩效";
                }
                else
                {
                    ssxt = p.PCode;
                }
                LoadMenus(ssxt);
                Ctl = new Controller();
                Ctl.IsOpen = !IsOpen;
                IsOpen = Ctl.IsOpen;

            });
            //ButtonClickCommand.Execute = new System.Action<object>(LoadMenus)

        }
示例#10
0
        public ActionResult Edit(int id)
        {
            IMenusService   menuSrv = IoC.Resolve <IMenusService>();
            ICompanyService compSrv = IoC.Resolve <ICompanyService>();
            Menu            model   = menuSrv.Getbykey(id);

            ViewBag.ParentMenus = menuSrv.GetParent(model.ComID);
            return(View(model));
        }
示例#11
0
        static ViewModelLocator()
        {
            ServiceLocator.Default.RegisterSingleton<IMenusService, MenusService>();
            menusService = ServiceLocator.Default.Resolve<IMenusService>();

            ServiceLocator.Default.RegisterSingleton<IDeptService, DeptService>();
            deptService = ServiceLocator.Default.Resolve<IDeptService>();

            ServiceLocator.Default.RegisterSingleton<IQueryService, QueryService>();
            queryService = ServiceLocator.Default.Resolve<IQueryService>();
        }
示例#12
0
 public ContentController(IContentsService contentsService, IContentInfoService contentInfoService, IContentClassesService contentClassesService,
                          IContentImagesService contentImagesService, GeneralFunctions generalFunctions, IMenusService menusService, IMenuInfoService menuInfoService)
 {
     _contentsService       = contentsService;
     _contentInfoService    = contentInfoService;
     _contentClassesService = contentClassesService;
     _contentImagesService  = contentImagesService;
     _generalFunctions      = generalFunctions;
     _menusService          = menusService;
     _menuInfoService       = menuInfoService;
 }
示例#13
0
 public SepetimController(IMenusService menuservice, ICommentService commentservice, IMenuNamesService menunameservice, ICategoryService categoryservice, IProductService productservice, INeighborhoodService neighborhoodservice, ICompaniesService companieservice, ICountyService countyservice, ISliderService sliderService, ICityService cityservice)
 {
     this._sliderService       = sliderService;
     this._cityservice         = cityservice;
     this._countyservice       = countyservice;
     this._companieservice     = companieservice;
     this._neighborhoodservice = neighborhoodservice;
     this._productservice      = productservice;
     this._categoryservice     = categoryservice;
     this._menunameservice     = menunameservice;
     this._commentservice      = commentservice;
     this._menuservice         = menuservice;
     _cacheProvider            = new CacheProvider();
 }
示例#14
0
 public SeedDataService(ILoggerFactory logginFactory,
                        ISiteService siteService,
                        IPageService pageService,
                        IContentService contentService,
                        IConfiguration configuration,
                        IMenusService menuService)
 {
     _siteService    = siteService;
     _pageService    = pageService;
     _contentService = contentService;
     _configuration  = configuration;
     _menuService    = menuService;
     _logger         = logginFactory.CreateLogger <SeedDataService>();
 }
示例#15
0
        public static IList <MenuModel> GetTree(int comId, int rootId)
        {
            List <MenuModel> MenuTrees = new List <MenuModel>();
            IMenusService    menuSrv   = IoC.Resolve <IMenusService>();
            IList <Menu>     menus     = menuSrv.GetList(comId);
            var baseMenu = new MenuModel(menuSrv.Getbykey(rootId));

            MenuTrees.Add(baseMenu);
            foreach (var item in menus.Where(x => x.ParentId == rootId))
            {
                var root = new MenuModel(item, 1);
                MenuTrees.Add(root);
                BuildMenuTree(menus, root);
            }
            return(MenuTrees);
        }
示例#16
0
        public ActionResult Index(int?parentId, int?page, int position = 0)
        {
            int           pageIndex   = page.HasValue ? page.Value - 1 : 0;
            int           pageSize    = 20;
            int           totalRecord = 0;
            Company       company     = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            IMenusService menuSrv     = IoC.Resolve <IMenusService>();
            MenusModels   model       = new MenusModels();

            model.RootMenus = MenuModel.GetRoots(company.id, position);
            int pId  = parentId.HasValue ? parentId.Value : model.RootMenus[0].Id;
            var list = MenuModel.GetTree(company.id, pId);

            totalRecord          = list.Count;
            model.PagedListMenus = new PagedList <MenuModel>(list, pageIndex, pageSize, totalRecord);
            return(View(model));
        }
示例#17
0
 public StaffsService(
     IStaffsRepository staffsRepository,
     IPhotoStorageRepository photoStorageRepository,
     IUsersRepository usersRepository,
     IMessageClass messageClass,
     IBaseInterface baseInterface,
     IAdministrationService administrationService,
     IMenusService menusService)
 {
     _staffsRepository       = staffsRepository;
     _photoStorageRepository = photoStorageRepository;
     _messageClass           = messageClass;
     _usersRepository        = usersRepository;
     _baseInterface          = baseInterface;
     _administrationService  = administrationService;
     _menusService           = menusService;
 }
示例#18
0
        public static void ResetMenu()
        {
            IList <MenuModels> menuTrees      = new List <MenuModels>();
            Company            currentCompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            string             key            = string.Format("{0}", currentCompany.TaxCode);

            MenuForCompany = new Dictionary <string, IList <MenuModels> >();
            IMenusService menuSrv  = IoC.Resolve <IMenusService>();
            IList <Menu>  ListMenu = menuSrv.ListActived(currentCompany.id);

            foreach (Menu item in ListMenu.Where(p => p.ParentId == 0).OrderBy(p => p.Priority))
            {
                var root = new MenuModels(item, item.Position);
                menuTrees.Add(root);
                BuildMenuTree(ListMenu, root);
            }
            MenuForCompany.Add(key, menuTrees);
        }
示例#19
0
        public string ListContentsMenu(string resource, IMenusService menusService, IMenuInfoService menuInfoService)
        {
            string strHtml  = "";
            int    parentID = 0;

            var menus    = menusService.GetAll();
            var menuInfo = menuInfoService.GetAll();

            var model = (from m in menus
                         join mI in menuInfo on m.MenuID equals mI.MenuID
                         where m.ParentID == parentID
                         select new MenuListVM
            {
                MenuID = m.MenuID,
                Menu = mI.Menu
            }
                         ).ToList();

            foreach (var item in model)
            {
                strHtml += "<li>";
                strHtml += string.Format(@"<input id= ""{0}"" type=""checkbox"" />< label for= ""vicepresident""> {1} </label>", item.MenuID, item.Menu);
                strHtml += "</li>";
            }



            //

            //<li>
            //    <input id="profil" type="checkbox" /><label for="vicepresident">Profil</label>
            //    <ul>
            //        <li><input id="hakkimizda" type="checkbox" /><label for="manager4">Hakkımızda</label></li>
            //        <li><input id="degerlerimiz" type="checkbox" /><label for="manager5">Değerlerimiz</label></li>
            //    </ul>
            //</li>



            return(strHtml);
        }
示例#20
0
        public static IList <MenuModels> GetTree(int position)
        {
            IList <MenuModels> menuTrees      = new List <MenuModels>();
            Company            currentCompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            string             key            = string.Format("{0}", currentCompany.TaxCode);

            if (MenuForCompany != null && MenuForCompany.Keys.Contains(key))
            {
                menuTrees = MenuForCompany[key] as IList <MenuModels>;
                return(menuTrees.Where(p => p.Position == position).ToList());
            }
            MenuForCompany = new Dictionary <string, IList <MenuModels> >();
            IMenusService menuSrv  = IoC.Resolve <IMenusService>();
            IList <Menu>  ListMenu = menuSrv.ListActived(currentCompany.id);

            foreach (Menu item in ListMenu.Where(p => p.ParentId == 0).OrderBy(p => p.Priority))
            {
                var root = new MenuModels(item, item.Position);
                menuTrees.Add(root);
                BuildMenuTree(ListMenu, root);
            }
            MenuForCompany.Add(key, menuTrees);
            return(menuTrees.Where(p => p.Position == position).ToList());
        }
示例#21
0
 public MenusController(IMenusService menusService)
 {
     _menusService = menusService;
 }
示例#22
0
 public MenuController(ILogger <EmailTemplatesController> logger,
                       IMenusService menuService)
 {
     this._menuService = menuService;
     this._logger      = logger;
 }
示例#23
0
 public MenuController(IRolesService rolesService, IMenusService menuservice)
 {
     _rolesService = rolesService;
     _menuservice  = menuservice;
 }
示例#24
0
 public MenuItemsController(ILogger <MenuItemsController> logger,
                            IMenusService menuService)
 {
     this._menuService = menuService;
 }
示例#25
0
 public MenuRecursion(IMenusService menusService, IMenuInfoService menuInfoService)
 {
     _menusService    = menusService;
     _menuInfoService = menuInfoService;
     allMenuItems     = GetMenuItems();
 }
 public MenuViewComponent(ICommonControllerData common, IMenuItemsService menuItems, IMenusService menus) : base(common)
 {
     this.menuItems = menuItems;
     this.menus = menus;
 }
	    public MenusController(IMenusService menusService, IMealsService mealsService)
	    {
		    _menusService = menusService;
		    _mealsService = mealsService;
	    }
示例#28
0
 public MenusController(IMenusService menusService)
 {
     _menusService = menusService;
     menu          = _initialService.GetMenuPermissionForLoginUser("Menus");
     ViewBag.Menus = menu;
 }