public AgreementGridSpec(FirmaSession currentFirmaSession) { var hasAgreementDeletePermission = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); if (hasAgreementDeletePermission) { Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteAgreementUrl(), x.AgreementCanBeDeleted()), 30); } // AgreementNumber Add(FieldDefinitionEnum.AgreementNumber.ToType().ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.GetDisplayName()), 100, DhtmlxGridColumnFilterType.Html); // Projects Add(FieldDefinitionEnum.Project.ToType().ToGridHeaderStringPlural(), a => GetProjectHrefsString(a), 300, DhtmlxGridColumnFilterType.Html); if (new ObligationViewFeature().HasPermissionByFirmaSession(currentFirmaSession)) { // Obligations Add(FieldDefinitionEnum.Obligation.ToType().ToGridHeaderStringPlural(), a => GetObligationHrefsString(a), 300, DhtmlxGridColumnFilterType.Html); } // Organization info Add(FieldDefinitionEnum.Organization.ToType().ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.Organization?.GetDetailUrl(), a.Organization?.GetDisplayName()), 300); Add(FieldDefinitionEnum.OrganizationType.ToType().ToGridHeaderString(), a => a.Organization?.OrganizationType?.OrganizationTypeName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict); // Contract Type Add(FieldDefinitionEnum.ContractType.ToType().ToGridHeaderString(), a => a.ContractType.ContractTypeDisplayName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict); Add($"# of {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabelPluralized()}", a => a.AgreementCostAuthorities.Count, 80); }
public PerformanceMeasureChartViewData(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure, int height, FirmaSession currentFirmaSession, bool showLastUpdatedDate, bool fromPerformanceMeasureDetailPage, List<ProjectFirmaModels.Models.Project> projects, string chartUniqueName, ProjectFirmaModels.Models.GeospatialArea geospatialArea) { PerformanceMeasure = performanceMeasure; HyperlinkPerformanceMeasureName = !fromPerformanceMeasureDetailPage; GoogleChartJsons = performanceMeasure.GetGoogleChartJsonDictionary(geospatialArea, projects, chartUniqueName); var performanceMeasureActuals = PerformanceMeasure.PerformanceMeasureActuals.Where(x => projects.Contains(x.Project)).ToList(); ChartTotal = performanceMeasureActuals.Any() ? performanceMeasureActuals.Sum(x => x.ActualValue) : (double?) null; ChartTotalFormatted = PerformanceMeasure.MeasurementUnitType.DisplayValue(ChartTotal); var currentPersonHasManagePermission = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); CanManagePerformanceMeasures = currentPersonHasManagePermission && fromPerformanceMeasureDetailPage; ShowLastUpdatedDate = showLastUpdatedDate; ChartTitle = performanceMeasure.GetDisplayName(); ViewGoogleChartViewData = new ViewGoogleChartViewData(GoogleChartJsons, ChartTitle, height, null, chartUniqueName, CanManagePerformanceMeasures, SitkaRoute<GoogleChartController>.BuildUrlFromExpression(c => c.DownloadPerformanceMeasureChartData()), true, true, performanceMeasure, HyperlinkPerformanceMeasureName); }
private PartialViewResult ViewEditBasics(EditBasicsViewModel viewModel) { var adminFeature = new FirmaAdminFeature(); var viewData = new EditBasicsViewData(CurrentFirmaSession); return(RazorPartialView <EditBasics, EditBasicsViewData, EditBasicsViewModel>(viewData, viewModel)); }
public ManageViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage neptunePage) : base(currentFirmaSession, neptunePage) { var fieldDefinitionLabelProject = FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel(); var fieldDefinitionForStatus = FieldDefinitionEnum.Status.ToType(); var statusLabelPluralized = fieldDefinitionForStatus.GetFieldDefinitionLabel() .Equals("Status", StringComparison.InvariantCultureIgnoreCase) ? "Statuses" : fieldDefinitionForStatus.GetFieldDefinitionLabelPluralized(); EntityName = $"{fieldDefinitionLabelProject} {fieldDefinitionForStatus.GetFieldDefinitionLabel()}"; PageTitle = $"{fieldDefinitionLabelProject} {statusLabelPluralized}"; NewProjectStatusUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(t => t.New()); GridSpec = new ProjectStatusGridSpec() { ObjectNameSingular = "Attribute Type", ObjectNamePlural = "Attribute Types", SaveFiltersInCookie = true }; GridName = "projectStatusGrid"; GridDataUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(x => x.ProjectStatusGridJsonData()); EditSortOrderUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(x => x.EditSortOrder()); HasManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); }
public ViewResult Detail(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var canManagePerformanceMeasure = new PerformanceMeasureManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var isAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var performanceMeasureChartViewData = new PerformanceMeasureChartViewData(performanceMeasure, CurrentFirmaSession, false, canManagePerformanceMeasure, performanceMeasure.GetAssociatedProjectsWithReportedValues(CurrentFirmaSession)); // Avoid scrolling the legend if it can be displayed on two lines performanceMeasureChartViewData.ViewGoogleChartViewData.GoogleChartJsons.ForEach(x => { if (x.GoogleChartConfiguration.Legend != null && x.GoogleChartConfiguration.Legend.MaxLines == null) { x.GoogleChartConfiguration.Legend.MaxLines = 2; } }); var entityNotesViewData = new EntityNotesViewData( EntityNote.CreateFromEntityNote(performanceMeasure.PerformanceMeasureNotes), SitkaRoute <PerformanceMeasureNoteController> .BuildUrlFromExpression(c => c.New(performanceMeasure.PrimaryKey)), performanceMeasure.PerformanceMeasureDisplayName, canManagePerformanceMeasure); var viewData = new DetailViewData(CurrentFirmaSession, performanceMeasure, performanceMeasureChartViewData, entityNotesViewData, canManagePerformanceMeasure, isAdmin); return(RazorView <Detail, DetailViewData>(viewData)); }
public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Classification classification, ProjectLocationsMapViewData projectLocationsMapViewData, ProjectLocationsMapInitJson projectLocationsMapInitJson, ViewGoogleChartViewData viewGoogleChartViewData, List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures, List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession) { Classification = classification; ProjectLocationsMapViewData = projectLocationsMapViewData; ProjectLocationsMapInitJson = projectLocationsMapInitJson; ViewGoogleChartViewData = viewGoogleChartViewData; PageTitle = ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(classification.ClassificationSystem); EditClassificationUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(c => c.Edit(classification)); IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.ClassificationSystem(classification.ClassificationSystem)); UserHasClassificationManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); ClassificationDisplayNamePluralized = ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(classification.ClassificationSystem); ClassificationDisplayName = classification.ClassificationSystem.ClassificationSystemName; var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID); ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectCustomDefaultGridName = "classificationProjectListGrid"; ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.ClassificationProjectsGridJsonData(classification)); PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => classification.GetPerformanceMeasureChartViewData(x, CurrentFirmaSession)).ToList(); }
public UserProjectGridSpec(FirmaSession currentFirmaSession, Person person) { var userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); Add(string.Empty, x => UrlTemplate.MakeHrefString(x.GetFactSheetUrl(), FirmaDhtmlxGridHtmlHelpers.FactSheetIcon.ToString()), 30, DhtmlxGridColumnFilterType.None); Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html); Add($"Contact Type(s)", x => string.Join(", ", person.GetListOfContactTypeStringsForProject(x)), 300, DhtmlxGridColumnFilterType.Html); if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()) { Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); } Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetPlanningDesignStartYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetImplementationStartYear(x), 115, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetCompletionYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.FundingType.ToType().ToGridHeaderString(), x => x.FundingType?.FundingTypeDisplayName ?? string.Empty, 300, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 110, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); Add(FieldDefinitionEnum.ProjectedFunding.ToType().ToGridHeaderString(), x => x.GetProjectedFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(), x => x.GetNoFundingSourceIdentifiedAmount(), 110, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); foreach (var geospatialAreaType in new List <GeospatialAreaType>()) { Add($"{geospatialAreaType.GeospatialAreaTypeNamePluralized}", a => a.GetProjectGeospatialAreaNamesAsHyperlinks(geospatialAreaType), 350, DhtmlxGridColumnFilterType.Html); } Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 300); if (userHasTagManagePermissions) { Add("Tags", x => new HtmlString(!x.ProjectTags.Any() ? string.Empty : string.Join(", ", x.ProjectTags.Select(pt => pt.Tag.GetDisplayNameAsUrl()))), 100, DhtmlxGridColumnFilterType.Html); } }
public ProjectIndexGridSpec(Person currentPerson , bool allowTaggingFunctionality , bool allowDeleteFunctionality , Dictionary <int, vTotalTreatedAcresByProject> totalTreatedAcresByProjectDictionary , Dictionary <int, List <Models.Program> > programsByProject) { var userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByPerson(currentPerson); var userHasDeletePermissions = new ProjectDeleteFeature().HasPermissionByPerson(currentPerson); if (userHasTagManagePermissions && allowTaggingFunctionality) { BulkTagModalDialogForm = new BulkTagModalDialogForm(SitkaRoute <TagController> .BuildUrlFromExpression(x => x.BulkTagProjects(null)), $"Tag Checked {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", $"Tag {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}"); AddCheckBoxColumn(); Add("ProjectID", x => x.ProjectID, 0); } if (userHasDeletePermissions && allowDeleteFunctionality) { Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true, true), 30, DhtmlxGridColumnFilterType.None); } Add(string.Empty, x => MakeFactSheetUrl(x), 30, DhtmlxGridColumnFilterType.None); Add(Models.FieldDefinition.FhtProjectNumber.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.FhtProjectNumber), 100, DhtmlxGridColumnFilterType.Text); Add(Models.FieldDefinition.ProjectName.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 200, DhtmlxGridColumnFilterType.Html); Add(Models.FieldDefinition.ProjectType.ToGridHeaderString(), x => x.ProjectType.DisplayName, 120, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.ProjectStage.ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.ProjectTotalCompletedTreatmentAcres.ToGridHeaderString(), x => TotalTreatedAcres(x, totalTreatedAcresByProjectDictionary), 100, DhtmlxGridColumnFormatType.Decimal); Add($"{MultiTenantHelpers.GetIsPrimaryContactOrganizationRelationship().RelationshipTypeName} Organization", x => x.GetPrimaryContactOrganization()?.DisplayName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.Program.ToGridHeaderStringPlural("Programs"), x => Program(x, programsByProject), 90, DhtmlxGridColumnFilterType.Html); Add($"Associated {Models.FieldDefinition.PriorityLandscape.ToGridHeaderString()}", x => x.ProjectPriorityLandscapes.FirstOrDefault()?.PriorityLandscape?.DisplayName, 125, DhtmlxGridColumnFilterType.SelectFilterStrict); }
public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Evaluation evaluation) : base(currentFirmaSession) { Evaluation = evaluation; PageTitle = evaluation.EvaluationName; UserHasEvaluationManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); IndexUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(x => x.Index()); EditEvaluationUrl = evaluation.GetEditUrl(); EvaluationCriteriaGridSpec = new EvaluationCriteriaGridSpec(currentFirmaSession) { ObjectNameSingular = FieldDefinitionEnum.Evaluation.ToType().GetFieldDefinitionLabel(), ObjectNamePlural = FieldDefinitionEnum.Evaluation.ToType().GetFieldDefinitionLabelPluralized(), SaveFiltersInCookie = true }; EvaluationCriteriaGridName = "evaluationCriteriaGrid"; EvaluationCriteriaGridDataUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(tc => tc.EvaluationCriteriaGridJsonData(evaluation.EvaluationID)); NewEvaluationCriteriaUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(tc => tc.NewEvaluationCriteria(evaluation)); AddProjectEvaluationUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(ec => ec.AddProjectEvaluation(evaluation)); EvaluationPortfolioGridSpec = new EvaluationPortfolioGridSpec(currentFirmaSession, evaluation) { ObjectNameSingular = FieldDefinitionEnum.EvaluationPortfolio.ToType().GetFieldDefinitionLabel(), ObjectNamePlural = FieldDefinitionEnum.EvaluationPortfolio.ToType().GetFieldDefinitionLabelPluralized(), SaveFiltersInCookie = true }; EvaluationPortfolioGridName = "evaluationPortfolioGrid"; EvaluationPortfolioGridDataUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(tc => tc.EvaluationPortfolioGridJsonData(evaluation.EvaluationID)); }
public BasicProjectInfoGridSpec(Person currentPerson, bool allowTaggingFunctionality) { var userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByPerson(currentPerson); if (userHasTagManagePermissions && allowTaggingFunctionality) { BulkTagModalDialogForm = new BulkTagModalDialogForm(SitkaRoute <TagController> .BuildUrlFromExpression(x => x.BulkTagProjects(null)), $"Tag Checked {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", $"Tag {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}"); AddCheckBoxColumn(); Add("ProjectID", x => x.ProjectID, 0); } Add(string.Empty, x => UrlTemplate.MakeHrefString(x.GetFactSheetUrl(), FirmaDhtmlxGridHtmlHelpers.FactSheetIcon.ToString()), 30, DhtmlxGridColumnFilterType.None); Add(Models.FieldDefinition.FhtProjectNumber.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.FhtProjectNumber), 100, DhtmlxGridColumnFilterType.Text); Add(Models.FieldDefinition.ProjectName.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html); if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()) { Add(Models.FieldDefinition.ProjectsStewardOrganizationRelationshipToProject.ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); } Add(Models.FieldDefinition.PrimaryContactOrganization.ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); Add(Models.FieldDefinition.ProjectStage.ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.ProjectInitiationDate.ToGridHeaderString(), x => x.GetPlannedDate(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.ExpirationDate.ToGridHeaderString(), x => x.GetExpirationDateFormatted(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.CompletionDate.ToGridHeaderString(), x => x.GetCompletionDateFormatted(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.EstimatedTotalCost.ToGridHeaderString(), x => x.EstimatedTotalCost, 110, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total); Add(Models.FieldDefinition.ProjectGrantAllocationRequestTotalAmount.ToGridHeaderString(), x => x.GetTotalFunding(), 110, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total); Add(Models.FieldDefinition.ProjectDescription.ToGridHeaderString(), x => x.ProjectDescription, 300); if (userHasTagManagePermissions) { Add("Tags", x => new HtmlString(!x.ProjectTags.Any() ? string.Empty : string.Join(", ", x.ProjectTags.Select(pt => pt.Tag.DisplayNameAsUrl))), 100, DhtmlxGridColumnFilterType.Html); } }
public ViewResult AgreementDetail(AgreementPrimaryKey agreementPrimaryKey) { var userHasAgreementAdminPermissions = new FirmaAdminFeature().HasPermissionByPerson(CurrentPerson); var agreement = agreementPrimaryKey.EntityObject; var viewData = new DetailViewData(CurrentPerson, agreement, userHasAgreementAdminPermissions); return(RazorView <Detail, DetailViewData>(viewData)); }
public DetailViewData(FirmaSession currentFirmaSession, Person personToView, Project.UserProjectGridSpec userProjectGridSpec, string basicProjectInfoGridName, string basicProjectInfoGridDataUrl, UserNotificationGridSpec userNotificationGridSpec, string userNotificationGridName, string userNotificationGridDataUrl, string activateInactivateUrl, ActionItemsUserGridSpec actionItemsUserGridSpec, string actionItemsGridName, string actionItemsGridDataUrl) : base(currentFirmaSession) { Person = personToView; PageTitle = personToView.GetFullNameFirstLast() + (!personToView.IsActive ? " (inactive)" : string.Empty); EntityName = "User"; EditPersonOrganizationPrimaryContactUrl = SitkaRoute <PersonOrganizationController> .BuildUrlFromExpression(c => c.EditPersonOrganizationPrimaryContacts(personToView)); IndexUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index()); if (FirmaWebConfiguration.AuthenticationType == AuthenticationType.LocalAuth) { EditDetailBasicsUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.EditUser(personToView.PrimaryKey)); ChangePasswordUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.ChangePassword(personToView.PrimaryKey)); } // And again, here we should take Current FirmaSession, not the person. -- SLG & SG UserHasPersonViewPermissions = new UserViewFeature().HasPermission(currentFirmaSession, personToView).HasPermission; UserHasPersonManagePermissions = new UserEditFeature().HasPermissionByFirmaSession(currentFirmaSession); UserHasAdminPermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); CurrentPersonCanBeImpersonatedByCurrentUser = new FirmaImpersonateUserFeature().HasPermission(currentFirmaSession, personToView).HasPermission; IsViewingSelf = !currentFirmaSession.IsAnonymousUser() && currentFirmaSession.PersonID == personToView.PersonID; EditRolesLink = UserHasAdminPermissions ? ModalDialogFormHelper.MakeEditIconLink(SitkaRoute <UserController> .BuildUrlFromExpression(c => c.EditRoles(personToView)), $"Edit Roles for User - {personToView.GetFullNameFirstLast()}", true) : new HtmlString(string.Empty); UserProjectGridSpec = userProjectGridSpec; BasicProjectInfoGridName = basicProjectInfoGridName; BasicProjectInfoGridDataUrl = basicProjectInfoGridDataUrl; UserNotificationGridSpec = userNotificationGridSpec; UserNotificationGridName = userNotificationGridName; UserNotificationGridDataUrl = userNotificationGridDataUrl; ActivateInactivateUrl = activateInactivateUrl; TenantHasStewardshipAreas = MultiTenantHelpers.GetProjectStewardshipAreaType() != null; ActionItemsUserGridSpec = actionItemsUserGridSpec; ActionItemsGridName = actionItemsGridName; ActionItemsGridDataUrl = actionItemsGridDataUrl; }
public GridJsonNetJObjectResult <vSocrataDataMartRawJsonImportIndex> JobIndexGridJsonData() { var hasJobDeletePermissions = new FirmaAdminFeature().HasPermissionByPerson(CurrentPerson); var gridSpec = new JobIndexGridSpec(hasJobDeletePermissions); var priorJobs = HttpRequestStorage.DatabaseEntities.vSocrataDataMartRawJsonImportIndices.OrderBy(x => x.CreateDate).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <vSocrataDataMartRawJsonImportIndex>(priorJobs, gridSpec); return(gridJsonNetJObjectResult); }
public GridJsonNetJObjectResult <Solicitation> IndexGridJsonData() { var hasSolicitationEditPermission = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var gridSpec = new IndexGridSpec(hasSolicitationEditPermission); var solicitations = HttpRequestStorage.DatabaseEntities.Solicitations.OrderBy(x => x.SolicitationName).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Solicitation>(solicitations, gridSpec); return(gridJsonNetJObjectResult); }
public GridJsonNetJObjectResult <Tag> IndexGridJsonData() { var hasTagDeletePermission = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var gridSpec = new IndexGridSpec(hasTagDeletePermission); var tags = HttpRequestStorage.DatabaseEntities.Tags.OrderBy(x => x.TagName).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Tag>(tags, gridSpec); return(gridJsonNetJObjectResult); }
public GridJsonNetJObjectResult <GeospatialAreaType> GeospatialAreaMapLayerGridJsonData() { var userCanManage = new FirmaAdminFeature().HasPermission(CurrentFirmaSession).HasPermission; var gridSpec = new GeospatialAreaMapLayerGridSpec(userCanManage); var geospatialAreaTypes = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.OrderBy(x => x.GeospatialAreaTypeNamePluralized).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <GeospatialAreaType>(geospatialAreaTypes, gridSpec); return(gridJsonNetJObjectResult); }
public GridJsonNetJObjectResult <ExternalMapLayer> ExternalMapLayerGridJsonData() { var userCanManage = new FirmaAdminFeature().HasPermission(CurrentFirmaSession).HasPermission; var gridSpec = new ExternalMapLayerGridSpec(userCanManage); var externalMapLayers = HttpRequestStorage.DatabaseEntities.ExternalMapLayers.OrderBy(x => x.DisplayName).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ExternalMapLayer>(externalMapLayers, gridSpec); return(gridJsonNetJObjectResult); }
/* * public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; } * public string ObligationItemBudgetGridName { get; } * public string ObligationItemBudgetGridDataUrl { get; } */ public CostAuthorityDetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.CostAuthority costAuthority) : base(currentFirmaSession) { CostAuthority = costAuthority; PageTitle = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()}: {costAuthority.CostAuthorityWorkBreakdownStructure}"; EntityName = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} Detail"; UserHasCostAuthorityManagePermissions = new CostAuthorityManageFeature().HasPermissionByPerson(CurrentPerson); IsAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); IndexUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(ca => ca.CostAuthorityIndex()); AgreementIndexUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(ac => ac.AgreementIndex()); FieldDefinitionForAgreement = FieldDefinitionEnum.Agreement.ToType(); FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType(); FieldDefinitionForCostAuthorityWorkBreakdownStructure = FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType(); BasicProjectInfoProjectGridName = "costAuthorityProjectListGrid"; BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentFirmaSession, true, CostAuthority) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}", SaveFiltersInCookie = true }; BasicProjectInfoProjectGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityProjectsGridJsonData(costAuthority)); AgreementGridName = "costAuthorityAgreementListGrid"; AgreementGridSpec = new AgreementGridSpec(CurrentFirmaSession) { ObjectNameSingular = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}", ObjectNamePlural = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}", SaveFiltersInCookie = true }; AgreementGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityAgreementGridJsonData(costAuthority)); HasPnBudgetViewPermission = new PnBudgetViewFeature().HasPermissionByFirmaSession(currentFirmaSession); PnBudgetGridName = "PnBudgetsGrid"; PnBudgetGridSpec = new PnBudgetGridSpec(currentFirmaSession); PnBudgetGridDataUrl = SitkaRoute <PnBudgetController> .BuildUrlFromExpression(c => c.PnBudgetsForCostAuthorityGridJsonData(costAuthority.CostAuthorityWorkBreakdownStructure)); HasObligationViewPermission = new ObligationViewFeature().HasPermissionByFirmaSession(currentFirmaSession); ContractualInvoiceGridName = "contractualInvoiceGrid"; ContractualInvoiceGridSpec = new ContractualInvoiceGridSpec(currentFirmaSession); ContractualInvoiceGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.ContractualInvoiceGridJsonData(costAuthority)); //ObligationItemBudgetGridName = "obligationItemBudgets"; //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession); //ObligationItemBudgetGridDataUrl = SitkaRoute<CostAuthorityController>.BuildUrlFromExpression(oc => oc.ObligationItemBudgetGridJsonData(costAuthority)); }
public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.ProjectCustomAttributeType projectCustomAttributeType) : base(currentFirmaSession) { ProjectCustomAttributeType = projectCustomAttributeType; EntityName = FieldDefinitionEnum.ProjectCustomAttribute.ToType().GetFieldDefinitionLabelPluralized(); PageTitle = projectCustomAttributeType.ProjectCustomAttributeTypeName; ManageUrl = SitkaRoute <ProjectCustomAttributeTypeController> .BuildUrlFromExpression(c => c.Manage()); UserHasProjectCustomAttributeTypeManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); ProjectTypeGridName = "projectTypeGridForAttribute"; ProjectTypeGridDataUrl = "#"; }
public AgreementDetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Agreement agreement) : base(currentFirmaSession) { PageTitle = $"Agreement Number: {agreement.AgreementNumber}"; EntityName = "Agreement Detail"; Agreement = agreement; UserHasAgreementManagePermissions = new AgreementManageFeature().HasPermissionByPerson(CurrentPerson); IsAdmin = new FirmaAdminFeature().HasPermissionByPerson(CurrentPerson); EditAgreementBasicsUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(c => c.EditBasics(agreement)); /* * EditPerformanceMeasureUrl = SitkaRoute<PerformanceMeasureController>.BuildUrlFromExpression(c => c.Edit(performanceMeasure)); * EditSubcategoriesAndOptionsUrl = SitkaRoute<PerformanceMeasureController>.BuildUrlFromExpression(c => c.EditSubcategoriesAndOptions(performanceMeasure)); * * EditCriticalDefinitionsUrl = SitkaRoute<PerformanceMeasureController>.BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions)); * EditProjectReportingUrl = SitkaRoute<PerformanceMeasureController>.BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting)); */ IndexUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(c => c.AgreementIndex()); CostAuthorityIndexUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityIndex()); FieldDefinitionForAgreement = FieldDefinitionEnum.Agreement.ToType(); FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType(); FieldDefinitionForCostAuthorityWorkBreakdownStructure = FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType(); /* Basic Project Info */ BasicProjectInfoProjectGridName = "agreementProjectListGrid"; BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(currentFirmaSession, true, agreement) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} associated with Agreement Number {agreement.AgreementNumber}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with Agreement Number {agreement.AgreementNumber}", SaveFiltersInCookie = true }; BasicProjectInfoProjectGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(tc => tc.AgreementProjectsGridJsonData(agreement)); /* Cost Authority */ BasicCostAuthorityGridName = "costAuthorityAgreementListGrid"; BasicCostAuthorityGridSpec = new BasicCostAuthorityGridSpec(CurrentPerson) { ObjectNameSingular = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} {agreement.AgreementNumber}", ObjectNamePlural = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} {agreement.AgreementNumber}", SaveFiltersInCookie = true }; BasicCostAuthorityGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(ac => ac.AgreementCostAuthorityGridJsonData(agreement)); }
public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, string gridDataUrl, List <SelectListItem> activeOnlyOrAllUsersSelectListItems) : base(currentFirmaSession, firmaPage) { PageTitle = "Users"; GridSpec = new IndexGridSpec(currentFirmaSession) { ObjectNameSingular = "User", ObjectNamePlural = "Users", SaveFiltersInCookie = true }; GridName = "UserGrid"; GridDataUrl = gridDataUrl; InviteUserUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Invite()); UserIsFirmaAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); ActiveOnlyOrAllUsersSelectListItems = activeOnlyOrAllUsersSelectListItems; ShowOnlyActiveOrAll = "ShowOnlyActiveOrAll"; }
public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage) { PageTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Tags"; var hasTagManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); GridSpec = new TagIndexGridSpec(hasTagManagePermissions) { ObjectNameSingular = "Tag", ObjectNamePlural = "Tags", SaveFiltersInCookie = true }; GridName = "TagsGrid"; GridDataUrl = SitkaRoute <TagController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData()); HasTagManagePermissions = hasTagManagePermissions; NewUrl = SitkaRoute <TagController> .BuildUrlFromExpression(t => t.New()); }
public ViewResult Index() { var externalMapLayersFirmaPage = FirmaPageTypeEnum.ExternalMapLayers.GetFirmaPage(); var externalMapLayerGridDataUrl = SitkaRoute <MapLayerController> .BuildUrlFromExpression(x => x.ExternalMapLayerGridJsonData()); var internalMapLayersFirmaPage = FirmaPageTypeEnum.InternalMapLayers.GetFirmaPage(); var externallySourcedGeospatialAreasInstructionsFirmaPage = FirmaPageTypeEnum.ExternallySourcedGeospatialAreasInstructions.GetFirmaPage(); var geospatialAreaMapLayerGridDataUrl = SitkaRoute <MapLayerController> .BuildUrlFromExpression(x => x.GeospatialAreaMapLayerGridJsonData()); var userCanManage = new FirmaAdminFeature().HasPermission(CurrentFirmaSession).HasPermission; var viewData = new IndexViewData(CurrentFirmaSession, externalMapLayersFirmaPage, externalMapLayerGridDataUrl, internalMapLayersFirmaPage, geospatialAreaMapLayerGridDataUrl, externallySourcedGeospatialAreasInstructionsFirmaPage, userCanManage); return(RazorView <Index, IndexViewData>(viewData)); }
public ProjectCustomGridSpec(FirmaSession currentFirmaSession, List <ProjectCustomGridConfiguration> projectCustomGridConfigurations, ProjectCustomGridTypeEnum projectCustomGridTypeEnum, Dictionary <int, vProjectDetail> projectDetailsDictionary, ProjectFirmaModels.Models.Tenant tenant) { bool userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); bool userHasDeletePermissions = new ProjectDeleteFeature().HasPermissionByFirmaSession(currentFirmaSession); bool userHasEditProjectAsAdminPermissions = new ProjectEditAsAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); bool userHasReportDownloadPermissions = new ReportTemplateGenerateReportsFeature().HasPermissionByFirmaSession(currentFirmaSession); var geospatialAreas = HttpRequestStorage.DatabaseEntities.vGeospatialAreas.Where(x => x.TenantID == tenant.TenantID).ToDictionary(x => x.GeospatialAreaID); var projectCustomAttributes = HttpRequestStorage.DatabaseEntities.vProjectCustomAttributeValues.Where(x => x.TenantID == tenant.TenantID) .GroupBy(x => x.ProjectID) .ToDictionary(grp => grp.Key, y => y.ToList()); var projectGeospatialAreas = HttpRequestStorage.DatabaseEntities.ProjectGeospatialAreas .GroupBy(x => x.ProjectID).ToDictionary(grp => grp.Key, y => y.ToList()); var taxonomyLeafs = HttpRequestStorage.DatabaseEntities.TaxonomyLeafs.ToDictionary(x => x.TaxonomyLeafID); var projectLabel = FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel(); bool hasProjectApprovalPermissionBySession = new ProjectApproveFeature().HasPermissionByFirmaSession(currentFirmaSession); var statusUpdateLabel = FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel(); var sitkaAdminPersonIDs = HttpRequestStorage.DatabaseEntities.AllPeople.Where(x => x.RoleID == ProjectFirmaModels.Models.Role.SitkaAdmin.RoleID).Select(x => x.PersonID).ToList(); // Mandatory fields before AddMandatoryFieldsBefore(userHasTagManagePermissions, userHasReportDownloadPermissions, userHasDeletePermissions, projectCustomGridTypeEnum); // Implement configured fields here AddConfiguredFields(currentFirmaSession , projectCustomGridConfigurations , userHasEditProjectAsAdminPermissions , projectDetailsDictionary , geospatialAreas , taxonomyLeafs , projectGeospatialAreas , projectCustomAttributes , projectLabel , hasProjectApprovalPermissionBySession , statusUpdateLabel , sitkaAdminPersonIDs); // Mandatory fields appearing AFTER configurable fields AddMandatoryFieldsAfter(userHasTagManagePermissions); }
private PartialViewResult ViewEditBasics(EditBasicsViewModel viewModel) { var adminFeature = new FirmaAdminFeature(); var tenantPeople = HttpRequestStorage.DatabaseEntities.People.ToList().Where(x => adminFeature.HasPermissionByPerson(x)).ToSelectListWithEmptyFirstRow(x => x.PersonID.ToString(CultureInfo.InvariantCulture), x => x.GetFullNameFirstLast()); var taxonomyLevels = TaxonomyLevel.All.ToSelectListWithEmptyFirstRow(x => x.TaxonomyLevelID.ToString(CultureInfo.InvariantCulture), x => x.TaxonomyLevelDisplayName); var budgetTypeID = viewModel.BudgetTypeID; var budgetTypes = BudgetType.All.ToDictionary(x => x.BudgetTypeID, x => x.BudgetTypeDisplayName); var disabledBudgetTypeValues = new List <int>() { BudgetType.NoBudget.BudgetTypeID, BudgetType.AnnualBudget.BudgetTypeID }; var costTypes = HttpRequestStorage.DatabaseEntities.CostTypes.Select(x => x.CostTypeName).ToList(); // if any projects exist that are not ProjectType.Normal we do not want them to be able to turn off Enable Project Type checkbox bool canEditEnableProjectTypeCheckbox = !HttpRequestStorage.DatabaseEntities.Projects.Any(x => x.ProjectCategoryID != (int)ProjectCategoryEnum.Normal); var viewData = new EditBasicsViewData(CurrentFirmaSession, tenantPeople, taxonomyLevels, budgetTypeID, budgetTypes, disabledBudgetTypeValues, costTypes, canEditEnableProjectTypeCheckbox); return(RazorPartialView <EditBasics, EditBasicsViewData, EditBasicsViewModel>(viewData, viewModel)); }
//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)); }
public ProjectForTaxonomyLeafGridSpec(FirmaSession currentFirmaSession, bool allowTaggingFunctionality, ProjectFirmaModels.Models.TaxonomyLeaf taxonomyLeaf) { var userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); if (userHasTagManagePermissions && allowTaggingFunctionality) { BulkTagModalDialogForm = new BulkTagModalDialogForm(SitkaRoute <TagController> .BuildUrlFromExpression(x => x.BulkTagProjects(null)), $"Tag Checked {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", $"Tag {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}"); AddCheckBoxColumn(); Add("ProjectID", x => x.ProjectID, 0); } Add(string.Empty, x => UrlTemplate.MakeHrefString(x.GetFactSheetUrl(), FirmaDhtmlxGridHtmlHelpers.FactSheetIcon.ToString()), 30, DhtmlxGridColumnFilterType.None); Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html); if (MultiTenantHelpers.GetTenantAttributeFromCache().EnableSecondaryProjectTaxonomyLeaf) { Add($"Relationship to {FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel()}", x => x.GetTaxonomyLeaf().TaxonomyLeafID == taxonomyLeaf.TaxonomyLeafID ? "Primary" : "Secondary", 100, DhtmlxGridColumnFilterType.SelectFilterStrict); } if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()) { Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); } Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => x.GetPlanningDesignStartYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => x.GetImplementationStartYear(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => x.GetCompletionYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.FundingType.ToType().ToGridHeaderString(), x => x.FundingType?.FundingTypeDisplayName, 300, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 110, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); Add(FieldDefinitionEnum.ProjectedFunding.ToType().ToGridHeaderString(), x => x.GetProjectedFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(), x => x.GetNoFundingSourceIdentifiedAmount(), 110, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); foreach (var geospatialAreaType in new List <GeospatialAreaType>()) { Add($"{geospatialAreaType.GeospatialAreaTypeNamePluralized}", a => a.GetProjectGeospatialAreaNamesAsHyperlinks(geospatialAreaType), 350, DhtmlxGridColumnFilterType.Html); } Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 300); if (userHasTagManagePermissions) { Add("Tags", x => new HtmlString(!x.ProjectTags.Any() ? string.Empty : string.Join(", ", x.ProjectTags.Select(pt => pt.Tag.GetDisplayNameAsUrl()))), 100, DhtmlxGridColumnFilterType.Html); } }
public JobIndexViewData(Person currentPerson, Models.FirmaPage firmaPage) : base(currentPerson, firmaPage) { PageTitle = "Socrata Import Jobs"; var hasTagManagePermissions = new FirmaAdminFeature().HasPermissionByPerson(currentPerson); GridSpec = new JobIndexGridSpec(hasTagManagePermissions); if (hasTagManagePermissions) { // Job execution is done with buttons, and, eventually, should be done via Hangfire. //var contentUrl = SitkaRoute<TagController>.BuildUrlFromExpression(t => t.New()); //GridSpec.CreateEntityModalDialogForm = new ModalDialogForm(contentUrl, "Create a new Tag"); } GridName = "SocrataJobsGrid"; GridDataUrl = SitkaRoute <JobController> .BuildUrlFromExpression(tc => tc.JobIndexGridJsonData()); }
public ViewResult ManageHomePageImages() { var canAddPhotos = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var firmaHomePageImages = HttpRequestStorage.DatabaseEntities.FirmaHomePageImages.ToList().Select(x => new FileResourcePhoto(x)).ToList(); var addNewPhotoUrl = SitkaRoute <FirmaHomePageImageController> .BuildUrlFromExpression(x => x.New()); var imageGalleryViewData = new ImageGalleryViewData(CurrentFirmaSession, "HomePageImagesGallery", firmaHomePageImages, canAddPhotos, addNewPhotoUrl, null, true, x => x.CaptionOnFullView, "Photo"); var viewData = new ManageHomePageImagesViewData(CurrentFirmaSession, imageGalleryViewData, canAddPhotos); return(RazorView <ManageHomePageImages, ManageHomePageImagesViewData>(viewData)); }
private static ImageGalleryViewData BuildImageGalleryViewData(Person currentPerson) { var userCanAddPhotosToHomePage = new FirmaAdminFeature().HasPermissionByPerson(currentPerson); var newPhotoForProjectUrl = SitkaRoute <FirmaHomePageImageController> .BuildUrlFromExpression(x => x.New()); var galleryName = "HomePageImagesGallery"; var firmaHomePageImages = HttpRequestStorage.DatabaseEntities.FirmaHomePageImages.ToList(); var imageGalleryViewData = new ImageGalleryViewData(currentPerson, galleryName, firmaHomePageImages, userCanAddPhotosToHomePage, newPhotoForProjectUrl, null, true, x => x.CaptionOnFullView, "Photo"); return(imageGalleryViewData); }