예제 #1
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectCustomAttributeUpdateValue(ProjectCustomAttributeUpdate projectCustomAttributeUpdate, string attributeValue) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectCustomAttributeUpdateValueID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.ProjectCustomAttributeUpdateID      = projectCustomAttributeUpdate.ProjectCustomAttributeUpdateID;
     this.ProjectCustomAttributeUpdate        = projectCustomAttributeUpdate;
     projectCustomAttributeUpdate.ProjectCustomAttributeUpdateValues.Add(this);
     this.AttributeValue = attributeValue;
 }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            projectUpdateBatch.ProjectCustomAttributeUpdates = project.ProjectCustomAttributes
                                                               .Select(x =>
            {
                var projectCustomAttributeUpdate = new ProjectCustomAttributeUpdate(projectUpdateBatch, x.ProjectCustomAttributeType);
                projectCustomAttributeUpdate.ProjectCustomAttributeUpdateValues = x.ProjectCustomAttributeValues
                                                                                  .Select(y => new ProjectCustomAttributeUpdateValue(projectCustomAttributeUpdate, y.AttributeValue))
                                                                                  .ToList();
                return(projectCustomAttributeUpdate);
            })
                                                               .ToList();
        }
        public static ProjectUpdateBatch CreateNewProjectUpdateBatchForProject(Project project, Person currentPerson)
        {
            var projectUpdateBatch = CreateProjectUpdateBatchAndLogTransition(project, currentPerson);

            // basics & map
            ProjectUpdate.CreateFromProject(projectUpdateBatch);

            // expenditures
            ProjectGrantAllocationExpenditureUpdate.CreateFromProject(projectUpdateBatch);

            // project expenditures exempt reporting years
            ProjectExemptReportingYearUpdate.CreateExpendituresExemptReportingYearsFromProject(projectUpdateBatch);

            // expenditures exempt explanation
            projectUpdateBatch.SyncExpendituresYearsExemptionExplanation();

            // Expected Funding
            ProjectGrantAllocationRequestUpdate.CreateFromProject(projectUpdateBatch);

            // performance measures
            // TODO Neutered Per WA DNR #1446. May decide to bring it back later
            //PerformanceMeasureActualUpdate.CreateFromProject(projectUpdateBatch);

            // project performance measures exempt reporting years
            ProjectExemptReportingYearUpdate.CreatePerformanceMeasuresExemptReportingYearsFromProject(projectUpdateBatch);

            // project exempt reporting years reason
            projectUpdateBatch.SyncPerformanceMeasureActualYearsExemptionExplanation();

            // project locations - detailed
            ProjectLocationUpdate.CreateFromProject(projectUpdateBatch);

            // project priority landscape
            ProjectPriorityLandscapeUpdate.CreateFromProject(projectUpdateBatch);

            // project region
            ProjectRegionUpdate.CreateFromProject(projectUpdateBatch);

            // photos
            ProjectImageUpdate.CreateFromProject(projectUpdateBatch);
            projectUpdateBatch.IsPhotosUpdated = false;

            // external links
            ProjectExternalLinkUpdate.CreateFromProject(projectUpdateBatch);

            // notes
            ProjectNoteUpdate.CreateFromProject(projectUpdateBatch);

            // organizations
            ProjectOrganizationUpdate.CreateFromProject(projectUpdateBatch);

            ProjectPersonUpdate.CreateFromProject(projectUpdateBatch);

            // Documents
            ProjectDocumentUpdate.CreateFromProject(projectUpdateBatch);

            // Custom attributes
            ProjectCustomAttributeUpdate.CreateFromProject(projectUpdateBatch);

            return(projectUpdateBatch);
        }
예제 #4
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static ProjectCustomAttributeUpdateValue CreateNewBlank(ProjectCustomAttributeUpdate projectCustomAttributeUpdate)
 {
     return(new ProjectCustomAttributeUpdateValue(projectCustomAttributeUpdate, default(string)));
 }
 public static void DeleteProjectCustomAttributeUpdate(this IQueryable <ProjectCustomAttributeUpdate> projectCustomAttributeUpdates, ProjectCustomAttributeUpdate projectCustomAttributeUpdateToDelete)
 {
     DeleteProjectCustomAttributeUpdate(projectCustomAttributeUpdates, new List <ProjectCustomAttributeUpdate> {
         projectCustomAttributeUpdateToDelete
     });
 }