public CollectionService(CacheService cache, PageService pager, IndexService indexer, DataService data) { _cache = cache; _pager = pager; _indexer = indexer; _data = data; }
internal TransactionService(IDiskService disk, AesEncryption crypto, PageService pager, int cacheSize, Logger log) { _disk = disk; _crypto = crypto; _pager = pager; _cacheSize = cacheSize; _log = log; }
internal TransactionService(IDiskService disk, PageService pager, CacheService cache) { _disk = disk; _pager = pager; _cache = cache; _cache.MarkAsDirtyAction = (page) => _disk.WriteJournal(page.PageID, page.DiskData); _cache.DirtyRecicleAction = () => this.Save(); }
public CollectionService(PageService pager, IndexService indexer, DataService data, TransactionService trans, Logger log) { _pager = pager; _indexer = indexer; _data = data; _trans = trans; _log = log; }
public PageController(IPageRepository repository, PageService pageService, ITemplateRepository templateRepository, IPageTreeRepository pageTreeRepository, IAuthorizer authorizer) { _repository = repository; _pageService = pageService; _templateRepository = templateRepository; _pageTreeRepository = pageTreeRepository; _authorizer = authorizer; }
public void psc_GetPageByIDCompleted(object sender, PageService.GetPageByIDCompletedEventArgs e) { PageObject = e.Result; if (this.DataFetchedEvent != null) { this.DataFetchedEvent(this, EventArgs.Empty); } }
public void OnActionExecuted(ActionExecutedContext filterContext) { ZoneWidgetCollection zones = new ZoneWidgetCollection(); //Page string pageId = filterContext.RequestContext.HttpContext.Request.QueryString["ID"]; PageService pageService = new PageService(); PageEntity page = pageService.Get(pageId); if (page != null) { LayoutService layoutService = new LayoutService(); var layout = layoutService.Get(page.LayoutId); layout.Page = page; WidgetService widgetService = new WidgetService(); IEnumerable<WidgetBase> widgets = widgetService.Get(new DataFilter().Where<WidgetBase>(m => m.PageID, OperatorType.Equal, page.ID)); Action<WidgetBase> processWidget = m => { IWidgetPartDriver partDriver = Activator.CreateInstance(m.AssemblyName, m.ServiceTypeName).Unwrap() as IWidgetPartDriver; WidgetPart part = partDriver.Display(partDriver.GetWidget(m), filterContext.HttpContext); lock (zones) { if (zones.ContainsKey(part.Widget.ZoneID)) { zones[part.Widget.ZoneID].Add(part); } else { WidgetCollection partCollection = new WidgetCollection(); partCollection.Add(part); zones.Add(part.Widget.ZoneID, partCollection); } } }; widgets.Each(processWidget); IEnumerable<WidgetBase> Layoutwidgets = widgetService.Get(new Data.DataFilter().Where<WidgetBase>(m => m.LayoutID, OperatorType.Equal, page.LayoutId)); Layoutwidgets.Each(processWidget); layout.ZoneWidgets = zones; ViewResult viewResult = (filterContext.Result as ViewResult); if (viewResult != null) { viewResult.MasterName = "~/Modules/Common/Views/Shared/_DesignPageLayout.cshtml"; viewResult.ViewData[LayoutEntity.LayoutKey] = layout; } } else { filterContext.Result = new HttpStatusCodeResult(404); } }
/// <summary> /// Initialize database reader with database stream file and password /// </summary> public bool Initialize(Stream stream, string password) { // test if current stream is V6 if (stream.ReadByte(25 + 27) != 6) return false; _disk = new FileDiskService(stream, password); _pager = new PageService(_disk); _indexer = new IndexService(_pager); _data = new DataService(_pager); _collections = new CollectionService(_pager, _indexer, _data); return true; }
public void WhenGettingEntity_ThenReturnsCorrectEntity() { // Arrange var repositoryMock = new Mock<IPageRepository>(); Page newEntity = DefaultModelHelper.DummyPopulatedPage(); repositoryMock.Setup(repo => repo.GetById(It.IsAny<int>())).Returns(newEntity); // Act var services = new PageService(repositoryMock.Object, new Mock<IUnitOfWork>().Object); Page returnedEntity = services.GetById(1); // Assert Assert.NotNull(returnedEntity); Assert.Equal("ActionName", returnedEntity.ActionName); }
/// <summary> /// The initialize services. /// </summary> private void InitializeServices() { this.pageService = new PageService(this.pageRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageTemplateService = new PageTemplateService(this.pageTemplateRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageControllerActionService = new PageControllerActionService(this.pageControllerRepositoryActionMock.Object, new Mock<IUnitOfWork>().Object); this.partTypeService = new PartTypeService(this.partTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partService = new PartService(this.partRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.seoDecoratorService = new SeoDecoratorService(this.seoDecoratorRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.rolePageRestrictionService = new RolePageRestrictionService(this.rolePageRestrictionRepositoryMock.Object, new Mock<IUnitOfWork>().Object); }
/// <summary> /// Create instances for all engine services /// </summary> private void InitializeServices() { _pager = new PageService(_disk, _crypto, _log); _indexer = new IndexService(_pager, _log); _data = new DataService(_pager, _log); _trans = new TransactionService(_disk, _crypto, _pager, _cacheSize, _log); _collections = new CollectionService(_pager, _indexer, _data, _trans, _log); }
public SupplementingInformationForEmployerViewModel(PageService pageService) { _pageService = pageService; }
public IActionResult OnPost() { PageInit(); if (ErpPage == null) { return(NotFound()); } if (!PageContext.HttpContext.Request.Query.ContainsKey("op")) { return(NotFound()); } var operation = PageContext.HttpContext.Request.Query["op"]; var pageServ = new PageService(); try { ErpPage pageCopy = null; if (operation == "delete") { pageServ.DeletePage(ErpPage.Id); } else if (operation == "clone") { pageCopy = pageServ.ClonePage(ErpPage.Id); } else { return(NotFound()); } if (!String.IsNullOrWhiteSpace(ReturnUrl)) { if (operation == "clone") { return(Redirect($"/sdk/objects/page/r/{pageCopy.Id}")); } else { return(Redirect(ReturnUrl)); } } else { if (operation == "clone") { return(Redirect($"/sdk/objects/page/r/{pageCopy.Id}")); } else { return(Redirect($"/sdk/objects/page/l/list")); } } } catch (ValidationException ex) { Validation.Message = ex.Message; Validation.Errors = ex.Errors; } BeforeRender(); return(Page()); }
public DataService(PageService pager, Logger log) { _pager = pager; _log = log; }
public void Init(string appName = "", string areaName = "", string nodeName = "", string pageName = "", Guid?recordId = null, Guid?relationId = null, Guid?parentRecordId = null) { //Stopwatch sw = new Stopwatch(); //sw.Start(); if (String.IsNullOrWhiteSpace(appName)) { appName = AppName; } if (String.IsNullOrWhiteSpace(areaName)) { areaName = AreaName; } if (String.IsNullOrWhiteSpace(nodeName)) { nodeName = NodeName; } if (String.IsNullOrWhiteSpace(pageName)) { pageName = PageName; } if (recordId == null) { recordId = RecordId; } if (relationId == null) { relationId = RelationId; } if (parentRecordId == null) { parentRecordId = ParentRecordId; } var urlInfo = new PageService().GetInfoFromPath(HttpContext.Request.Path); if (String.IsNullOrWhiteSpace(appName)) { appName = urlInfo.AppName; if (AppName != appName) { AppName = appName; //When dealing with non standard routing in pages } } if (String.IsNullOrWhiteSpace(areaName)) { areaName = urlInfo.AreaName; if (AreaName != areaName) { AreaName = areaName; //When dealing with non standard routing in pages } } if (String.IsNullOrWhiteSpace(nodeName)) { nodeName = urlInfo.NodeName; if (NodeName != nodeName) { NodeName = nodeName; //When dealing with non standard routing in pages } } if (String.IsNullOrWhiteSpace(pageName)) { pageName = urlInfo.PageName; if (PageName != pageName) { PageName = pageName; //When dealing with non standard routing in pages } } if (recordId == null) { recordId = urlInfo.RecordId; if (RecordId != recordId) { RecordId = recordId; //When dealing with non standard routing in pages } } if (relationId == null) { relationId = urlInfo.RelationId; if (RelationId != relationId) { RelationId = relationId; //When dealing with non standard routing in pages } } if (parentRecordId == null) { parentRecordId = urlInfo.ParentRecordId; if (ParentRecordId != parentRecordId) { ParentRecordId = parentRecordId; //When dealing with non standard routing in pages } } ErpRequestContext.SetCurrentApp(appName, areaName, nodeName); ErpRequestContext.SetCurrentPage(PageContext, pageName, appName, areaName, nodeName, recordId, relationId, parentRecordId); ErpRequestContext.RecordId = recordId; ErpRequestContext.RelationId = relationId; ErpRequestContext.ParentRecordId = parentRecordId; ErpRequestContext.PageContext = PageContext; if (PageContext.HttpContext.Request.Query.ContainsKey("returnUrl")) { ReturnUrl = HttpUtility.UrlDecode(PageContext.HttpContext.Request.Query["returnUrl"].ToString()); } ErpAppContext = ErpAppContext.Current; CurrentUrl = PageUtils.GetCurrentUrl(PageContext.HttpContext); #region << Init Navigation >> //Application navigation if (ErpRequestContext.App != null) { var sitemap = ErpRequestContext.App.Sitemap; var appPages = new PageService().GetAppPages(ErpRequestContext.App.Id); //Calculate node Urls foreach (var area in sitemap.Areas) { if (area.Nodes.Count > 0) { var currentNode = area.Nodes[0]; switch (currentNode.Type) { case SitemapNodeType.ApplicationPage: var nodePages = appPages.FindAll(x => x.NodeId == currentNode.Id).ToList(); //Case 1: Node has attached pages if (nodePages.Count > 0) { nodePages = nodePages.OrderBy(x => x.Weight).ToList(); currentNode.Url = $"/{ErpRequestContext.App.Name}/{area.Name}/{currentNode.Name}/a/{nodePages[0].Name}"; } else { var firstAppPage = appPages.FindAll(x => x.Type == PageType.Application).OrderBy(x => x.Weight).FirstOrDefault(); if (firstAppPage == null) { currentNode.Url = $"/{ErpRequestContext.App.Name}/{area.Name}/{currentNode.Name}/a/"; } else { currentNode.Url = $"/{ErpRequestContext.App.Name}/{area.Name}/{currentNode.Name}/a/{firstAppPage.Name}"; } } break; case SitemapNodeType.EntityList: var firstListPage = appPages.FindAll(x => x.Type == PageType.RecordList).OrderBy(x => x.Weight).FirstOrDefault(); if (firstListPage == null) { currentNode.Url = $"/{ErpRequestContext.App.Name}/{area.Name}/{currentNode.Name}/l/"; } else { currentNode.Url = $"/{ErpRequestContext.App.Name}/{area.Name}/{currentNode.Name}/l/{firstListPage.Name}"; } break; case SitemapNodeType.Url: //Do nothing break; default: throw new Exception("Type not found"); } continue; } } //Convert to MenuItem foreach (var area in sitemap.Areas) { if (area.Nodes.Count == 0) { continue; } var areaMenuItem = new MenuItem(); if (area.Nodes.Count > 1) { var areaLink = $"<a href=\"javascript: void(0)\" title=\"{area.Label}\" data-navclick-handler>"; areaLink += $"<span class=\"menu-label\">{area.Label}</span>"; areaLink += $"<span class=\"menu-nav-icon ti-angle-down nav-caret\"></span>"; areaLink += $"</a>"; areaMenuItem = new MenuItem() { Content = areaLink }; foreach (var node in area.Nodes) { var nodeLink = $"<a class=\"dropdown-item\" href=\"{node.Url}\" title=\"{node.Label}\"><span class=\"{node.IconClass} icon\"></span> {node.Label}</a>"; areaMenuItem.Nodes.Add(new MenuItem() { Content = nodeLink }); } } else if (area.Nodes.Count == 1) { var areaLink = $"<a href=\"{area.Nodes[0].Url}\" title=\"{area.Label}\">"; areaLink += $"<span class=\"menu-label\">{area.Label}</span>"; areaLink += $"</a>"; areaMenuItem = new MenuItem() { Content = areaLink }; } ApplicationMenu.Add(areaMenuItem); } } //Site menu var pageSrv = new PageService(); var sitePages = pageSrv.GetSitePages(); foreach (var sitePage in sitePages) { SiteMenu.Add(new MenuItem() { Content = $"<a class=\"dropdown-item\" href=\"/s/{sitePage.Name}\">{sitePage.Label}</a>" }); } #endregion DataModel = new PageDataModel(this); //Debug.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>>> Base page init: " + sw.ElapsedMilliseconds); }
/// <summary> /// Shows the page edit. /// </summary> /// <param name="pageId">The page identifier.</param> private void ShowPageEdit(int pageId) { var page = new PageService(new RockContext()).Get(pageId); // // Ensure the page is valid. // if (pageId != 0) { var pageCache = PageCache.Get(pageId); if (!CheckIsValidMobilePage(pageCache)) { return; } } if (page == null) { page = new Rock.Model.Page { DisplayInNavWhen = DisplayInNavWhen.WhenAllowed }; } // // Ensure user has access to edit this page. // if (!page.IsAuthorized(Authorization.EDIT, CurrentPerson)) { nbError.Text = Rock.Constants.EditModeMessage.NotAuthorizedToEdit(typeof(Rock.Model.Page).GetFriendlyTypeName()); pnlEditPage.Visible = false; return; } var additionalSettings = page.AdditionalSettings.FromJsonOrNull <Rock.Mobile.AdditionalPageSettings>() ?? new Rock.Mobile.AdditionalPageSettings(); // // Set the basic fields of the page. // tbName.Text = page.PageTitle; tbInternalName.Text = page.InternalName; tbDescription.Text = page.Description; cbDisplayInNavigation.Checked = page.DisplayInNavWhen == DisplayInNavWhen.WhenAllowed; ceEventHandler.Text = additionalSettings.LavaEventHandler; imgPageIcon.BinaryFileId = page.IconBinaryFileId; // // Configure the layout options. // var siteId = PageParameter("SiteId").AsInteger(); ddlLayout.Items.Add(new ListItem()); foreach (var layout in LayoutCache.All().Where(l => l.SiteId == siteId)) { ddlLayout.Items.Add(new ListItem(layout.Name, layout.Id.ToString())); } ddlLayout.SetValue(page.LayoutId); pnlEditPage.Visible = true; pnlDetails.Visible = false; pnlBlocks.Visible = false; }
public IndexService(CacheService cache, PageService pager) { _cache = cache; _pager = pager; }
public PopularBoatsViewModel(PageService pageService) { _pageService = pageService; }
/// <summary> /// Binds the zones repeater. /// </summary> private void BindZones() { var rockContext = new RockContext(); int pageId = hfPageId.Value.AsInteger(); var page = new PageService(rockContext).Get(pageId); var zones = new List <BlockContainer>(); // // Parse and find all known zones in the Phone layout. // try { var xaml = XElement.Parse(page.Layout.LayoutMobilePhone); foreach (var zoneNode in xaml.Descendants().Where(e => e.Name.LocalName == "Zone")) { var zoneName = zoneNode.Attribute(XName.Get("ZoneName")).Value; if (!zones.Any(z => z.Name == zoneName)) { zones.Add(new BlockContainer { Name = zoneName, Components = new List <BlockInstance>() }); } } } catch (Exception ex) { nbZoneError.Text = ex.Message; rptrZones.Visible = false; return; } // // Parse and find all known zones in the Tablet layout. // try { var xaml = XElement.Parse(page.Layout.LayoutMobileTablet); foreach (var zoneNode in xaml.Descendants().Where(e => e.Name.LocalName == "RockZone")) { var zoneName = zoneNode.Attribute(XName.Get("ZoneName")).Value; if (!zones.Any(z => z.Name == zoneName)) { zones.Add(new BlockContainer { Name = zoneName, Components = new List <BlockInstance>() }); } } } catch (Exception ex) { nbZoneError.Text = ex.Message; rptrZones.Visible = false; return; } // // Loop through all blocks on this page and add them to the appropriate zone. // foreach (var block in new BlockService(rockContext).Queryable().Where(b => b.PageId == pageId).OrderBy(b => b.Order).ThenBy(b => b.Id)) { var blockCompiledType = BlockTypeCache.Get(block.BlockTypeId).GetCompiledType(); if (!typeof(Rock.Blocks.IRockMobileBlockType).IsAssignableFrom(blockCompiledType)) { continue; } var zone = zones.SingleOrDefault(z => z.Name == block.Zone); // // If we couldn't find the zone in the layouts, then add (or use existing) zone called 'Unknown' // if (zone == null) { zone = zones.SingleOrDefault(z => z.Name == "Unknown"); if (zone == null) { zone = new BlockContainer { Name = "Unknown", Components = new List <BlockInstance>() }; zones.Add(zone); } } var iconCssClassAttribute = ( IconCssClassAttribute )blockCompiledType.GetCustomAttribute(typeof(IconCssClassAttribute)); zone.Components.Add(new BlockInstance { Name = block.Name, Type = block.BlockType.Name, IconCssClass = iconCssClassAttribute != null ? iconCssClassAttribute.IconCssClass : "fa fa-question", Id = block.Id }); } rptrZones.Visible = true; rptrZones.DataSource = zones; rptrZones.DataBind(); }
public MenuItemController(MenuService menuService, PageService pageService) { this.menuService = menuService; this.pageService = pageService; }
public async Task ItemSelected(NhanVienViewMode x) { PageService page = new PageService(); await page.PushAsync(new Views.DetailNhanVienPage(x)); }
private async Task AddNaviClicked() { PageService page = new PageService(); await page.PushAsync(new Views.FillNhanVienPage()); }
public DataService(PageService pager) { _pager = pager; }
/// <summary> /// Handles the Click event of the lbSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void lbSave_Click(object sender, EventArgs e) { var rockContext = new RockContext(); var pageService = new PageService(rockContext); int parentPageId = SiteCache.Get(PageParameter("SiteId").AsInteger()).DefaultPageId.Value; var page = pageService.Get(PageParameter("Page").AsInteger()); if (page == null) { page = new Rock.Model.Page(); pageService.Add(page); var order = pageService.GetByParentPageId(parentPageId) .OrderByDescending(p => p.Order) .Select(p => p.Order) .FirstOrDefault(); page.Order = order + 1; page.ParentPageId = parentPageId; } var additionalSettings = page.AdditionalSettings.FromJsonOrNull <Rock.Mobile.AdditionalPageSettings>() ?? new Rock.Mobile.AdditionalPageSettings(); additionalSettings.LavaEventHandler = ceEventHandler.Text; page.InternalName = tbInternalName.Text; page.BrowserTitle = tbName.Text; page.PageTitle = tbName.Text; page.Description = tbDescription.Text; page.LayoutId = ddlLayout.SelectedValueAsId().Value; page.DisplayInNavWhen = cbDisplayInNavigation.Checked ? DisplayInNavWhen.WhenAllowed : DisplayInNavWhen.Never; page.AdditionalSettings = additionalSettings.ToJson(); int?oldIconId = null; if (page.IconBinaryFileId != imgPageIcon.BinaryFileId) { oldIconId = page.IconBinaryFileId; page.IconBinaryFileId = imgPageIcon.BinaryFileId; } rockContext.WrapTransaction(() => { rockContext.SaveChanges(); if (oldIconId.HasValue || page.IconBinaryFileId.HasValue) { BinaryFileService binaryFileService = new BinaryFileService(rockContext); if (oldIconId.HasValue) { var binaryFile = binaryFileService.Get(oldIconId.Value); if (binaryFile != null) { // marked the old images as IsTemporary so they will get cleaned up later binaryFile.IsTemporary = true; rockContext.SaveChanges(); } } if (page.IconBinaryFileId.HasValue) { var binaryFile = binaryFileService.Get(page.IconBinaryFileId.Value); if (binaryFile != null) { // marked the old images as IsTemporary so they will get cleaned up later binaryFile.IsTemporary = false; rockContext.SaveChanges(); } } } }); NavigateToCurrentPage(new Dictionary <string, string> { { "SiteId", PageParameter("SiteId") }, { "Page", page.Id.ToString() } }); }
public ClientResultViewModel( BL.PageService pageService) { this.pageService = pageService; Message = "Заказ успешно оформлен"; }
private PageService CreatePageService() { var unitOfWork = new MockUnitOfWork(); var pageService = new PageService(unitOfWork, new NullExceptionHandler()); unitOfWork.PageRepository.Insert(new Page { Id = 8 }); unitOfWork.PageVersionRepository.Insert(new PageVersion { Id = 4, PageId = 8, LanguageCode = "en-gb", Title = "Hello", Description = "A nice page.", Keywords = "car, tree" }); unitOfWork.PageVersionRepository.Insert(new PageVersion { Id = 5, PageId = 8, LanguageCode = "de-de", Title = "Achtung!", Description = "Das is goot!", Keywords = "kraftwerk" }); return pageService; }
public RegistrationPageViewModel(PageService navigation) { _navigation = navigation; }
public async Task <IViewComponentResult> InvokeAsync(Guid?pageId = null, FieldRenderMode mode = FieldRenderMode.Form, PageType?presetType = null, Guid?presetAppId = null, Guid?presetEntityId = null) { //var typeOptions = new List<SelectFieldOption>(); //var entityOptions = new List<SelectFieldOption>(); //var applicationOptions = new List<SelectFieldOption>(); //var areaOptions = new List<SelectFieldOption>(); //var nodeOptions = new List<SelectFieldOption>(); var pageSelectionTree = new PageSelectionTree(); var erpPage = new ErpPage(); if (pageId == null) { if (presetType != null) { erpPage.Type = presetType ?? PageType.Site; } if (presetAppId != null) { erpPage.AppId = presetAppId.Value; } if (presetEntityId != null) { erpPage.EntityId = presetEntityId.Value; erpPage.Type = PageType.RecordList; } } var pageSrv = new PageService(); var typeOptionsFieldId = Guid.NewGuid(); var appOptionsFieldId = Guid.NewGuid(); var areaOptionsFieldId = Guid.NewGuid(); var nodeOptionsFieldId = Guid.NewGuid(); var entityOptionsFieldId = Guid.NewGuid(); #region << Init >> var apps = new AppService().GetAllApplications(); var entities = new EntityManager().ReadEntities().Object; #region << ErpPage && Init it>> if (pageId != null) { erpPage = pageSrv.GetPage(pageId ?? Guid.Empty); if (erpPage == null) { ViewBag.ErrorMessage = "Error: the set pageId is not found as ErpPage!"; return(await Task.FromResult <IViewComponentResult>(View("Error"))); } if (erpPage.Type == PageType.Application && erpPage.AppId == null) { ViewBag.ErrorMessage = "Error: Application should have AppId!"; return(await Task.FromResult <IViewComponentResult>(View("Error"))); } } #endregion #region << Type options >> { pageSelectionTree.AllTypes = ModelExtensions.GetEnumAsSelectOptions <PageType>().OrderBy(x => x.Label).ToList(); } #endregion #region << App options >> { foreach (var app in apps) { pageSelectionTree.AllApps.Add(new SelectOption() { Value = app.Id.ToString(), Label = app.Name }); //Set App tree var appSelectionTree = new AppSelectionTree(); appSelectionTree.AppId = app.Id; foreach (var area in app.Sitemap.Areas) { appSelectionTree.AllAreas.Add(new SelectOption() { Value = area.Id.ToString(), Label = area.Name }); var areaSelectionTree = new AreaSelectionTree() { AreaId = area.Id }; foreach (var node in area.Nodes) { areaSelectionTree.AllNodes.Add(new SelectOption() { Value = node.Id.ToString(), Label = node.Name }); } areaSelectionTree.AllNodes = areaSelectionTree.AllNodes.OrderBy(x => x.Label).ToList(); appSelectionTree.AreaSelectionTree.Add(areaSelectionTree); } pageSelectionTree.AppSelectionTree.Add(appSelectionTree); //Set Entities foreach (var entity in app.Entities) { appSelectionTree.Entities.Add(new SelectOption() { Value = entity.Entity.Id.ToString(), Label = entity.Entity.Name }); } appSelectionTree.Entities = appSelectionTree.Entities.OrderBy(x => x.Label).ToList(); } pageSelectionTree.AllApps = pageSelectionTree.AllApps.OrderBy(x => x.Label).ToList(); } #endregion #region << Entity options >> foreach (var entity in entities) { pageSelectionTree.AllEntities.Add(new SelectOption() { Value = entity.Id.ToString(), Label = entity.Name }); } pageSelectionTree.AllEntities = pageSelectionTree.AllEntities.OrderBy(x => x.Label).ToList(); #endregion #endregion ViewBag.PageSelectionTree = pageSelectionTree; ViewBag.ErpPage = erpPage; ViewBag.TypeOptionsFieldId = typeOptionsFieldId; ViewBag.AppOptionsFieldId = appOptionsFieldId; ViewBag.AreaOptionsFieldId = areaOptionsFieldId; ViewBag.NodeOptionsFieldId = nodeOptionsFieldId; ViewBag.EntityOptionsFieldId = entityOptionsFieldId; var pageSelectionTreeJson = JsonConvert.SerializeObject(pageSelectionTree); ViewBag.EmbededJs = ""; #region << Generate js script >> if (mode == FieldRenderMode.Form) { var jsCompressor = new JavaScriptCompressor(); #region << Init Scripts >> var fileName = "form.js"; var scriptEl = "<script type=\"text/javascript\">"; var scriptTemplate = FileService.GetEmbeddedTextResource(fileName, "WebVella.Erp.Plugins.SDK.Components.WvSdkPageSitemap", "WebVella.Erp.Plugins.SDK"); scriptTemplate = scriptTemplate.Replace("\"{{PageSelectionTreeJson}}\";", pageSelectionTreeJson); scriptTemplate = scriptTemplate.Replace("{{typeOptionsFieldId}}", typeOptionsFieldId.ToString()); scriptTemplate = scriptTemplate.Replace("{{appOptionsFieldId}}", appOptionsFieldId.ToString()); scriptTemplate = scriptTemplate.Replace("{{areaOptionsFieldId}}", areaOptionsFieldId.ToString()); scriptTemplate = scriptTemplate.Replace("{{nodeOptionsFieldId}}", nodeOptionsFieldId.ToString()); scriptTemplate = scriptTemplate.Replace("{{entityOptionsFieldId}}", entityOptionsFieldId.ToString()); scriptEl += jsCompressor.Compress(scriptTemplate); //scriptEl += scriptTemplate; scriptEl += "</script>"; ViewBag.EmbededJs = scriptEl; #endregion } #endregion ViewBag.RenderMode = mode; var applicationOptions = new List <SelectOption>(); var areaOptions = new List <SelectOption>(); var nodeOptions = new List <SelectOption>(); var entityOptions = new List <SelectOption>(); #region << Init Options >> //AppOptions applicationOptions = pageSelectionTree.AllApps; applicationOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); areaOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); nodeOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); entityOptions = pageSelectionTree.AllEntities; entityOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); //App is selected if (erpPage.AppId != null) { var treeAppOptions = pageSelectionTree.AppSelectionTree.First(x => x.AppId == erpPage.AppId); areaOptions = treeAppOptions.AllAreas; if (erpPage.AreaId == null) { areaOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); nodeOptions.Insert(0, new SelectOption() { Value = "", Label = "not selected" }); } else { var treeAreaOptions = treeAppOptions.AreaSelectionTree.FirstOrDefault(x => x.AreaId == erpPage.AreaId); if (treeAreaOptions != null) { nodeOptions = treeAreaOptions.AllNodes; } } if (treeAppOptions.Entities.Count > 0) { entityOptions = treeAppOptions.Entities; } else { entityOptions = pageSelectionTree.AllEntities; } } #endregion ViewBag.ApplicationOptions = applicationOptions; ViewBag.AreaOptions = areaOptions; ViewBag.NodeOptions = nodeOptions; ViewBag.EntityOptions = entityOptions; if (mode == FieldRenderMode.Form) { return(await Task.FromResult <IViewComponentResult>(View("Form"))); } else { return(await Task.FromResult <IViewComponentResult>(View("Display"))); } }
public DataService(DiskService disk, CacheService cache, PageService pager) { _disk = disk; _cache = cache; _pager = pager; }
private void InitializeServices() { this.domainService = new DomainService(this.domainRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetConfigService = new ClientAssetConfigService( this.clientAssetConfigRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetService = new ClientAssetService( this.clientAssetRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetTypeService = new ClientAssetTypeService( this.clientAssetTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageService = new PageService(this.pageRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageTemplateService = new PageTemplateService( this.pageTemplateRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageTemplateZoneMapService = new PageTemplateZoneMapService( this.pageTemplateZoneMapRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageZoneService = new PageZoneService( this.pageZoneRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partService = new PartService(this.partRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partTypeService = new PartTypeService( this.partTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.seoDecoratorService = new SeoDecoratorService( this.seoDecoratorRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.userService = new UserService(this.userRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partContainerService = new PartContainerService( this.partContainerRepositoryMock.Object, new Mock<IUnitOfWork>().Object); }
public IndexService(PageService pager, Logger log) { _pager = pager; _log = log; }
private void psc_GetSupportPageByIDCompleted(object sender, PageService.GetPageSupportByIDCompletedEventArgs e) { PageSupportObject = e.Result; }
public IndexService(PageService pager) { _pager = pager; }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); List <int> expandedPageIds = new List <int>(); RockContext rockContext = new RockContext(); PageService pageService = new PageService(rockContext); if (Page.IsPostBack) { foreach (string expandedId in hfExpandedIds.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { int id = 0; if (expandedId.StartsWith("p") && expandedId.Length > 1) { if (int.TryParse(expandedId.Substring(1), out id)) { expandedPageIds.Add(id); } } } } else { string pageSearch = this.PageParameter("pageSearch"); if (!string.IsNullOrWhiteSpace(pageSearch)) { foreach (Page page in pageService.Queryable().Where(a => a.InternalName.IndexOf(pageSearch) >= 0)) { Page selectedPage = page; while (selectedPage != null) { selectedPage = selectedPage.ParentPage; if (selectedPage != null) { expandedPageIds.Add(selectedPage.Id); } } } } } var sb = new StringBuilder(); sb.AppendLine("<ul id=\"treeview\">"); var allPages = pageService.Queryable("Pages, Blocks"); string rootPage = GetAttributeValue("RootPage"); if (!string.IsNullOrEmpty(rootPage)) { Guid pageGuid = rootPage.AsGuid(); allPages = allPages.Where(a => a.ParentPage.Guid == pageGuid); } else { allPages = allPages.Where(a => a.ParentPageId == null); } foreach (var page in allPages.OrderBy(a => a.Order).ThenBy(a => a.InternalName).ToList()) { sb.Append(PageNode(page, expandedPageIds, rockContext)); } sb.AppendLine("</ul>"); lPages.Text = sb.ToString(); }
public PageController() { pageService = new PageService(); userService = new UserService(); nfService = new NotificationService(); }
public ValidateBookAuthor(PageService pageService, FieldTemplateService fieldTemplateService) { _pageService = pageService; _fieldTemplateService = fieldTemplateService; }
public CollectionService(PageService pager, IndexService indexer, DataService data) { _pager = pager; _indexer = indexer; _data = data; }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { Site site; if (Page.IsValid) { var rockContext = new RockContext(); PageService pageService = new PageService(rockContext); SiteService siteService = new SiteService(rockContext); SiteDomainService siteDomainService = new SiteDomainService(rockContext); bool newSite = false; int siteId = hfSiteId.Value.AsInteger(); if (siteId == 0) { newSite = true; site = new Rock.Model.Site(); siteService.Add(site); } else { site = siteService.Get(siteId); } site.Name = tbSiteName.Text; site.Description = tbDescription.Text; site.Theme = ddlTheme.Text; site.DefaultPageId = ppDefaultPage.PageId; site.DefaultPageRouteId = ppDefaultPage.PageRouteId; site.LoginPageId = ppLoginPage.PageId; site.LoginPageRouteId = ppLoginPage.PageRouteId; site.ChangePasswordPageId = ppChangePasswordPage.PageId; site.ChangePasswordPageRouteId = ppChangePasswordPage.PageRouteId; site.CommunicationPageId = ppCommunicationPage.PageId; site.CommunicationPageRouteId = ppCommunicationPage.PageRouteId; site.RegistrationPageId = ppRegistrationPage.PageId; site.RegistrationPageRouteId = ppRegistrationPage.PageRouteId; site.PageNotFoundPageId = ppPageNotFoundPage.PageId; site.PageNotFoundPageRouteId = ppPageNotFoundPage.PageRouteId; site.ErrorPage = tbErrorPage.Text; site.GoogleAnalyticsCode = tbGoogleAnalytics.Text; site.RequiresEncryption = cbRequireEncryption.Checked; site.EnabledForShortening = cbEnableForShortening.Checked; site.EnableMobileRedirect = cbEnableMobileRedirect.Checked; site.MobilePageId = ppMobilePage.PageId; site.ExternalUrl = tbExternalURL.Text; site.AllowedFrameDomains = tbAllowedFrameDomains.Text; site.RedirectTablets = cbRedirectTablets.Checked; site.EnablePageViews = cbEnablePageViews.Checked; site.IsActive = cbIsActive.Checked; site.AllowIndexing = cbAllowIndexing.Checked; site.IsIndexEnabled = cbEnableIndexing.Checked; site.IndexStartingLocation = tbIndexStartingLocation.Text; site.PageHeaderContent = cePageHeaderContent.Text; int?existingIconId = null; if (site.FavIconBinaryFileId != imgSiteIcon.BinaryFileId) { existingIconId = site.FavIconBinaryFileId; site.FavIconBinaryFileId = imgSiteIcon.BinaryFileId; } int?existingLogoId = null; if (site.SiteLogoBinaryFileId != imgSiteLogo.BinaryFileId) { existingLogoId = site.SiteLogoBinaryFileId; site.SiteLogoBinaryFileId = imgSiteLogo.BinaryFileId; } var currentDomains = tbSiteDomains.Text.SplitDelimitedValues().ToList <string>(); site.SiteDomains = site.SiteDomains ?? new List <SiteDomain>(); // Remove any deleted domains foreach (var domain in site.SiteDomains.Where(w => !currentDomains.Contains(w.Domain)).ToList()) { site.SiteDomains.Remove(domain); siteDomainService.Delete(domain); } int order = 0; foreach (string domain in currentDomains) { SiteDomain sd = site.SiteDomains.Where(d => d.Domain == domain).FirstOrDefault(); if (sd == null) { sd = new SiteDomain(); sd.Domain = domain; sd.Guid = Guid.NewGuid(); site.SiteDomains.Add(sd); } sd.Order = order++; } if (!site.DefaultPageId.HasValue && !newSite) { ppDefaultPage.ShowErrorMessage("Default Page is required."); return; } if (!site.IsValid) { // Controls will render the error messages return; } rockContext.WrapTransaction(() => { rockContext.SaveChanges(); SaveAttributes(new Page().TypeId, "SiteId", site.Id.ToString(), PageAttributesState, rockContext); if (existingIconId.HasValue) { BinaryFileService binaryFileService = new BinaryFileService(rockContext); var binaryFile = binaryFileService.Get(existingIconId.Value); if (binaryFile != null) { // marked the old images as IsTemporary so they will get cleaned up later binaryFile.IsTemporary = true; rockContext.SaveChanges(); } } if (existingLogoId.HasValue) { BinaryFileService binaryFileService = new BinaryFileService(rockContext); var binaryFile = binaryFileService.Get(existingLogoId.Value); if (binaryFile != null) { // marked the old images as IsTemporary so they will get cleaned up later binaryFile.IsTemporary = true; rockContext.SaveChanges(); } } if (newSite) { Rock.Security.Authorization.CopyAuthorization(RockPage.Layout.Site, site, rockContext, Authorization.EDIT); Rock.Security.Authorization.CopyAuthorization(RockPage.Layout.Site, site, rockContext, Authorization.ADMINISTRATE); Rock.Security.Authorization.CopyAuthorization(RockPage.Layout.Site, site, rockContext, Authorization.APPROVE); } }); // add/update for the InteractionChannel for this site and set the RetentionPeriod var interactionChannelService = new InteractionChannelService(rockContext); int channelMediumWebsiteValueId = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.INTERACTIONCHANNELTYPE_WEBSITE.AsGuid()).Id; var interactionChannelForSite = interactionChannelService.Queryable() .Where(a => a.ChannelTypeMediumValueId == channelMediumWebsiteValueId && a.ChannelEntityId == site.Id).FirstOrDefault(); if (interactionChannelForSite == null) { interactionChannelForSite = new InteractionChannel(); interactionChannelForSite.ChannelTypeMediumValueId = channelMediumWebsiteValueId; interactionChannelForSite.ChannelEntityId = site.Id; interactionChannelService.Add(interactionChannelForSite); } interactionChannelForSite.Name = site.Name; interactionChannelForSite.RetentionDuration = nbPageViewRetentionPeriodDays.Text.AsIntegerOrNull(); interactionChannelForSite.ComponentEntityTypeId = EntityTypeCache.Get <Rock.Model.Page>().Id; rockContext.SaveChanges(); // Create the default page is this is a new site if (!site.DefaultPageId.HasValue && newSite) { var siteCache = SiteCache.Get(site.Id); // Create the layouts for the site, and find the first one LayoutService.RegisterLayouts(Request.MapPath("~"), siteCache); var layoutService = new LayoutService(rockContext); var layouts = layoutService.GetBySiteId(siteCache.Id); Layout layout = layouts.FirstOrDefault(l => l.FileName.Equals("FullWidth", StringComparison.OrdinalIgnoreCase)); if (layout == null) { layout = layouts.FirstOrDefault(); } if (layout != null) { var page = new Page(); page.LayoutId = layout.Id; page.PageTitle = siteCache.Name + " Home Page"; page.InternalName = page.PageTitle; page.BrowserTitle = page.PageTitle; page.EnableViewState = true; page.IncludeAdminFooter = true; page.MenuDisplayChildPages = true; var lastPage = pageService.GetByParentPageId(null).OrderByDescending(b => b.Order).FirstOrDefault(); page.Order = lastPage != null ? lastPage.Order + 1 : 0; pageService.Add(page); rockContext.SaveChanges(); site = siteService.Get(siteCache.Id); site.DefaultPageId = page.Id; rockContext.SaveChanges(); } } var qryParams = new Dictionary <string, string>(); qryParams["siteId"] = site.Id.ToString(); NavigateToPage(RockPage.Guid, qryParams); } }
public void OnActionExecuted(ActionExecutedContext filterContext) { var zones = new ZoneWidgetCollection(); var cache = new StaticCache(); //Page string path = filterContext.RequestContext.HttpContext.Request.Path; if (path.EndsWith("/") && path.Length > 1) { path = path.Substring(0, path.Length - 1); //filterContext.HttpContext.Response.Redirect(path); filterContext.Result = new RedirectResult(path); return; } bool publish = !ReView.Review.Equals(filterContext.RequestContext.HttpContext.Request.QueryString[ReView.QueryKey], StringComparison.CurrentCultureIgnoreCase); var page = new PageService().GetByPath(path, publish); if (page != null) { var layoutService = new LayoutService(); LayoutEntity layout = layoutService.Get(page.LayoutId); layout.Page = page; Action<WidgetBase> processWidget = m => { IWidgetPartDriver partDriver = cache.Get("IWidgetPartDriver_" + m.AssemblyName + m.ServiceTypeName, source => Activator.CreateInstance(m.AssemblyName, m.ServiceTypeName).Unwrap() as IWidgetPartDriver ); WidgetPart part = partDriver.Display(partDriver.GetWidget(m), filterContext.HttpContext); lock (zones) { if (zones.ContainsKey(part.Widget.ZoneID)) { zones[part.Widget.ZoneID].Add(part); } else { var partCollection = new WidgetCollection { part }; zones.Add(part.Widget.ZoneID, partCollection); } } }; var layoutWidgetsTask = Task.Factory.StartNew(layoutId => { var widgetServiceIn = new WidgetService(); IEnumerable<WidgetBase> layoutwidgets = widgetServiceIn.Get(new DataFilter().Where("LayoutID", OperatorType.Equal, layoutId)); layoutwidgets.Each(processWidget); }, page.LayoutId); var widgetService = new WidgetService(); IEnumerable<WidgetBase> widgets = widgetService.Get(new DataFilter().Where("PageID", OperatorType.Equal, page.ID)); int middle = widgets.Count() / 2; var pageWidgetsTask = Task.Factory.StartNew(() => widgets.Skip(middle).Each(processWidget)); widgets.Take(middle).Each(processWidget); Task.WaitAll(new[] { pageWidgetsTask, layoutWidgetsTask }); layout.ZoneWidgets = zones; var viewResult = (filterContext.Result as ViewResult); if (viewResult != null) { //viewResult.MasterName = "~/Modules/Easy.Web.CMS.Page/Views/Shared/_Layout.cshtml"; viewResult.ViewData[LayoutEntity.LayoutKey] = layout; } } else { filterContext.Result = new HttpStatusCodeResult(404); } }
void psc_GetPageSupportListCompleted(object sender, PageService.GetPageSupportListCompletedEventArgs e) { this.datagrid.ItemsSource = e.Result; }
public void BeforeEach() { Subject = new PageService(); }
/// <summary> /// Handles the Click event of the btnLogin control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnLogin_Click(object sender, EventArgs e) { if (!Page.IsValid) { // controls will render messages return; } nbWarningMessage.Text = string.Empty; var userLoginService = new UserLoginService(); var userLogin = userLoginService.GetByUserName(tbUserName.Text); if (userLogin != null && userLogin.ServiceType == AuthenticationServiceType.Internal) { foreach (var serviceEntry in AuthenticationContainer.Instance.Components) { var component = serviceEntry.Value.Value; string componentName = component.GetType().FullName; if ( userLogin.ServiceName == componentName && component.AttributeValues.ContainsKey("Active") && bool.Parse(component.AttributeValues["Active"][0].Value) ) { if (component.Authenticate(userLogin, tbPassword.Text)) { string groupId = this.GetAttributeValue("ResidencyGraderSecurityRole"); Group residencyGraderSecurityRole = new GroupService().Get(groupId.AsInteger() ?? 0); if (residencyGraderSecurityRole != null) { // Grader must either by member of ResidencyGraderSecurityRole or the Teacher of Record for this project's competency bool userAuthorizedToGrade = residencyGraderSecurityRole.Members.Any(a => a.PersonId == userLogin.PersonId); if (!userAuthorizedToGrade) { CompetencyPersonProject competencyPersonProject = new ResidencyService <CompetencyPersonProject>().Get(hfCompetencyPersonProjectId.ValueAsInt()); if (competencyPersonProject != null) { userAuthorizedToGrade = competencyPersonProject.Project.Competency.TeacherOfRecordPersonId.Equals(userLogin.PersonId); } if (competencyPersonProject.CompetencyPerson.PersonId != CurrentPersonId) { // somebody besides the Resident is logged in NavigateToParentPage(); return; } } if (userAuthorizedToGrade) { string gradeDetailPageGuid = this.GetAttributeValue("ResidentGradeDetailPage"); if (!string.IsNullOrWhiteSpace(gradeDetailPageGuid)) { var page = new PageService().Get(new Guid(gradeDetailPageGuid)); if (page != null) { string identifier = hfCompetencyPersonProjectId.Value + "|" + userLogin.Guid + "|" + DateTime.Now.Ticks; string residentGraderSessionKey = Rock.Security.Encryption.EncryptString(identifier); Session["residentGraderSessionKey"] = residentGraderSessionKey; var queryString = new Dictionary <string, string>(); queryString.Add("competencyPersonProjectId", hfCompetencyPersonProjectId.Value); NavigateToPage(page.Guid, queryString); return; } } nbWarningMessage.Text = "Ooops! Grading page not configured."; return; } else { nbWarningMessage.Text = "User not authorized to grade this project"; return; } } } } } } nbWarningMessage.Text = "Invalid Login Information"; }
public void UpdatePageSupport(PageService.PageSupport ps) { PageService.PageServiceClient psc = new PageService.PageServiceClient(); psc.UpdatePageSupportByIDAsync(ps); }
public TeacherLoginPageViewModel(PageService navigation) { _navigation = navigation; }