示例#1
0
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, DatabaseEntities databaseEntities)
        {
            var project = projectUpdateBatch.Project;
            var currentPerformanceMeasureActuals = project.PerformanceMeasureActuals.ToList();

            currentPerformanceMeasureActuals.ForEach(pmav => pmav.DeleteFull(databaseEntities));
            currentPerformanceMeasureActuals.Clear();

            if (projectUpdateBatch.AreAccomplishmentsRelevant() && projectUpdateBatch.PerformanceMeasureActualUpdates.Any())
            {
                // Completely rebuild the list
                projectUpdateBatch.PerformanceMeasureActualUpdates.ToList().ForEach(x =>
                {
                    var performanceMeasureActual = new PerformanceMeasureActual(project, x.PerformanceMeasure, x.ActualValue ?? 0, x.PerformanceMeasureReportingPeriod);
                    databaseEntities.AllPerformanceMeasureActuals.Add(performanceMeasureActual);
                    var performanceMeasureActualSubcategoryOptionUpdates = x.PerformanceMeasureActualSubcategoryOptionUpdates.ToList();
                    if (performanceMeasureActualSubcategoryOptionUpdates.Any())
                    {
                        performanceMeasureActualSubcategoryOptionUpdates.ForEach(
                            y =>
                            databaseEntities.AllPerformanceMeasureActualSubcategoryOptions.Add(new PerformanceMeasureActualSubcategoryOption(performanceMeasureActual,
                                                                                                                                             y.PerformanceMeasureSubcategoryOption,
                                                                                                                                             y.PerformanceMeasure,
                                                                                                                                             y.PerformanceMeasureSubcategory)));
                    }
                });
            }
        }
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch,
                                                  DatabaseEntities databaseEntities)
        {
            var project = projectUpdateBatch.Project;
            var technicalAssistanceRequestsFromProjectUpdate =
                projectUpdateBatch.TechnicalAssistanceRequestUpdates.Select(
                    x => new TechnicalAssistanceRequest(ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(), project.ProjectID,
                                                        x.FiscalYear, x.PersonID, x.TechnicalAssistanceTypeID,
                                                        x.HoursRequested, x.HoursAllocated, x.HoursProvided, x.Notes)).ToList();

            project.TechnicalAssistanceRequests.Merge(technicalAssistanceRequestsFromProjectUpdate,
                                                      (x, y) => x.TechnicalAssistanceRequestID == y.TechnicalAssistanceRequestID,
                                                      (x, y) =>
            {
                x.ProjectID  = y.ProjectID;
                x.FiscalYear = y.FiscalYear;
                x.PersonID   = y.PersonID;
                x.TechnicalAssistanceTypeID = y.TechnicalAssistanceTypeID;
                x.HoursRequested            = y.HoursRequested;
                x.HoursAllocated            = y.HoursAllocated;
                x.HoursProvided             = y.HoursProvided;
                x.Notes = y.Notes;
            },
                                                      databaseEntities);
        }
示例#3
0
        public static void SendApprovalMessage(List <Person> peopleToCc, ProjectUpdateBatch projectUpdateBatch)
        {
            Check.Require(projectUpdateBatch.ProjectUpdateState == ProjectUpdateState.Approved, "Need to be in Approved state to send the Approved email!");
            var latestProjectUpdateHistorySubmitted = projectUpdateBatch.LatestProjectUpdateHistorySubmitted;
            var submitterPerson = latestProjectUpdateHistorySubmitted.UpdatePerson;
            var emailsToSendTo  = new List <string> {
                submitterPerson.Email
            };

            var personNames          = submitterPerson.FullNameFirstLast;
            var primaryContactPerson = projectUpdateBatch.Project.GetPrimaryContact();

            if (primaryContactPerson != null &&
                !String.Equals(primaryContactPerson.Email, submitterPerson.Email, StringComparison.InvariantCultureIgnoreCase))
            {
                if (string.IsNullOrEmpty(primaryContactPerson.Email))
                {
                    Logger.Warn($"Primary Contact is missing email address and will not get an Approval Message. Primary Contact ID:{primaryContactPerson.PersonID} Primary Contact Name:{primaryContactPerson.FullNameFirstLast} Project Update Batch ID:{projectUpdateBatch.ProjectUpdateBatchID} ");
                }
                else
                {
                    emailsToSendTo.Add(primaryContactPerson.Email);
                    personNames += $" and {primaryContactPerson.FullNameFirstLast}";
                }
            }

            var approverPerson = projectUpdateBatch.LastUpdatePerson;
            var detailUrl      = SitkaRoute <ProjectController> .BuildAbsoluteUrlHttpsFromExpression(x => x.Detail(projectUpdateBatch.Project));

            var message = $@"
Dear {personNames},
<p>
    The update submitted for {FieldDefinition.Project.GetFieldDefinitionLabel()} {projectUpdateBatch.Project.DisplayName} on {
                    latestProjectUpdateHistorySubmitted.TransitionDate.ToStringDate()
                } was approved by {approverPerson.FullNameFirstLastAndOrg}.
</p>
<p>
    There is no action for you to take - this is simply a notification email. The updates for this {FieldDefinition.Project.GetFieldDefinitionLabel()} are now visible to the general public on this {FieldDefinition.Project.GetFieldDefinitionLabel()}'s detail page:
</p>
<p>
    <a href=""{detailUrl}"">View this {FieldDefinition.Project.GetFieldDefinitionLabel()}</a>
</p>
Thank you for keeping your {FieldDefinition.Project.GetFieldDefinitionLabel()} information and accomplishments up to date!<br />
{$"- {MultiTenantHelpers.GetToolDisplayName()} team"}
";

            var subject     = $"The update for {FieldDefinition.Project.GetFieldDefinitionLabel()} {projectUpdateBatch.Project.DisplayName} was approved";
            var mailMessage = new MailMessage {
                Subject = subject, Body = message, IsBodyHtml = true
            };

            SendMessageAndLogNotificationForProjectUpdateTransition(projectUpdateBatch,
                                                                    mailMessage,
                                                                    emailsToSendTo,
                                                                    new List <string> {
                approverPerson.Email
            },
                                                                    peopleToCc.Select(x => x.Email).ToList(),
                                                                    NotificationType.ProjectUpdateApproved);
        }
示例#4
0
        private static void SendMessageAndLogNotificationForProjectUpdateTransition(ProjectUpdateBatch projectUpdateBatch,
                                                                                    MailMessage mailMessage,
                                                                                    List <string> emailsToSendTo,
                                                                                    List <string> emailsToReplyTo,
                                                                                    List <string> emailsToCc, NotificationType notificationType)
        {
            var latestProjectUpdateHistorySubmitted = projectUpdateBatch.LatestProjectUpdateHistorySubmitted;
            var submitterPerson      = latestProjectUpdateHistorySubmitted.UpdatePerson;
            var primaryContactPerson = projectUpdateBatch.Project.GetPrimaryContact();

            var notificationPeople = new List <Person> {
                submitterPerson
            };

            if (primaryContactPerson != null && submitterPerson.PersonID != primaryContactPerson.PersonID)
            {
                notificationPeople.Add(primaryContactPerson);
            }

            Notification.SendMessageAndLogNotification(mailMessage,
                                                       emailsToSendTo,
                                                       emailsToReplyTo,
                                                       emailsToCc,
                                                       notificationPeople,
                                                       DateTime.Now,
                                                       new List <Project> {
                projectUpdateBatch.Project
            },
                                                       notificationType);
        }
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, DatabaseEntities databaseEntities)
        {
            var project = projectUpdateBatch.Project;
            var currentPerformanceMeasureExpecteds = project.PerformanceMeasureExpecteds.ToList();

            currentPerformanceMeasureExpecteds.ForEach(pmav => pmav.DeleteFull(databaseEntities));
            currentPerformanceMeasureExpecteds.Clear();

            if (projectUpdateBatch.AreAccomplishmentsRelevant() && projectUpdateBatch.PerformanceMeasureExpectedUpdates.Any())
            {
                // Completely rebuild the list
                projectUpdateBatch.PerformanceMeasureExpectedUpdates.ToList().ForEach(x =>
                {
                    var performanceMeasureExpected = new PerformanceMeasureExpected(project, x.PerformanceMeasure)
                    {
                        ExpectedValue = x.ExpectedValue
                    };
                    databaseEntities.AllPerformanceMeasureExpecteds.Add(performanceMeasureExpected);
                    var performanceMeasureExpectedSubcategoryOptionUpdates = x.PerformanceMeasureExpectedSubcategoryOptionUpdates.ToList();
                    if (performanceMeasureExpectedSubcategoryOptionUpdates.Any())
                    {
                        performanceMeasureExpectedSubcategoryOptionUpdates.ForEach(
                            y =>
                            databaseEntities.AllPerformanceMeasureExpectedSubcategoryOptions.Add(new PerformanceMeasureExpectedSubcategoryOption(performanceMeasureExpected,
                                                                                                                                                 y.PerformanceMeasureSubcategoryOption,
                                                                                                                                                 y.PerformanceMeasure,
                                                                                                                                                 y.PerformanceMeasureSubcategory)));
                    }
                });
            }
        }
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch,
                                                  IList <PerformanceMeasureActual> allPerformanceMeasureActuals,
                                                  IList <PerformanceMeasureActualSubcategoryOption> allPerformanceMeasureActualSubcategoryOptions)
        {
            var project = projectUpdateBatch.Project;
            var currentPerformanceMeasureActuals = project.PerformanceMeasureActuals.ToList();

            currentPerformanceMeasureActuals.ForEach(pmav =>
            {
                pmav.PerformanceMeasureActualSubcategoryOptions.ToList().ForEach(pmavso => allPerformanceMeasureActualSubcategoryOptions.Remove(pmavso));
                allPerformanceMeasureActuals.Remove(pmav);
            });
            currentPerformanceMeasureActuals.Clear();

            if (projectUpdateBatch.AreAccomplishmentsRelevant() && projectUpdateBatch.PerformanceMeasureActualUpdates.Any())
            {
                // Completely rebuild the list
                projectUpdateBatch.PerformanceMeasureActualUpdates.ToList().ForEach(x =>
                {
                    var performanceMeasureActual = new PerformanceMeasureActual(project, x.PerformanceMeasure, x.CalendarYear, x.ActualValue ?? 0);
                    allPerformanceMeasureActuals.Add(performanceMeasureActual);
                    var performanceMeasureActualSubcategoryOptionUpdates = x.PerformanceMeasureActualSubcategoryOptionUpdates.ToList();
                    if (performanceMeasureActualSubcategoryOptionUpdates.Any())
                    {
                        performanceMeasureActualSubcategoryOptionUpdates.ForEach(
                            y =>
                            allPerformanceMeasureActualSubcategoryOptions.Add(new PerformanceMeasureActualSubcategoryOption(performanceMeasureActual,
                                                                                                                            y.PerformanceMeasureSubcategoryOption,
                                                                                                                            y.PerformanceMeasure,
                                                                                                                            y.PerformanceMeasureSubcategory)));
                    }
                });
            }
        }
示例#7
0
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, IList <ProjectImage> allProjectImages)
        {
            var project = projectUpdateBatch.Project;
            var projectImageUpdatesToCommit = new List <ProjectImage>();

            if (projectUpdateBatch.ProjectImageUpdates.Any())
            {
                // Completely rebuild the list
                projectImageUpdatesToCommit = projectUpdateBatch.ProjectImageUpdates.Select(x =>
                {
                    var currentFileResource = x.FileResource;
                    return(new ProjectImage(x.ProjectImageID ?? ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(),
                                            currentFileResource.FileResourceID,
                                            project.ProjectID,
                                            x.ProjectImageTimingID,
                                            x.Caption,
                                            x.Credit,
                                            x.IsKeyPhoto,
                                            x.ExcludeFromFactSheet));
                }).ToList();
            }

            project.ProjectImages.Merge(projectImageUpdatesToCommit,
                                        allProjectImages,
                                        (x, y) => x.ProjectImageID == y.ProjectImageID,
                                        (x, y) =>
            {
                x.ProjectImageTimingID = y.ProjectImageTimingID;
                x.Caption              = y.Caption;
                x.Credit               = y.Credit;
                x.IsKeyPhoto           = y.IsKeyPhoto;
                x.ExcludeFromFactSheet = y.ExcludeFromFactSheet;
            });
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            projectUpdateBatch.ProjectNoFundingSourceIdentifiedUpdates = project.ProjectNoFundingSourceIdentifieds.Select(x =>
                                                                                                                          new ProjectNoFundingSourceIdentifiedUpdate(ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(), projectUpdateBatch.ProjectUpdateBatchID, x.CalendarYear.HasValue ? x.CalendarYear.Value : (int?)null, x.NoFundingSourceIdentifiedYet)).ToList();
        }
示例#9
0
 public static void DeleteExpendituresProjectRelevantCostTypeUpdates(this ProjectUpdateBatch projectUpdateBatch)
 {
     foreach (var projectRelevantCostTypeUpdate in projectUpdateBatch.GetExpendituresRelevantCostTypes())
     {
         projectRelevantCostTypeUpdate.DeleteFull(HttpRequestStorage.DatabaseEntities);
     }
 }
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, DatabaseEntities databaseEntities)
        {
            var project = projectUpdateBatch.Project;
            var projectCustomAttributesFromProjectUpdate = projectUpdateBatch.ProjectCustomAttributeUpdates
                                                           .Select(x => new ProjectCustomAttribute(project.ProjectID, x.ProjectCustomAttributeType.ProjectCustomAttributeTypeID))
                                                           .ToList();
            var projectCustomAttributeValuesFromProjectUpdate = projectUpdateBatch.ProjectCustomAttributeUpdates
                                                                .SelectMany(x => x.ProjectCustomAttributeUpdateValues)
                                                                .Select(x =>
            {
                var projectCustomAttributeID =
                    project.ProjectCustomAttributes.SingleOrDefault(y =>
                                                                    y.ProjectCustomAttributeTypeID ==
                                                                    x.GetIProjectCustomAttribute()?.ProjectCustomAttributeTypeID)
                    ?.ProjectCustomAttributeID ??
                    projectCustomAttributesFromProjectUpdate.Single(y =>
                                                                    y.ProjectCustomAttributeTypeID ==
                                                                    x.GetIProjectCustomAttribute()?.ProjectCustomAttributeTypeID).ProjectCustomAttributeID;
                return(new ProjectCustomAttributeValue(projectCustomAttributeID, x.AttributeValue));
            })
                                                                .ToList();
            var existingProjectCustomAttributes = project.ProjectCustomAttributes.ToList();

            existingProjectCustomAttributes.Merge(projectCustomAttributesFromProjectUpdate,
                                                  (a, b) => a.ProjectID == b.ProjectID && a.ProjectCustomAttributeTypeID == b.ProjectCustomAttributeTypeID, databaseEntities);
            existingProjectCustomAttributes.SelectMany(x => x.ProjectCustomAttributeValues)
            .ToList()
            .Merge(projectCustomAttributeValuesFromProjectUpdate,
                   (x, y) => x.ProjectCustomAttributeValueID == y.ProjectCustomAttributeValueID, databaseEntities);
        }
示例#11
0
 public static void Approve(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate, DatabaseEntities databaseEntities)
 {
     Check.Require(projectUpdateBatch.IsSubmitted(), $"You cannot approve a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that has not been submitted!");
     projectUpdateBatch.CommitChangesToProject(databaseEntities);
     projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Approved, currentFirmaSession, transitionDate);
     projectUpdateBatch.PushTransitionRecordsToAuditLog();
 }
示例#12
0
        public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, IList <ProjectGrantAllocationRequest> allProjectGrantAllocationRequests)
        {
            var project = projectUpdateBatch.Project;
            var projectGrantAllocationExpectedFundingFromProjectUpdate = projectUpdateBatch
                                                                         .ProjectGrantAllocationRequestUpdates
                                                                         .Select(x => new ProjectGrantAllocationRequest(project.ProjectID, x.GrantAllocation.GrantAllocationID, x.CreateDate, x.ImportedFromTabularData)
            {
                TotalAmount = x.TotalAmount,
                PayAmount   = x.PayAmount,
                MatchAmount = x.MatchAmount,
                UpdateDate  = x.UpdateDate
            }
                                                                                 ).ToList();

            project.ProjectGrantAllocationRequests.Merge(projectGrantAllocationExpectedFundingFromProjectUpdate,
                                                         allProjectGrantAllocationRequests,
                                                         (x, y) => x.ProjectID == y.ProjectID && x.GrantAllocationID == y.GrantAllocationID,
                                                         (x, y) =>
            {
                x.TotalAmount             = y.TotalAmount;
                x.MatchAmount             = y.MatchAmount;
                x.PayAmount               = y.PayAmount;
                x.CreateDate              = y.CreateDate;
                x.UpdateDate              = y.UpdateDate;
                x.ImportedFromTabularData = y.ImportedFromTabularData;
            });
        }
示例#13
0
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            if (MultiTenantHelpers.GetTenantAttributeFromCache().BudgetType == BudgetType.AnnualBudgetByCostType)
            {
                projectUpdateBatch.ProjectFundingSourceBudgetUpdates = project.ProjectFundingSourceBudgets.Select(
                    projectFundingSourceBudget =>
                    new ProjectFundingSourceBudgetUpdate(projectUpdateBatch, projectFundingSourceBudget.FundingSource, projectFundingSourceBudget.CalendarYear,
                                                         projectFundingSourceBudget.SecuredAmount ?? 0, projectFundingSourceBudget.TargetedAmount ?? 0, projectFundingSourceBudget.CostTypeID)
                    ).ToList();
            }
            else
            {
                projectUpdateBatch.ProjectFundingSourceBudgetUpdates = project.ProjectFundingSourceBudgets.Select(
                    projectFundingSourceBudget =>
                    new ProjectFundingSourceBudgetUpdate(projectUpdateBatch,
                                                         projectFundingSourceBudget.FundingSource)
                {
                    SecuredAmount  = projectFundingSourceBudget.SecuredAmount,
                    TargetedAmount = projectFundingSourceBudget.TargetedAmount
                }
                    ).ToList();
            }
            // this is on project, but setting here since it's related to budget. Maybe move FundingTypeID and NoFundingSourceIdentifiedYet here as well?
            projectUpdateBatch.ExpectedFundingUpdateNote = project.ExpectedFundingUpdateNote;
        }
示例#14
0
        public static GeospatialAreaValidationResult ValidateProjectGeospatialArea(this ProjectUpdateBatch projectUpdateBatch, GeospatialAreaType geospatialAreaType)
        {
            var projectGeospatialAreaTypeNoteUpdate = projectUpdateBatch.ProjectGeospatialAreaTypeNoteUpdates.SingleOrDefault(x => x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID);
            var incomplete = projectUpdateBatch.ProjectGeospatialAreaUpdates.All(x => x.GeospatialArea.GeospatialAreaTypeID != geospatialAreaType.GeospatialAreaTypeID) && projectGeospatialAreaTypeNoteUpdate == null;
            var geospatialAreaValidationResult = new GeospatialAreaValidationResult(incomplete, geospatialAreaType);

            return(geospatialAreaValidationResult);
        }
示例#15
0
        public static ClassificationsValidationResult ValidateClassifications(this ProjectUpdateBatch projectUpdateBatch)
        {
            var projectClassificationSimples = ProjectUpdateController.GetProjectClassificationSimples(projectUpdateBatch);
            var classificationLabel          = FieldDefinitionEnum.Classification.ToType().GetFieldDefinitionLabel();
            var classificationSystemsLabel   = FieldDefinitionEnum.Classification.ToType().GetFieldDefinitionLabel();

            return(new ClassificationsValidationResult(projectClassificationSimples, classificationLabel, classificationSystemsLabel));
        }
示例#16
0
 public static bool AreExpendituresValid(this ProjectUpdateBatch projectUpdateBatch)
 {
     if (MultiTenantHelpers.GetTenantAttributeFromCache().BudgetType == BudgetType.AnnualBudgetByCostType)
     {
         return(projectUpdateBatch.ValidateExpendituresByCostType().Count == 0);
     }
     return(projectUpdateBatch.ValidateExpenditures().Count == 0);
 }
示例#17
0
 public static List <string> ValidateExpendituresAndForceValidation(this ProjectUpdateBatch projectUpdateBatch)
 {
     if (MultiTenantHelpers.GetTenantAttributeFromCache().BudgetType == BudgetType.AnnualBudgetByCostType)
     {
         return(projectUpdateBatch.ValidateExpendituresByCostType());
     }
     return(projectUpdateBatch.ValidateExpenditures());
 }
示例#18
0
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;
            var projectGeospatialAreaTypeNoteUpdates = project.ProjectGeospatialAreaTypeNotes.Select(
                projectGeospatialAreaTypeNote => new ProjectGeospatialAreaTypeNoteUpdate(projectUpdateBatch, projectGeospatialAreaTypeNote.GeospatialAreaType, projectGeospatialAreaTypeNote.Notes)).ToList();

            projectUpdateBatch.ProjectGeospatialAreaTypeNoteUpdates = projectGeospatialAreaTypeNoteUpdates;
        }
示例#19
0
        public static bool IsReadyToSubmit(this ProjectUpdateBatch projectUpdateBatch)
        {
            bool inEditableState                       = projectUpdateBatch.InEditableState();
            bool isPassingAllValidationRules           = projectUpdateBatch.IsPassingAllValidationRules();
            bool projectUpdateBatchHasAlreadyBeenSaved = ModelObjectHelpers.IsRealPrimaryKeyValue(projectUpdateBatch.ProjectUpdateBatchID);

            return(inEditableState && isPassingAllValidationRules && projectUpdateBatchHasAlreadyBeenSaved);
        }
示例#20
0
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;
            var projectGeospatialAreaUpdates = project.ProjectGeospatialAreas.Select(
                projectGeospatialAreaToClone => new ProjectGeospatialAreaUpdate(projectUpdateBatch, projectGeospatialAreaToClone.GeospatialArea)).ToList();

            projectUpdateBatch.ProjectGeospatialAreaUpdates = projectGeospatialAreaUpdates;
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            projectUpdateBatch.ProjectExternalLinkUpdates =
                project.ProjectExternalLinks.Select(
                    pn => new ProjectExternalLinkUpdate(projectUpdateBatch, pn.ExternalLinkLabel, pn.ExternalLinkUrl)).ToList();
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;
            var projectRegionUpdates = project.ProjectRegions.Select(
                projectRegionToClone => new ProjectRegionUpdate(projectUpdateBatch, projectRegionToClone.DNRUplandRegion)).ToList();

            projectUpdateBatch.ProjectRegionUpdates = projectRegionUpdates;
        }
示例#23
0
        private static List <ProjectSectionSimple> GetProjectUpdateSectionsImpl(ProjectUpdateBatch projectUpdateBatch,
                                                                                List <ProjectUpdateSection> projectUpdateSections,
                                                                                ProjectUpdateStatus projectUpdateStatus, bool ignoreStatus)
        {
            var sections = projectUpdateSections.Select(x => new ProjectSectionSimple(x, x.GetSectionUrl(projectUpdateBatch.Project), !ignoreStatus && x.IsComplete(projectUpdateBatch), projectUpdateStatus != null && x.SectionIsUpdated(projectUpdateStatus))).OrderBy(x => x.SortOrder).ToList();

            return(sections);
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;
            var projectPriorityLandscapeUpdates = project.ProjectPriorityLandscapes.Select(
                projectPriorityLandscapeToClone => new ProjectPriorityLandscapeUpdate(projectUpdateBatch, projectPriorityLandscapeToClone.PriorityLandscape)).ToList();

            projectUpdateBatch.ProjectPriorityLandscapeUpdates = projectPriorityLandscapeUpdates;
        }
示例#25
0
        /// <summary>
        /// Only public for unit testing
        /// </summary>
        public static ProjectUpdateBatch CreateProjectUpdateBatchAndLogTransition(Project project, FirmaSession currentFirmaSession)
        {
            var projectUpdateBatch = new ProjectUpdateBatch(project, DateTime.Now, currentFirmaSession.Person, ProjectUpdateState.Created, false);

            // create a project update history record
            projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Created, currentFirmaSession, DateTime.Now);
            return(projectUpdateBatch);
        }
示例#26
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectUpdate(ProjectUpdateBatch projectUpdateBatch, ProjectStage projectStage, ProjectLocationSimpleType projectLocationSimpleType) : 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.ProjectLocationSimpleTypeID = projectLocationSimpleType.ProjectLocationSimpleTypeID;
 }
示例#27
0
        public static LocationSimpleValidationResult ValidateProjectLocationSimple(this ProjectUpdateBatch projectUpdateBatch)
        {
            var incomplete = !projectUpdateBatch.ProjectUpdate.HasProjectLocationPoint(true) &&
                             string.IsNullOrWhiteSpace(projectUpdateBatch.ProjectUpdate.ProjectLocationNotes);

            var locationSimpleValidationResult = new LocationSimpleValidationResult(incomplete);

            return(locationSimpleValidationResult);
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            projectUpdateBatch.ProjectPersonUpdates =
                project.ProjectPeople.Select(
                    po => new ProjectPersonUpdate(projectUpdateBatch, po.Person, po.ProjectPersonRelationshipType)
                    ).ToList();
        }
示例#29
0
        /// <summary>
        /// Note, the saving is done by the controller
        /// </summary>
        private static void CreateNewTransitionRecord(this ProjectUpdateBatch projectUpdateBatch, ProjectUpdateState projectUpdateState, FirmaSession currentFirmaSession, DateTime transitionDate)
        {
            var currentPerson        = currentFirmaSession.Person;
            var projectUpdateHistory = new ProjectUpdateHistory(projectUpdateBatch, projectUpdateState, currentPerson, transitionDate);

            HttpRequestStorage.DatabaseEntities.AllProjectUpdateHistories.Add(projectUpdateHistory);
            projectUpdateBatch.ProjectUpdateStateID = projectUpdateState.ProjectUpdateStateID;
            projectUpdateBatch.TickleLastUpdateDate(transitionDate, currentFirmaSession);
        }
        public static void CreateFromProject(ProjectUpdateBatch projectUpdateBatch)
        {
            var project = projectUpdateBatch.Project;

            projectUpdateBatch.ProjectClassificationUpdates = project.ProjectClassifications.Select(x => new ProjectClassificationUpdate(projectUpdateBatch, x.Classification)
            {
                ProjectClassificationUpdateNotes = x.ProjectClassificationNotes
            }).ToList();
        }