コード例 #1
0
        public IndexGridSpec(Person currentPerson)
        {
            var isAnonymousOrUnassigned  = currentPerson.IsAnonymousOrUnassigned();
            var fundingSourceEditFeature = new FundingSourceEditFeature();

            if (fundingSourceEditFeature.HasPermissionByPerson(currentPerson))
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), fundingSourceEditFeature.HasPermission(currentPerson, x).HasPermission, true), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(FieldDefinitionType.FundingSource.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.GetDisplayName()), 320, DhtmlxGridColumnFilterType.Html);
            Add(FieldDefinitionType.Organization.ToGridHeaderString(), a => isAnonymousOrUnassigned ? new HtmlString(a.Organization.GetDisplayName()) : UrlTemplate.MakeHrefString(a.Organization.GetDetailUrl(), a.Organization.GetDisplayName()), 300);
            Add(FieldDefinitionType.OrganizationType.ToGridHeaderString(), a => a.Organization.OrganizationType?.OrganizationTypeName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Description", a => a.FundingSourceDescription, 300);
            Add("Is Active", a => a.IsActive.ToYesNo(), 80, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add($"# of {FieldDefinitionType.TreatmentBMP.GetFieldDefinitionLabelPluralized()}", a => a.GetAssociatedTreatmentBMPs(currentPerson).Count, 90);
        }
コード例 #2
0
ファイル: DetailViewData.cs プロジェクト: sitkatech/alevin
        //public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
        //public string ObligationItemBudgetGridName { get; }
        //public string ObligationItemBudgetGridDataUrl { get; }


        public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FundingSource fundingSource, ViewGoogleChartViewData viewGoogleChartViewData, GridSpec <ProjectFirmaModels.Models.ProjectFundingSourceBudget> projectFundingSourceBudgetGridSpec, DisplayFundingSourceCustomAttributesViewData displayFundingSourceCustomAttributeTypesViewData)
            : base(currentFirmaSession)
        {
            ViewGoogleChartViewData = viewGoogleChartViewData;
            FundingSource           = fundingSource;
            PageTitle  = fundingSource.GetDisplayName();
            EntityName = $"{FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabel()}";
            UserHasFundingSourceManagePermissions = new FundingSourceEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission;
            UserHasFundingSourceCustomAttributeManagePermissions    = new FundingSourceCustomAttributeEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission;
            UserHasProjectFundingSourceExpenditureManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
            EditFundingSourceUrl = fundingSource.GetEditUrl();

            EditFundingSourceCustomAttributesUrl = SitkaRoute <FundingSourceCustomAttributesController> .BuildUrlFromExpression(c => c.EditFundingSourceCustomAttributesForFundingSource(fundingSource));

            var projectFundingSourceExpenditures = FundingSource.ProjectFundingSourceExpenditures.ToList();

            CalendarYearsForProjectExpenditures = projectFundingSourceExpenditures.CalculateCalendarYearRangeForExpenditures(fundingSource);

            ProjectCalendarYearExpendituresGridSpec = new ProjectCalendarYearExpendituresGridSpec(CalendarYearsForProjectExpenditures)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            ProjectCalendarYearExpendituresGridName    = "projectsCalendarYearExpendituresFromFundingSourceGrid";
            ProjectCalendarYearExpendituresGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectCalendarYearExpendituresGridJsonData(fundingSource));

            ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index());

            ProjectFundingSourceBudgetGridSpec    = projectFundingSourceBudgetGridSpec;
            ProjectFundingSourceBudgetGridName    = "projectsFundingSourceRequestsFromFundingSourceGrid";
            ProjectFundingSourceBudgetGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectFundingSourceBudgetGridJsonData(fundingSource));

            DisplayFundingSourceCustomAttributeTypesViewData = displayFundingSourceCustomAttributeTypesViewData;

            ContractualInvoiceGridName    = "fundingSourceContractualInvoicesGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(fc => fc.ContractualInvoiceGridOnFundDetailJsonData(fundingSource));

            //ObligationItemBudgetGridName = "fundingSourceContractualInvoicesGrid";
            //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession);
            //ObligationItemBudgetGridDataUrl = SitkaRoute<FundingSourceController>.BuildUrlFromExpression(fc => fc.ObligationItemBudgetGridOnFundDetailJsonData(fundingSource));
        }