Exemplo n.º 1
0
        public override void Validate()
        {
            var errors = new RulesException <ObjectFormat>();

            base.Validate(errors);

            if (!string.IsNullOrWhiteSpace(NetFormatName) && IsSiteDotNet)
            {
                if (!Regex.IsMatch(NetFormatName, RegularExpressions.NetName))
                {
                    errors.ErrorFor(x => x.NetFormatName, TemplateStrings.NetNameInvalidFormat);
                }
                if (!PageTemplateRepository.ObjectFormatNetNameUnique(NetFormatName, ObjectId, Id))
                {
                    errors.ErrorFor(x => x.NetFormatName, TemplateStrings.NetNameNotUnique);
                }
                if (NetFormatName.Length > 255)
                {
                    errors.ErrorFor(x => x.NetFormatName, TemplateStrings.NetNameMaxLengthExceeded);
                }
            }

            if (NetLanguageId != null)
            {
                if (string.IsNullOrWhiteSpace(CodeBehind))
                {
                    errors.ErrorFor(n => n.CodeBehind, ObjectFormatStrings.CodeBehindRequired);
                }
            }

            if (!errors.IsEmpty)
            {
                throw errors;
            }
        }
Exemplo n.º 2
0
 public IEnumerable <ListItem> GetNetLanguagesAsListItems()
 {
     return(PageTemplateRepository.GetNetLanguagesList().Select(lang => new ListItem {
         Text = lang.Name, Value = lang.Id.ToString()
     })
            .ToArray());
 }
Exemplo n.º 3
0
        public static int CopySiteTemplates(int sourceSiteId, int destinationSiteId, int templateNumber)
        {
            var templateIdNew       = PageTemplateRepository.CopySiteTemplates(sourceSiteId, destinationSiteId, templateNumber);
            var relBetweenTemplates = PageTemplateRepository.GetRelationsBetweenTemplates(sourceSiteId, destinationSiteId, templateIdNew);
            var relBetweenContents  = ContentRepository.GetRelationsBetweenContentsXml(sourceSiteId, destinationSiteId, string.Empty);

            PageRepository.CopySiteTemplatePages(sourceSiteId, destinationSiteId, relBetweenTemplates);

            var relBetweenPages = PageRepository.GetRelationsBetweenPages(relBetweenTemplates);

            ObjectRepository.CopySiteTemplateObjects(relBetweenTemplates, relBetweenPages, out var relBetweenObjects);

            ObjectFormatRepository.CopySiteTemplateObjectFormats(relBetweenObjects, out var relBetweenObjectFormats);

            ObjectRepository.CopySiteUpdateObjects(relBetweenObjectFormats, relBetweenObjects);
            ObjectRepository.CopySiteObjectValues(relBetweenObjects);
            ObjectRepository.CopySiteContainers(relBetweenObjects, relBetweenContents);

            var relBetweenStatuses = ContentRepository.GetRelationsBetweenStatuses(sourceSiteId, destinationSiteId);

            ObjectRepository.CopyContainerStatuses(relBetweenStatuses, relBetweenObjects);

            NotificationRepository.CopySiteUpdateNotifications(relBetweenObjectFormats, relBetweenContents);

            return(templateIdNew != 0 ? 1 : 0);
        }
Exemplo n.º 4
0
        public override MultistepActionSettings Setup(int parentId, int templateId, bool?boundToExternal)
        {
            var site = SiteRepository.GetById(parentId);

            if (site == null)
            {
                throw new ApplicationException(string.Format(SiteStrings.SiteNotFound, parentId));
            }

            var template = PageTemplateRepository.GetPageTemplatePropertiesById(templateId);

            if (site.IsDotNet)
            {
                templateCommand = new AssembleTemplateCommand(templateId, template.Name);
                pagesCommand    = new AssemblePagesCommand(templateId, template.Name, false, true);
                pagesCommand.Setup();

                notificationsCommand = new AssembleNotificationsCommand(templateId, template.Name, false);
            }
            else
            {
                pagesCommand = new AssemblePagesCommand(templateId, template.Name, false, false);
                pagesCommand.Setup();
            }

            return(base.Setup(parentId, templateId, boundToExternal));
        }
Exemplo n.º 5
0
        public PageTemplate ReadPageTemplateByObjectFormatId(int id)
        {
            var frmt = ReadNotificationTemplateFormat(id);
            var obj  = ObjectRepository.GetObjectPropertiesById(frmt.ObjectId);

            return(PageTemplateRepository.GetPageTemplatePropertiesById(obj.PageTemplateId));
        }
Exemplo n.º 6
0
        public override void Validate()
        {
            var errors = new RulesException <Page>();

            base.Validate(errors);

            if (!PageTemplateRepository.PageFileNameUnique(FileName, PageTemplate.Id, Id))
            {
                errors.ErrorFor(x => x.FileName, TemplateStrings.NetNameNotUnique);
            }

            if (!string.IsNullOrWhiteSpace(CustomClass))
            {
                if (!Regex.IsMatch(CustomClass, RegularExpressions.NetName))
                {
                    errors.ErrorFor(x => x.CustomClass, TemplateStrings.CustomClassInvalidFormat);
                }
            }

            if (!string.IsNullOrWhiteSpace(Folder))
            {
                if (!Regex.IsMatch(Folder, RegularExpressions.RelativeWindowsFolderPath))
                {
                    errors.ErrorFor(x => x.Folder, TemplateStrings.FolderNameInvalidFormat);
                }
            }

            if (PageTemplate.SiteIsDotNet)
            {
                if (!string.IsNullOrWhiteSpace(CustomClass))
                {
                    if (!Regex.IsMatch(CustomClass, RegularExpressions.NetName))
                    {
                        errors.ErrorFor(x => x.CustomClass, TemplateStrings.CustomClassInvalidFormat);
                    }
                    if (CustomClass.Length > 255)
                    {
                        errors.ErrorFor(x => x.CustomClass, TemplateStrings.CustomClassMaxLengthExceeded);
                    }
                }

                if (!string.IsNullOrWhiteSpace(Folder))
                {
                    if (!Regex.IsMatch(Folder, RegularExpressions.RelativeWindowsFolderPath))
                    {
                        errors.ErrorFor(x => x.Folder, TemplateStrings.FolderNameInvalidFormat);
                    }
                    if (Folder.Length > 255)
                    {
                        errors.ErrorFor(x => x.Folder, TemplateStrings.FolderNameMaxLengthExceeded);
                    }
                }
            }
            if (!errors.IsEmpty)
            {
                throw errors;
            }
        }
        public void WhenGetAllFromEmptyDatabase_ThenReturnsEmptyCollection()
        {
            var repository = new PageTemplateRepository(new DatabaseFactory());
            IEnumerable<PageTemplate> actual = repository.GetAll();

            Assert.NotNull(actual);
            var actualList = new List<PageTemplate>(actual);
            Assert.Equal(0, actualList.Count);
        }
Exemplo n.º 8
0
        public ListResult <PageTemplateListItem> GetPageTemplatesBySiteId(ListCommand cmd, int siteId)
        {
            var list = PageTemplateRepository.ListTemplates(cmd, siteId, out var totalRecords);

            return(new ListResult <PageTemplateListItem>
            {
                Data = list.ToList(),
                TotalRecords = totalRecords
            });
        }
Exemplo n.º 9
0
        private static ListResult <ObjectFormatVersionListItem> GetObjectFormatVersionsByFormatId(ListCommand listCommand, int formatId, bool pageOrTemplate)
        {
            var list = PageTemplateRepository.ListFormatVersions(listCommand, formatId, out var totalRecords, pageOrTemplate);

            return(new ListResult <ObjectFormatVersionListItem>
            {
                Data = list.ToList(),
                TotalRecords = totalRecords
            });
        }
Exemplo n.º 10
0
        public MessageResult MultipleRemovePage(int[] ids)
        {
            if (ids == null)
            {
                throw new ArgumentNullException(nameof(ids));
            }

            PageTemplateRepository.MultipleDeletePage(ids);
            return(null);
        }
Exemplo n.º 11
0
 internal static PageTemplate Create(int parentId, Site site) => new PageTemplate
 {
     SiteId = parentId,
     Site   = site,
     MaxNumOfFormatStoredVersions = 100,
     SendNocacheHeaders           = true,
     EnableViewstate = true,
     Charset         = PageTemplateRepository.GetCharsetByName("utf-8").Subj,
     Locale          = PageTemplateRepository.GetLocaleByName("Russian").Id
 };
Exemplo n.º 12
0
        public ObjectFormatVersion GetMergedObjectFormatVersion(int[] ids, int parentId, bool pageOrTemplate)
        {
            if (ids == null)
            {
                throw new ArgumentNullException(nameof(ids));
            }

            if (ids.Length != 2)
            {
                throw new ArgumentException("Wrong ids length");
            }

            var result   = GetOrderedIds(ids);
            var version1 = PageTemplateRepository.ReadFormatVersion(result.Item1);

            if (version1 == null)
            {
                throw new Exception(string.Format(TemplateStrings.FormatVersionNotFoundForFormat, result.Item1, parentId));
            }

            ObjectFormatVersion version2;

            if (result.Item2 == ObjectFormatVersion.CurrentVersionId)
            {
                var parent = ObjectFormatRepository.ReadObjectFormat(parentId, pageOrTemplate);
                if (parent == null)
                {
                    throw new Exception(string.Format(TemplateStrings.FormatNotFound, parentId));
                }

                version2 = new ObjectFormatVersion
                {
                    Name               = parent.Name,
                    NetFormatName      = parent.NetFormatName,
                    Description        = parent.Description,
                    NetLanguage        = parent.NetLanguageId.HasValue ? PageTemplateRepository.GetNetLanguageById(parent.NetLanguageId.Value) : null,
                    FormatBody         = parent.FormatBody,
                    CodeBehind         = parent.CodeBehind,
                    LastModifiedByUser = parent.LastModifiedByUser,
                    Modified           = parent.Modified
                };
            }
            else
            {
                version2 = PageTemplateRepository.ReadFormatVersion(result.Item2);
                if (version2 == null)
                {
                    throw new Exception(string.Format(TemplateStrings.FormatVersionNotFoundForFormat, result.Item2, parentId));
                }
            }

            version1.MergeToVersion(version2);
            return(version1);
        }
Exemplo n.º 13
0
        public void CancelTemplate(int id)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(id);

            if (template == null)
            {
                throw new Exception(string.Format(TemplateStrings.TemplateNotFound, id));
            }

            template.AutoUnlock();
        }
Exemplo n.º 14
0
        public ListResult <ObjectSearchListItem> ObjectSearch(ListCommand listCommand, int siteId, int?templateId, int?pageId, string filter)
        {
            var data = PageTemplateRepository.GetSearchObjectPage(listCommand, siteId, templateId, pageId, filter, out var totalRecords).ToList();

            ManageObjectSearchItemsDescription(data, filter);
            return(new ListResult <ObjectSearchListItem>
            {
                Data = data,
                TotalRecords = totalRecords
            });
        }
Exemplo n.º 15
0
        private ContentForm InitContentForm()
        {
            if (IsObjectFormType)
            {
                return(PageTemplateRepository.GetContentFormByObjectId(Id) ?? new ContentForm {
                    ObjectId = Id, ContentId = null, GenerateUpdateScript = true
                });
            }

            return(new ContentForm());
        }
Exemplo n.º 16
0
 public PageTemplateServices(PXHotelEntities entities)
 {
     _localizedResourceServices = HostContainer.GetInstance<ILocalizedResourceServices>();
     _pageTemplateLogServices = HostContainer.GetInstance<IPageTemplateLogServices>();
     _settingServices = HostContainer.GetInstance<ISettingServices>();
     _templateServices = HostContainer.GetInstance<ITemplateServices>();
     _userServices = HostContainer.GetInstance<IUserServices>();
     _pageTemplateRepository = new PageTemplateRepository(entities);
     _fileTemplateRepository = new FileTemplateRepository(entities);
     _pageRepository = new PageRepository(entities);
     _pageTemplateLogRepository = new PageTemplateLogRepository(entities);
 }
Exemplo n.º 17
0
 public PageTemplateServices(PXHotelEntities entities)
 {
     _localizedResourceServices = HostContainer.GetInstance <ILocalizedResourceServices>();
     _pageTemplateLogServices   = HostContainer.GetInstance <IPageTemplateLogServices>();
     _settingServices           = HostContainer.GetInstance <ISettingServices>();
     _templateServices          = HostContainer.GetInstance <ITemplateServices>();
     _userServices              = HostContainer.GetInstance <IUserServices>();
     _pageTemplateRepository    = new PageTemplateRepository(entities);
     _fileTemplateRepository    = new FileTemplateRepository(entities);
     _pageRepository            = new PageRepository(entities);
     _pageTemplateLogRepository = new PageTemplateLogRepository(entities);
 }
Exemplo n.º 18
0
        public void CaptureLockTemplate(int id)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(id);

            if (template == null)
            {
                throw new Exception(string.Format(TemplateStrings.TemplateNotFound, id));
            }

            if (template.CanBeUnlocked)
            {
                EntityObjectRepository.CaptureLock(template);
            }
        }
Exemplo n.º 19
0
        internal static Page Create(int parentId)
        {
            var parentTemplate = PageTemplateRepository.GetPageTemplatePropertiesById(parentId);

            return(new Page
            {
                TemplateId = parentId,
                PageTemplate = parentTemplate,
                CacheHours = 1,
                EnableViewState = true,
                Charset = parentTemplate.Charset,
                Locale = parentTemplate.Locale,
                SendNocacheHeaders = true
            });
        }
Exemplo n.º 20
0
        /// <summary>
        /// Возвращает упрощенный список сущностей
        /// </summary>
        public static List <ListItem> SimpleList(SimpleListQuery query)
        {
            var itemList = new List <ListItem>();

            if (query.EntityTypeCode == EntityTypeCode.ContentGroup)
            {
                itemList = ContentRepository.GetGroupSimpleList(query.ParentEntityId, query.SelectedEntitiesIds).ToList();
            }
            else if (query.EntityTypeCode == EntityTypeCode.Article || query.EntityTypeCode == EntityTypeCode.ArchiveArticle)
            {
                itemList = ArticleRepository.GetSimpleList(query);
            }
            else if (query.EntityTypeCode == EntityTypeCode.Content)
            {
                itemList.AddRange(ContentRepository.GetSimpleList(query.ParentEntityId, query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.Site)
            {
                itemList.AddRange(SiteRepository.GetSimpleList(query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.User)
            {
                itemList.AddRange(UserRepository.GetSimpleList(query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.UserGroup)
            {
                itemList.AddRange(UserGroupRepository.GetSimpleList(query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.TemplateObjectFormat)
            {
                itemList.AddRange(ObjectFormatRepository.GetObjectFormats(query.ParentEntityId, query.ActualListId, query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.Page)
            {
                itemList.AddRange(PageTemplateRepository.GetPageSimpleList(query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.StatusType)
            {
                itemList.AddRange(StatusTypeRepository.GetStatusSimpleList(query.SelectedEntitiesIds));
            }
            else if (query.EntityTypeCode == EntityTypeCode.Field)
            {
                itemList.AddRange(FieldRepository.GetList(query.SelectedEntitiesIds).Select(c => new ListItem(c.Id.ToString(), c.Name)));
            }

            return(itemList);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Возвращает упрощенный список сущностей
        /// </summary>
        /// <param name="entityTypeCode">код типа сущности</param>
        /// <param name="parentEntityId">идентификатор родительской сущности</param>
        /// <param name="entityId">идентификатор сущности</param>
        /// <param name="listId">дополнительный параметр для идентификации списка</param>
        /// <param name="selectionMode">режим выделения списка</param>
        /// <param name="selectedEntitiesIDs">идентификаторы выбранных сущностей</param>
        /// <param name="filter"></param>
        /// <param name="testEntityId"></param>
        /// <returns>упрощенный список сущностей</returns>
        public static List <ListItem> SimpleList(string entityTypeCode, int parentEntityId, int?entityId, int?listId, ListSelectionMode selectionMode, int[] selectedEntitiesIDs, string filter, int testEntityId)
        {
            var itemList = new List <ListItem>();

            if (entityTypeCode == EntityTypeCode.ContentGroup)
            {
                itemList = ContentRepository.GetGroupSimpleList(parentEntityId, selectedEntitiesIDs).ToList();
            }
            else if (entityTypeCode == EntityTypeCode.Article || entityTypeCode == EntityTypeCode.ArchiveArticle)
            {
                itemList = ArticleRepository.GetSimpleList(parentEntityId, entityId, listId, selectionMode, selectedEntitiesIDs, filter, testEntityId);
            }
            else if (entityTypeCode == EntityTypeCode.Content)
            {
                itemList.AddRange(ContentRepository.GetSimpleList(parentEntityId, selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.Site)
            {
                itemList.AddRange(SiteRepository.GetSimpleList(selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.User)
            {
                itemList.AddRange(UserRepository.GetSimpleList(selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.UserGroup)
            {
                itemList.AddRange(UserGroupRepository.GetSimpleList(selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.TemplateObjectFormat)
            {
                itemList.AddRange(ObjectFormatRepository.GetObjectFormats(parentEntityId, listId, selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.Page)
            {
                itemList.AddRange(PageTemplateRepository.GetPageSimpleList(selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.StatusType)
            {
                itemList.AddRange(StatusTypeRepository.GetStatusSimpleList(selectedEntitiesIDs));
            }
            else if (entityTypeCode == EntityTypeCode.Field)
            {
                itemList.AddRange(FieldRepository.GetList(selectedEntitiesIDs).Select(c => new ListItem(c.Id.ToString(), c.Name)));
            }

            return(itemList);
        }
Exemplo n.º 22
0
        private static void SetDalProperties(Page bizObject, PageDAL dataObject)
        {
            SetDalProxyCache(bizObject, dataObject);

            dataObject.Codepage = PageTemplateRepository.GetCharsetByName(bizObject.Charset).Codepage;

            if (!bizObject.PageTemplate.SiteIsDotNet)
            {
                dataObject.CustomClass     = null;
                dataObject.EnableViewstate = false;
            }

            if (!bizObject.ProxyCache && !bizObject.BrowserCaching)
            {
                dataObject.CacheHours = 0;
            }
        }
Exemplo n.º 23
0
        public PageTemplate ReadPageTemplateProperties(int id, bool withAutoLock = true)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(id);

            if (template == null)
            {
                throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, id));
            }

            if (withAutoLock)
            {
                template.AutoLock();
            }

            template.LoadLockedByUser();
            return(template);
        }
Exemplo n.º 24
0
        internal static BllObject Create(int parentId, bool pageOrTemplate) //true-page false-template
        {
            var obj = new BllObject();

            if (pageOrTemplate)
            {
                obj.PageId         = parentId;
                obj.PageTemplateId = obj.page.TemplateId;
                obj.PageTemplate   = PageTemplateRepository.GetPageTemplatePropertiesById(obj.page.TemplateId);
            }
            else
            {
                obj.PageTemplateId = parentId;
                obj.PageTemplate   = PageTemplateRepository.GetPageTemplatePropertiesById(parentId);
            }
            obj.TypeId = ObjectType.GetGeneric().Id;
            return(obj);
        }
Exemplo n.º 25
0
        public MultistepActionStepResult Step(int step)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(TemplateId);

            if (template == null)
            {
                throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, TemplateId));
            }
            if (!template.SiteIsDotNet)
            {
                throw new ApplicationException(string.Format(SiteStrings.ShouldBeDotNet));
            }

            new AssembleTemplateObjectsController(TemplateId, QPContext.CurrentDbConnectionString).Assemble();

            return(new MultistepActionStepResult {
                ProcessedItemsCount = 1
            });
        }
Exemplo n.º 26
0
        public MessageResult RemovePageTemplate(int id)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(id);

            if (template == null)
            {
                throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, id));
            }

            if (template.LockedByAnyoneElse)
            {
                return(MessageResult.Error(string.Format(TemplateStrings.LockedByAnyoneElse, template.LockedByDisplayName)));
            }

            ManagePageTemplateFolders(template, FolderManagingType.DeleteFolder);
            PageTemplateRepository.DeletePageTemplate(id);

            return(null);
        }
Exemplo n.º 27
0
        private int?CreateDefaultFormat(BllObject bllObject, bool isReplayAction)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(bllObject.PageTemplateId);
            var format   = ObjectFormat.Create(bllObject.Id, bllObject.PageOrTemplate, template.SiteIsDotNet);

            format.Name = "default";
            if (template.SiteIsDotNet)
            {
                format.NetFormatName = "default";
            }

            else

            {
                format.NetLanguageId = template.NetLanguageId;
            }

            var netLanguagePrefix = GetLangPrefix(template.NetLanguageId);

            var pathToCopy = SitePathRepository.GetDirectoryPathToCopy() + "\\default\\";

            if (template.NetLanguageId != null && !isReplayAction)
            {
                if (bllObject.IsGenericType)
                {
                    format.CodeBehind = ReadFileAsString(string.Format("{0}generic_code_{1}.txt", pathToCopy, netLanguagePrefix));
                }

                else if (bllObject.IsObjectContainerType)
                {
                    format.CodeBehind = ReadFileAsString(string.Format("{0}container_code_{1}.txt", pathToCopy, netLanguagePrefix));
                    format.FormatBody = ReadFileAsString(string.Format("{0}container_presentation.txt", pathToCopy));
                }
            }
            format = FormatRepository.SaveObjectFormatProperties(format);

            bllObject.DefaultFormatId = format.Id;
            ObjectRepository.UpdateDefaultFormatId(bllObject.Id, format.Id);

            return(format.Id);
        }
Exemplo n.º 28
0
        private static void ManageTemplateSearchItemsDescription(IEnumerable <PageTemplateSearchListItem> data, string filter)
        {
            if (string.IsNullOrWhiteSpace(filter))
            {
                return;
            }

            foreach (var item in data)
            {
                var template = PageTemplateRepository.GetPageTemplatePropertiesById(item.Id);
                if (!string.IsNullOrWhiteSpace(template.CodeBehind) && template.CodeBehind.Contains(filter))
                {
                    item.Description = FoundTextMarker.GetSimpleRelevantMarkedText(WebUtility.HtmlEncode(template.CodeBehind), filter, 20, "<span class='seachResultHighlight'>", "</span>");
                    continue;
                }

                if (!string.IsNullOrWhiteSpace(template.TemplateBody) && template.TemplateBody.Contains(filter))
                {
                    item.Description = FoundTextMarker.GetSimpleRelevantMarkedText(WebUtility.HtmlEncode(template.TemplateBody), filter, 20, "<span class='seachResultHighlight'>", "</span>");
                }
            }
        }
Exemplo n.º 29
0
        public MessageResult RemoveObjectFormat(int id, bool pageOrTemplate)
        {
            var format = ObjectFormatRepository.ReadObjectFormat(id, pageOrTemplate);

            if (format == null)
            {
                throw new ApplicationException(string.Format(TemplateStrings.FormatNotFound, id));
            }

            if (format.LockedByAnyoneElse)
            {
                return(MessageResult.Error(string.Format(TemplateStrings.LockedByAnyoneElse, format.LockedByDisplayName)));
            }
            if (format.Notifications.Any())
            {
                return(MessageResult.Error(TemplateStrings.UnableToDeleteFormat));
            }

            ManagePageAndObjectModified(format);
            PageTemplateRepository.DeleteObjectFormat(id);
            return(null);
        }
Exemplo n.º 30
0
        private Container InitContainer()
        {
            if (IsObjectContainerType)
            {
                var container = PageTemplateRepository.GetContainerByObjectId(Id) ?? new Container {
                    ObjectId = Id, ContentId = null
                };
                if (container.ContentId != null)
                {
                    container.AdditionalDataForAggregationList = new Dictionary <string, string>
                    {
                        {
                            "fields", string.Join(",", ServiceField.CreateAll().Select(f => f.ColumnName)
                                                  .Concat(container.Content.Fields.Select(x => x.Name)))
                        },
                        { "orders", TemplateStrings.Ascending + "," + TemplateStrings.Descending }
                    };
                }
                container.AllowDynamicContentChanging = !string.IsNullOrWhiteSpace(container.DynamicContentVariable);
                if (!container.ApplySecurity)
                {
                    container.UseLevelFiltration = false;
                    container.StartLevel         = EntityPermissionLevel.GetList().Id;
                    container.EndLevel           = EntityPermissionLevel.GetFullAccess().Id;
                }
                return(container);
            }

            return(new Container
            {
                UseLevelFiltration = false,
                AdditionalDataForAggregationList =
                    new Dictionary <string, string>
                {
                    { "fields", string.Join(",", ServiceField.CreateAll().Select(f => f.ColumnName)) },
                    { "orders", TemplateStrings.Ascending + "," + TemplateStrings.Descending }
                }
            });
        }
Exemplo n.º 31
0
 public PageTemplate ReadTemplateProperties(int templateId) => PageTemplateRepository.GetPageTemplatePropertiesById(templateId);
Exemplo n.º 32
0
 public static NetLanguage GetcSharp() => PageTemplateRepository.GetNetLanguageByName(CSharp);
Exemplo n.º 33
0
 public PageTemplateLogServices(PXHotelEntities entities)
 {
     _localizedResourceServices = HostContainer.GetInstance<ILocalizedResourceServices>();
     _pageTemplateLogRepository = new PageTemplateLogRepository(entities);
     _pageTemplateRepository = new PageTemplateRepository(entities);
 }