public void UpdateModel(ProjectFirmaModels.Models.ProjectUpdateBatch projectUpdateBatch, List <ProjectClassificationSimple> projectClassificationSimples)
        {
            foreach (var projectClassificationSimple in projectClassificationSimples)
            {
                var alreadySelected = projectUpdateBatch.ProjectClassificationUpdates
                                      .SingleOrDefault(x => x.ClassificationID == projectClassificationSimple.ClassificationID) != null;

                if (projectClassificationSimple.Selected && !alreadySelected)
                {
                    var projectClassificationUpdate = new ProjectClassificationUpdate(projectUpdateBatch.ProjectUpdateBatchID,
                                                                                      projectClassificationSimple.ClassificationID)
                    {
                        ProjectClassificationUpdateNotes = projectClassificationSimple.ProjectClassificationNotes
                    };

                    projectUpdateBatch.ProjectClassificationUpdates.Add(projectClassificationUpdate);
                }
                else if (projectClassificationSimple.Selected && alreadySelected)
                {
                    var existingProjectClassification = projectUpdateBatch.ProjectClassificationUpdates.First(x => x.ClassificationID == projectClassificationSimple.ClassificationID);
                    existingProjectClassification.ProjectClassificationUpdateNotes = projectClassificationSimple.ProjectClassificationNotes;
                }
                else if (!projectClassificationSimple.Selected && alreadySelected)
                {
                    var existingProjectClassification = projectUpdateBatch.ProjectClassificationUpdates.First(x => x.ClassificationID == projectClassificationSimple.ClassificationID);
                    existingProjectClassification.DeleteFull(HttpRequestStorage.DatabaseEntities);
                }
            }

            if (projectUpdateBatch.IsSubmitted())
            {
                projectUpdateBatch.ProjectClassificationsComment = Comments;
            }
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectNoFundingSourceIdentifiedUpdate(ProjectUpdateBatch projectUpdateBatch) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectNoFundingSourceIdentifiedUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectNoFundingSourceIdentifiedUpdates.Add(this);
 }
示例#3
0
        public ProjectUpdate(ProjectUpdateBatch projectUpdateBatch) : this(projectUpdateBatch, projectUpdateBatch.Project.ProjectStage,
                                                                           projectUpdateBatch.Project.ProjectDescription, projectUpdateBatch.Project.ProjectLocationSimpleType, projectUpdateBatch.Project.LocationIsPrivate)
        {
            var project = projectUpdateBatch.Project;

            LoadUpdateFromProject(project);
            LoadSimpleLocationFromProject(project);
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectLocationUpdate(ProjectUpdateBatch projectUpdateBatch, DbGeometry projectLocationUpdateGeometry) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectLocationUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID    = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch      = projectUpdateBatch;
     projectUpdateBatch.ProjectLocationUpdates.Add(this);
     this.ProjectLocationUpdateGeometry = projectLocationUpdateGeometry;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectNoteUpdate(ProjectUpdateBatch projectUpdateBatch, string note, DateTime createDate) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectNoteUpdateID  = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectNoteUpdates.Add(this);
     this.Note       = note;
     this.CreateDate = createDate;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectExemptReportingYearUpdate(ProjectUpdateBatch projectUpdateBatch, int calendarYear, ProjectExemptReportingType projectExemptReportingType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectExemptReportingYearUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectExemptReportingYearUpdates.Add(this);
     this.CalendarYear = calendarYear;
     this.ProjectExemptReportingTypeID = projectExemptReportingType.ProjectExemptReportingTypeID;
 }
 private static void AssertGetLatestReturnsCorrectly(ProjectUpdateBatch projectUpdateBatch,
                                                     ProjectUpdateHistory expectedProjectUpdateHistory,
                                                     ProjectUpdateState projectUpdateStateExpected)
 {
     Assert.That(projectUpdateBatch.ProjectUpdateHistories.GetLatestProjectUpdateHistory(), Is.EqualTo(expectedProjectUpdateHistory), "Should have gotten the correct latest one");
     AssertGetLatestForTransitionReturnsCorrectly(projectUpdateBatch, expectedProjectUpdateHistory, projectUpdateStateExpected, ProjectUpdateState.Created);
     AssertGetLatestForTransitionReturnsCorrectly(projectUpdateBatch, expectedProjectUpdateHistory, projectUpdateStateExpected, ProjectUpdateState.Submitted);
     AssertGetLatestForTransitionReturnsCorrectly(projectUpdateBatch, expectedProjectUpdateHistory, projectUpdateStateExpected, ProjectUpdateState.Approved);
     AssertGetLatestForTransitionReturnsCorrectly(projectUpdateBatch, expectedProjectUpdateHistory, projectUpdateStateExpected, ProjectUpdateState.Returned);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectExternalLinkUpdate(ProjectUpdateBatch projectUpdateBatch, string externalLinkLabel, string externalLinkUrl) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectExternalLinkUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID        = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch          = projectUpdateBatch;
     projectUpdateBatch.ProjectExternalLinkUpdates.Add(this);
     this.ExternalLinkLabel = externalLinkLabel;
     this.ExternalLinkUrl   = externalLinkUrl;
 }
示例#9
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TechnicalAssistanceRequestUpdate(ProjectUpdateBatch projectUpdateBatch, int fiscalYear, TechnicalAssistanceType technicalAssistanceType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TechnicalAssistanceRequestUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.TechnicalAssistanceRequestUpdates.Add(this);
     this.FiscalYear = fiscalYear;
     this.TechnicalAssistanceTypeID = technicalAssistanceType.TechnicalAssistanceTypeID;
 }
 public ProjectFundingSourceBudgetUpdate(ProjectUpdateBatch projectUpdateBatch, FundingSource fundingSource, int?calendarYear, decimal targetedAmount, int?costTypeID) : this()
 {
     ProjectFundingSourceBudgetUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     ProjectUpdateBatch   = projectUpdateBatch;
     FundingSourceID      = fundingSource.FundingSourceID;
     FundingSource        = fundingSource;
     CalendarYear         = calendarYear;
     ProjectedAmount      = targetedAmount;
     CostTypeID           = costTypeID;
 }
示例#11
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public PerformanceMeasureExpectedUpdate(ProjectUpdateBatch projectUpdateBatch, PerformanceMeasure performanceMeasure) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.PerformanceMeasureExpectedUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.PerformanceMeasureExpectedUpdates.Add(this);
     this.PerformanceMeasureID = performanceMeasure.PerformanceMeasureID;
     this.PerformanceMeasure   = performanceMeasure;
     performanceMeasure.PerformanceMeasureExpectedUpdates.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectGeospatialAreaUpdate(ProjectUpdateBatch projectUpdateBatch, GeospatialArea geospatialArea) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectGeospatialAreaUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID          = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch            = projectUpdateBatch;
     projectUpdateBatch.ProjectGeospatialAreaUpdates.Add(this);
     this.GeospatialAreaID = geospatialArea.GeospatialAreaID;
     this.GeospatialArea   = geospatialArea;
     geospatialArea.ProjectGeospatialAreaUpdates.Add(this);
 }
示例#13
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectCustomAttributeUpdate(ProjectUpdateBatch projectUpdateBatch, ProjectCustomAttributeType projectCustomAttributeType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectCustomAttributeUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID           = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch             = projectUpdateBatch;
     projectUpdateBatch.ProjectCustomAttributeUpdates.Add(this);
     this.ProjectCustomAttributeTypeID = projectCustomAttributeType.ProjectCustomAttributeTypeID;
     this.ProjectCustomAttributeType   = projectCustomAttributeType;
     projectCustomAttributeType.ProjectCustomAttributeUpdates.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectClassificationUpdate(ProjectUpdateBatch projectUpdateBatch, Classification classification) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectClassificationUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID          = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch            = projectUpdateBatch;
     projectUpdateBatch.ProjectClassificationUpdates.Add(this);
     this.ClassificationID = classification.ClassificationID;
     this.Classification   = classification;
     classification.ProjectClassificationUpdates.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectFundingSourceBudgetUpdate(ProjectUpdateBatch projectUpdateBatch, FundingSource fundingSource) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectFundingSourceBudgetUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectFundingSourceBudgetUpdates.Add(this);
     this.FundingSourceID = fundingSource.FundingSourceID;
     this.FundingSource   = fundingSource;
     fundingSource.ProjectFundingSourceBudgetUpdates.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectUpdate(ProjectUpdateBatch projectUpdateBatch, ProjectStage projectStage, string projectDescription, ProjectLocationSimpleType projectLocationSimpleType, bool locationIsPrivate) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectUpdateID             = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID        = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch          = projectUpdateBatch;
     this.ProjectStageID              = projectStage.ProjectStageID;
     this.ProjectDescription          = projectDescription;
     this.ProjectLocationSimpleTypeID = projectLocationSimpleType.ProjectLocationSimpleTypeID;
     this.LocationIsPrivate           = locationIsPrivate;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectGeospatialAreaTypeNoteUpdate(ProjectUpdateBatch projectUpdateBatch, GeospatialAreaType geospatialAreaType, string notes) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectGeospatialAreaTypeNoteUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectGeospatialAreaTypeNoteUpdates.Add(this);
     this.GeospatialAreaTypeID = geospatialAreaType.GeospatialAreaTypeID;
     this.GeospatialAreaType   = geospatialAreaType;
     geospatialAreaType.ProjectGeospatialAreaTypeNoteUpdates.Add(this);
     this.Notes = notes;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectRelevantCostTypeUpdate(ProjectUpdateBatch projectUpdateBatch, CostType costType, ProjectRelevantCostTypeGroup projectRelevantCostTypeGroup) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectRelevantCostTypeUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID            = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch = projectUpdateBatch;
     projectUpdateBatch.ProjectRelevantCostTypeUpdates.Add(this);
     this.CostTypeID = costType.CostTypeID;
     this.CostType   = costType;
     costType.ProjectRelevantCostTypeUpdates.Add(this);
     this.ProjectRelevantCostTypeGroupID = projectRelevantCostTypeGroup.ProjectRelevantCostTypeGroupID;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectFundingSourceExpenditureUpdate(ProjectUpdateBatch projectUpdateBatch, FundingSource fundingSource, int calendarYear, decimal expenditureAmount) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectFundingSourceExpenditureUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectFundingSourceExpenditureUpdates.Add(this);
     this.FundingSourceID = fundingSource.FundingSourceID;
     this.FundingSource   = fundingSource;
     fundingSource.ProjectFundingSourceExpenditureUpdates.Add(this);
     this.CalendarYear      = calendarYear;
     this.ExpenditureAmount = expenditureAmount;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectImageUpdate(ProjectUpdateBatch projectUpdateBatch, ProjectImageTiming projectImageTiming, string caption, string credit, bool isKeyPhoto, bool excludeFromFactSheet) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectImageUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch   = projectUpdateBatch;
     projectUpdateBatch.ProjectImageUpdates.Add(this);
     this.ProjectImageTimingID = projectImageTiming.ProjectImageTimingID;
     this.Caption              = caption;
     this.Credit               = credit;
     this.IsKeyPhoto           = isKeyPhoto;
     this.ExcludeFromFactSheet = excludeFromFactSheet;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectUpdateHistory(ProjectUpdateBatch projectUpdateBatch, ProjectUpdateState projectUpdateState, Person updatePerson, DateTime transitionDate)
     : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectUpdateHistoryID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch = projectUpdateBatch;
     projectUpdateBatch.ProjectUpdateHistories.Add(this);
     this.ProjectUpdateStateID = projectUpdateState.ProjectUpdateStateID;
     this.UpdatePersonID = updatePerson.PersonID;
     this.UpdatePerson = updatePerson;
     updatePerson.ProjectUpdateHistoriesWhereYouAreTheUpdatePerson.Add(this);
     this.TransitionDate = transitionDate;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectContactUpdate(ProjectUpdateBatch projectUpdateBatch, Person contact, ContactRelationshipType contactRelationshipType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectContactUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch = projectUpdateBatch;
     projectUpdateBatch.ProjectContactUpdates.Add(this);
     this.ContactID = contact.PersonID;
     this.Contact = contact;
     contact.ProjectContactUpdatesWhereYouAreTheContact.Add(this);
     this.ContactRelationshipTypeID = contactRelationshipType.ContactRelationshipTypeID;
     this.ContactRelationshipType = contactRelationshipType;
     contactRelationshipType.ProjectContactUpdates.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectOrganizationUpdate(ProjectUpdateBatch projectUpdateBatch, Organization organization, OrganizationRelationshipType organizationRelationshipType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectOrganizationUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID        = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch          = projectUpdateBatch;
     projectUpdateBatch.ProjectOrganizationUpdates.Add(this);
     this.OrganizationID = organization.OrganizationID;
     this.Organization   = organization;
     organization.ProjectOrganizationUpdates.Add(this);
     this.OrganizationRelationshipTypeID = organizationRelationshipType.OrganizationRelationshipTypeID;
     this.OrganizationRelationshipType   = organizationRelationshipType;
     organizationRelationshipType.ProjectOrganizationUpdates.Add(this);
 }
示例#24
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectLocationStagingUpdate(ProjectUpdateBatch projectUpdateBatch, Person person, string featureClassName, string geoJson, bool shouldImport) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectLocationStagingUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID           = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch             = projectUpdateBatch;
     projectUpdateBatch.ProjectLocationStagingUpdates.Add(this);
     this.PersonID = person.PersonID;
     this.Person   = person;
     person.ProjectLocationStagingUpdates.Add(this);
     this.FeatureClassName = featureClassName;
     this.GeoJson          = geoJson;
     this.ShouldImport     = shouldImport;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectAttachmentUpdate(ProjectUpdateBatch projectUpdateBatch, FileResourceInfo attachment, AttachmentType attachmentType, string displayName) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectAttachmentUpdateID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectUpdateBatchID      = projectUpdateBatch.ProjectUpdateBatchID;
     this.ProjectUpdateBatch        = projectUpdateBatch;
     projectUpdateBatch.ProjectAttachmentUpdates.Add(this);
     this.AttachmentID = attachment.FileResourceInfoID;
     this.Attachment   = attachment;
     attachment.ProjectAttachmentUpdatesWhereYouAreTheAttachment.Add(this);
     this.AttachmentTypeID = attachmentType.AttachmentTypeID;
     this.AttachmentType   = attachmentType;
     attachmentType.ProjectAttachmentUpdates.Add(this);
     this.DisplayName = displayName;
 }
示例#26
0
 public EditProjectFundingSourceBudgetByCostTypeViewDataForAngular(ProjectFirmaModels.Models.ProjectUpdateBatch projectUpdateBatch,
                                                                   List <FundingSourceSimple> allFundingSources,
                                                                   List <CostTypeSimple> allCostTypes,
                                                                   List <int> requiredCalendarYearRange,
                                                                   IEnumerable <SelectListItem> fundingTypes)
 {
     RequiredCalendarYearRange = requiredCalendarYearRange;
     AllFundingSources         = allFundingSources;
     AllCostTypes   = allCostTypes;
     ProjectID      = projectUpdateBatch.ProjectID;
     FundingTypes   = fundingTypes;
     MaxYear        = FirmaDateUtilities.CalculateCurrentYearToUseForUpToAllowableInputInReporting();
     UseFiscalYears = MultiTenantHelpers.UseFiscalYears();
     ObligationItemBudgetRollUps  = projectUpdateBatch.Project.GetObligationItemBudgetRollUpByYearAndCostTypeAndFundingSourceSimples();
     ObligationItemInvoiceRollUps = projectUpdateBatch.Project.GetObligationItemInvoiceRollUpByYearAndCostTypeAndFundingSourceSimples();
 }
 private static void AssertGetLatestForTransitionReturnsCorrectly(ProjectUpdateBatch projectUpdateBatch,
                                                                  ProjectUpdateHistory expectedProjectUpdateHistory,
                                                                  ProjectUpdateState projectUpdateStateExpected,
                                                                  ProjectUpdateState projectUpdateStateToCheck)
 {
     if (projectUpdateStateExpected == projectUpdateStateToCheck)
     {
         Assert.That(projectUpdateBatch.ProjectUpdateHistories.GetLatestProjectUpdateHistory(projectUpdateStateToCheck),
                     Is.EqualTo(expectedProjectUpdateHistory),
                     "Should have gotten the latest one in this transition");
     }
     else
     {
         var latestProjectUpdateHistory = projectUpdateBatch.ProjectUpdateHistories.GetLatestProjectUpdateHistory();
         Assert.That(latestProjectUpdateHistory.ProjectUpdateState, Is.Not.EqualTo(projectUpdateStateToCheck), "Should not return a ProjectUpdateHistory in this transition");
     }
 }
示例#28
0
        public ProjectImageUpdate(ProjectUpdateBatch projectUpdateBatch, bool userHasPermissionToSetKeyPhoto)
            : this(ModelObjectHelpers.NotYetAssignedID, null, projectUpdateBatch.ProjectUpdateBatchID, ProjectImageTiming.Unknown.ProjectImageTimingID, string.Empty, string.Empty, false, false, null)
        {
            // ReSharper disable DoNotCallOverridableMethodsInConstructor
            ProjectUpdateBatch = projectUpdateBatch;
            // ReSharper restore DoNotCallOverridableMethodsInConstructor

            // If we are the only picture for this Project so far, it must be the key image -- so long as we have permission to set key photos.
            if (userHasPermissionToSetKeyPhoto && !projectUpdateBatch.ProjectImageUpdates.Any())
            {
                IsKeyPhoto = true;
            }

            // If they don't have permission, it's definitely NOT the key photo, no matter what.
            if (!userHasPermissionToSetKeyPhoto)
            {
                IsKeyPhoto = false;
            }
        }
        public EditProposalClassificationsViewData(FirmaSession currentFirmaSession
                                                   , ProjectFirmaModels.Models.ProjectUpdateBatch projectUpdateBatch
                                                   , List <ProjectFirmaModels.Models.ClassificationSystem> classificationSystems
                                                   , ClassificationsValidationResult classificationsValidationResult
                                                   , ProjectUpdateStatus projectUpdateStatus
                                                   , string diffUrl
                                                   , string refreshUrl)
            : base(currentFirmaSession, projectUpdateBatch, projectUpdateStatus, classificationsValidationResult.GetWarningMessages(), ProjectUpdateSection.Classifications.ProjectUpdateSectionDisplayName)
        {
            ProjectName                      = projectUpdateBatch.Project.GetDisplayName();
            ClassificationSystems            = classificationSystems;
            FieldDefinitionForProject        = FieldDefinitionEnum.Project.ToType();
            FieldDefinitionForClassification = FieldDefinitionEnum.Classification.ToType();
            if (new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                ConfigureClassificationSystemsUrl = SitkaRoute <TenantController> .BuildUrlFromExpression(tc => tc.Detail());
            }

            DiffUrl    = diffUrl;
            RefreshUrl = refreshUrl;
        }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static ProjectUpdate CreateNewBlank(ProjectUpdateBatch projectUpdateBatch, ProjectStage projectStage, ProjectLocationSimpleType projectLocationSimpleType)
 {
     return(new ProjectUpdate(projectUpdateBatch, projectStage, default(string), projectLocationSimpleType, default(bool)));
 }