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

            PageTitle = taxonomyBranchDisplayNamePluralized;

            // if branch is the highest level, let them sort without groups
            OfferEditSortOrder = MultiTenantHelpers.IsTaxonomyLevelBranch();
            // if it is a three tier taxonomy, let them sort grouped by taxonomy trunks
            OfferEditSortOrderInGroup = MultiTenantHelpers.IsTaxonomyLevelTrunk();

            HasTaxonomyBranchManagePermissions = new TaxonomyBranchManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            IsNotTaxonomyLevelLeaf             = !MultiTenantHelpers.IsTaxonomyLevelLeaf();

            var taxonomyBranchDisplayName = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel();

            GridSpec = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = taxonomyBranchDisplayName,
                ObjectNamePlural    = taxonomyBranchDisplayNamePluralized,
                SaveFiltersInCookie = true
            };

            GridName    = "taxonomyBranchesGrid";
            GridDataUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

            NewUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(t => t.New());

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

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

            TaxonomyBranchDisplayName = taxonomyBranchDisplayName;
        }
        public IndexViewData(Person currentPerson, Models.FirmaPage firmaPage) : base(currentPerson, firmaPage)
        {
            var taxonomyBranchDisplayNamePluralized = Models.FieldDefinition.TaxonomyBranch.GetFieldDefinitionLabelPluralized();

            PageTitle = taxonomyBranchDisplayNamePluralized;

            // only let them sort tier two taxonomy if that's the highest level.
            OfferEditSortOrder = MultiTenantHelpers.IsTaxonomyLevelBranch();

            HasTaxonomyBranchManagePermissions = new TaxonomyBranchManageFeature().HasPermissionByPerson(currentPerson);
            var taxonomyBranchDisplayName = Models.FieldDefinition.TaxonomyBranch.GetFieldDefinitionLabel();

            GridSpec = new IndexGridSpec(currentPerson)
            {
                ObjectNameSingular  = taxonomyBranchDisplayName,
                ObjectNamePlural    = taxonomyBranchDisplayNamePluralized,
                SaveFiltersInCookie = true
            };

            if (HasTaxonomyBranchManagePermissions)
            {
                GridSpec.CreateEntityModalDialogForm = new ModalDialogForm(SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(t => t.New()), string.Format("Create a new {0}", taxonomyBranchDisplayName));
            }

            GridName    = "taxonomyBranchesGrid";
            GridDataUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

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