public void TestCorrectedCostAuthorityString() { // This looks like a real CAWBS string that just needs dots, so should have them added Check.Ensure(CostAuthority.CorrectedCostAuthorityWorkBreakdownStructureString("RX167868203000100") == "RX.16786820.3000100"); // This should just pass through unchanged Check.Ensure(CostAuthority.CorrectedCostAuthorityWorkBreakdownStructureString("bleh.blah.blah") == "bleh.blah.blah"); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public AgreementCostAuthority(Agreement agreement, CostAuthority costAuthority) : this() { // Mark this as a new object by setting primary key with special value this.AgreementCostAuthorityID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.AgreementID = agreement.AgreementID; this.Agreement = agreement; agreement.AgreementCostAuthorities.Add(this); this.CostAuthorityID = costAuthority.CostAuthorityID; this.CostAuthority = costAuthority; costAuthority.AgreementCostAuthorities.Add(this); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public CostAuthorityObligationRequest(CostAuthority costAuthority, ObligationRequest obligationRequest) : this() { // Mark this as a new object by setting primary key with special value this.CostAuthorityObligationRequestID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.CostAuthorityID = costAuthority.CostAuthorityID; this.CostAuthority = costAuthority; costAuthority.CostAuthorityObligationRequests.Add(this); this.ObligationRequestID = obligationRequest.ObligationRequestID; this.ObligationRequest = obligationRequest; obligationRequest.CostAuthorityObligationRequests.Add(this); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public CostAuthorityProject(CostAuthority costAuthority, Project project, bool isPrimaryProjectCawbs) : this() { // Mark this as a new object by setting primary key with special value this.CostAuthorityProjectID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.CostAuthorityID = costAuthority.CostAuthorityID; this.CostAuthority = costAuthority; costAuthority.CostAuthorityProjects.Add(this); this.ProjectID = project.ProjectID; this.Project = project; project.CostAuthorityProjects.Add(this); this.IsPrimaryProjectCawbs = isPrimaryProjectCawbs; }
/* * 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 ProjectAgreementDetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project, bool userHasProjectAgreementManagePermissions /*, List<IFundingSourceBudgetAmount> fundingSourceRequestAmounts*/) : base(currentFirmaSession) { Project = project; UserHasProjectAgreementManagePermissions = userHasProjectAgreementManagePermissions; AddNewAgreementUrl = "NO_URL_YET"; var costAuthorities = project.CostAuthorityProjects.Select(x => x.CostAuthority) .ToList(); ReclamationAgreements = costAuthorities.SelectMany(ca => ca.AgreementCostAuthorities.Select(rarca => rarca.Agreement)).ToList(); SecondaryCostAuthorityWorkBreakdownStructures = project.CostAuthorityProjects.Where(x => !x.IsPrimaryProjectCawbs).Select(rcap => rcap.CostAuthority).ToList(); PrimaryCostAuthorityWorkBreakdownStructure = project.CostAuthorityProjects.SingleOrDefault(x => x.IsPrimaryProjectCawbs)?.CostAuthority; }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static AgreementCostAuthority CreateNewBlank(Agreement agreement, CostAuthority costAuthority) { return(new AgreementCostAuthority(agreement, costAuthority)); }
public static void DeleteCostAuthority(this IQueryable <CostAuthority> costAuthorities, CostAuthority costAuthorityToDelete) { DeleteCostAuthority(costAuthorities, new List <CostAuthority> { costAuthorityToDelete }); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static CostAuthorityProject CreateNewBlank(CostAuthority costAuthority, Project project) { return(new CostAuthorityProject(costAuthority, project, default(bool))); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static WbsElementObligationItemBudget CreateNewBlank(WbsElement wbsElement, ObligationItem obligationItem, CostAuthority costAuthority, FundingSource fundingSource) { return(new WbsElementObligationItemBudget(wbsElement, obligationItem, costAuthority, fundingSource)); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public WbsElementObligationItemBudget(WbsElement wbsElement, ObligationItem obligationItem, CostAuthority costAuthority, FundingSource fundingSource) : this() { // Mark this as a new object by setting primary key with special value this.WbsElementObligationItemBudgetID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.WbsElementID = wbsElement.WbsElementID; this.WbsElement = wbsElement; wbsElement.WbsElementObligationItemBudgets.Add(this); this.ObligationItemID = obligationItem.ObligationItemID; this.ObligationItem = obligationItem; obligationItem.WbsElementObligationItemBudgets.Add(this); this.CostAuthorityID = costAuthority.CostAuthorityID; this.CostAuthority = costAuthority; costAuthority.WbsElementObligationItemBudgets.Add(this); this.FundingSourceID = fundingSource.FundingSourceID; this.FundingSource = fundingSource; fundingSource.WbsElementObligationItemBudgets.Add(this); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static CostAuthorityObligationRequest CreateNewBlank(CostAuthority costAuthority, ObligationRequest obligationRequest) { return(new CostAuthorityObligationRequest(costAuthority, obligationRequest)); }
public CostAuthorityJson(ProjectFirmaModels.Models.CostAuthority costAuthority) { CostAuthorityID = costAuthority.CostAuthorityID; CostAuthorityWorkBreakdownStructure = costAuthority.CostAuthorityWorkBreakdownStructure; AccountStructureDescription = costAuthority.AccountStructureDescription; }
private void BasicProjectInfoGridSpec_Impl(FirmaSession currentFirmaSession, bool allowTaggingFunctionality, ProjectFirmaModels.Models.CostAuthority costAuthorityWorkBreakdownStructure, ProjectFirmaModels.Models.Agreement agreement) { 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 (costAuthorityWorkBreakdownStructure != null) { Add($"Is {costAuthorityWorkBreakdownStructure.GetDisplayName()} Primary or Secondary CAWBS for this project?", x => x.CostAuthorityProjects.Any(rcap => rcap.IsPrimaryProjectCawbs && rcap.CostAuthorityID == costAuthorityWorkBreakdownStructure.CostAuthorityID) ? "Primary" : "Secondary", 70, DhtmlxGridColumnFilterType.SelectFilterStrict); } if (agreement != null) { Add(FieldDefinitionEnum.PrimaryCostAuthorityWorkBreakdownStructure.ToType().ToGridHeaderString(), x => x.CostAuthorityProjects.SingleOrDefault(rcap => rcap.IsPrimaryProjectCawbs)?.CostAuthority.GetDetailLinkUsingCostAuthorityWorkBreakdownStructure(), 120, DhtmlxGridColumnFilterType.Html); Add(FieldDefinitionEnum.SecondaryCostAuthorityWorkBreakdownStructure.ToType().ToGridHeaderStringPlural(), x => GetSecondaryCostAuthorityAsCommaDelimitedList(x), 200, DhtmlxGridColumnFilterType.Text); } 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 ?? 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 BasicProjectInfoGridSpec(FirmaSession currentFirmaSession, bool allowTaggingFunctionality, ProjectFirmaModels.Models.CostAuthority costAuthorityWorkBreakdownStructure) { BasicProjectInfoGridSpec_Impl(currentFirmaSession, allowTaggingFunctionality, costAuthorityWorkBreakdownStructure, null); }