示例#1
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            var taxonomyLeafDisplayNamePluralized = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized();

            PageTitle = taxonomyLeafDisplayNamePluralized;

            // if leaf is the highest level, let them sort without groups
            OfferEditSortOrder = MultiTenantHelpers.IsTaxonomyLevelLeaf();
            // if it is a two or three tier taxonomy, let them sort grouped by taxonomy branches
            OfferEditSortOrderInGroup = !MultiTenantHelpers.IsTaxonomyLevelLeaf();

            var hasTaxonomyLeafManagePermissions = new TaxonomyLeafManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            var taxonomyLeafDisplayName          = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel();

            GridSpec = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = taxonomyLeafDisplayName,
                ObjectNamePlural    = taxonomyLeafDisplayNamePluralized,
                SaveFiltersInCookie = true
            };

            GridName    = "taxonomyLeafsGrid";
            GridDataUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

            EditSortOrderUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(tc => tc.EditSortOrder());

            EditSortOrderInGroupUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(tc => tc.EditSortOrderInGroup());

            HasTaxonomyLeafManagePermissions = hasTaxonomyLeafManagePermissions;
            NewUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(t => t.New());

            TaxonomyLeafDisplayName = taxonomyLeafDisplayName;
        }
示例#2
0
        public GridJsonNetJObjectResult <TaxonomyLeaf> IndexGridJsonData()
        {
            var gridSpec                 = new IndexGridSpec(CurrentFirmaSession);
            var taxonomyLeafs            = HttpRequestStorage.DatabaseEntities.TaxonomyLeafs.ToList().OrderTaxonomyLeaves().ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <TaxonomyLeaf>(taxonomyLeafs, gridSpec);

            return(gridJsonNetJObjectResult);
        }