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)); } }
public MenusController( IMenusService _menusService, IOptions <AppsettingModel> setting) : base(setting) { menusService = _menusService; }
public static IList <Menu> GetRoots(int comId, int position) { IMenusService menuSrv = IoC.Resolve <IMenusService>(); IList <Menu> menus = menuSrv.GetRoots(comId, position); return(menus); }
public MenuServiceIntegrationTests() { _menusService = new MenusService(new LoggerFactory(), new MenuValidator(), new MenuItemValidator(), _menuDataAccess); }
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); }
public MenuController(IMenusService menusService, IMenuInfoService menuInfoService, GeneralFunctions generalFunctions, IListInfoService listInfoService, IListsService listsService) { _menusService = menusService; _menuInfoService = menuInfoService; _generalFunctions = generalFunctions; _listsService = listsService; _listInfoService = listInfoService; }
public CacheLoadService(ISiteService siteService, IPageService pageService, IMenusService menuService) { _siteService = siteService; _pageService = pageService; _menuService = menuService; }
public CmsController(ILoggerFactory logginFactory, ISiteService siteService, IPageService pageService, IMenusService menusService) { _logger = logginFactory.CreateLogger <CmsController>(); _siteService = siteService; _pageService = pageService; _menusService = menusService; }
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) }
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)); }
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>(); }
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; }
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(); }
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>(); }
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); }
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)); }
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; }
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); }
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); }
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()); }
public MenusController(IMenusService menusService) { _menusService = menusService; }
public MenuController(ILogger <EmailTemplatesController> logger, IMenusService menuService) { this._menuService = menuService; this._logger = logger; }
public MenuController(IRolesService rolesService, IMenusService menuservice) { _rolesService = rolesService; _menuservice = menuservice; }
public MenuItemsController(ILogger <MenuItemsController> logger, IMenusService menuService) { this._menuService = menuService; }
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; }
public MenusController(IMenusService menusService) { _menusService = menusService; menu = _initialService.GetMenuPermissionForLoginUser("Menus"); ViewBag.Menus = menu; }