Esempio n. 1
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 }
                }
            });
        }