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 PerformanceMeasureExpectedSubcategoryOptionSimple(PerformanceMeasureValueSubcategoryOption performanceMeasureExpectedSubcategoryOption, PerformanceMeasureExpected performanceMeasureExpected) : this( performanceMeasureExpectedSubcategoryOption.PrimaryKey, performanceMeasureExpected.PerformanceMeasureExpectedID, performanceMeasureExpectedSubcategoryOption.PerformanceMeasureSubcategoryOptionID, performanceMeasureExpectedSubcategoryOption.PerformanceMeasure.PerformanceMeasureID, performanceMeasureExpectedSubcategoryOption.PerformanceMeasureSubcategory.PerformanceMeasureSubcategoryID) { }
/// <summary> /// Constructor for building a new simple object with the POCO class /// </summary> public PerformanceMeasureExpectedSimple(PerformanceMeasureExpected performanceMeasureExpected) : this() { PerformanceMeasureExpectedID = performanceMeasureExpected.PerformanceMeasureExpectedID; DisplayName = performanceMeasureExpected.PerformanceMeasure.PerformanceMeasureDisplayName; DefinitionAndGuidanceUrl = performanceMeasureExpected.PerformanceMeasure.GetDefinitionAndGuidanceUrl(); PerformanceMeasureID = performanceMeasureExpected.PerformanceMeasureID; ExpectedValue = performanceMeasureExpected.ExpectedValue; PerformanceMeasureExpectedSubcategoryOptions = PerformanceMeasureValueSubcategoryOption.GetAllPossibleSubcategoryOptions(performanceMeasureExpected); }
public PerformanceMeasureActualSimple(PerformanceMeasureExpected performanceMeasureExpected, int calendarYear, int decrementingPerformanceMeasureActual) : this() { var reportingPeriods = HttpRequestStorage.DatabaseEntities.PerformanceMeasureReportingPeriods.Where(x => x.PerformanceMeasureReportingPeriodCalendarYear == calendarYear).ToList(); var reportingPeriod = reportingPeriods.Single(); PerformanceMeasureActualID = decrementingPerformanceMeasureActual; ProjectID = performanceMeasureExpected.ProjectID; PerformanceMeasureID = performanceMeasureExpected.PerformanceMeasureID; CalendarYear = calendarYear; ActualValue = null; PerformanceMeasureActualSubcategoryOptions = PerformanceMeasureValueSubcategoryOption.GetAllPossibleSubcategoryOptionsToActual(performanceMeasureExpected); PerformanceMeasureReportingPeriodID = reportingPeriod.PerformanceMeasureReportingPeriodID; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public PerformanceMeasureExpectedSubcategoryOption(PerformanceMeasureExpected performanceMeasureExpected, PerformanceMeasureSubcategoryOption performanceMeasureSubcategoryOption, PerformanceMeasure performanceMeasure, PerformanceMeasureSubcategory performanceMeasureSubcategory) : this() { // Mark this as a new object by setting primary key with special value this.PerformanceMeasureExpectedSubcategoryOptionID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.PerformanceMeasureExpectedID = performanceMeasureExpected.PerformanceMeasureExpectedID; this.PerformanceMeasureExpected = performanceMeasureExpected; performanceMeasureExpected.PerformanceMeasureExpectedSubcategoryOptions.Add(this); this.PerformanceMeasureSubcategoryOptionID = performanceMeasureSubcategoryOption.PerformanceMeasureSubcategoryOptionID; this.PerformanceMeasureSubcategoryOption = performanceMeasureSubcategoryOption; performanceMeasureSubcategoryOption.PerformanceMeasureExpectedSubcategoryOptions.Add(this); this.PerformanceMeasureID = performanceMeasure.PerformanceMeasureID; this.PerformanceMeasure = performanceMeasure; performanceMeasure.PerformanceMeasureExpectedSubcategoryOptions.Add(this); this.PerformanceMeasureSubcategoryID = performanceMeasureSubcategory.PerformanceMeasureSubcategoryID; this.PerformanceMeasureSubcategory = performanceMeasureSubcategory; performanceMeasureSubcategory.PerformanceMeasureExpectedSubcategoryOptions.Add(this); }
public static List <PerformanceMeasureActualSubcategoryOptionSimple> GetAllPossibleSubcategoryOptionsToActual(PerformanceMeasureExpected performanceMeasureExpected) { var allPossibleSubcategoryOptionsForPerformanceMeasureValue = GetAllPossibleSubcategoryOptionsForPerformanceMeasureValue(performanceMeasureExpected); return(allPossibleSubcategoryOptionsForPerformanceMeasureValue.Select(x => new PerformanceMeasureActualSubcategoryOptionSimple(x, performanceMeasureExpected)).ToList()); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static PerformanceMeasureExpectedSubcategoryOption CreateNewBlank(PerformanceMeasureExpected performanceMeasureExpected, PerformanceMeasureSubcategoryOption performanceMeasureSubcategoryOption, PerformanceMeasure performanceMeasure, PerformanceMeasureSubcategory performanceMeasureSubcategory) { return(new PerformanceMeasureExpectedSubcategoryOption(performanceMeasureExpected, performanceMeasureSubcategoryOption, performanceMeasure, performanceMeasureSubcategory)); }
public static void DeletePerformanceMeasureExpected(this IQueryable <PerformanceMeasureExpected> performanceMeasureExpecteds, PerformanceMeasureExpected performanceMeasureExpectedToDelete) { DeletePerformanceMeasureExpected(performanceMeasureExpecteds, new List <PerformanceMeasureExpected> { performanceMeasureExpectedToDelete }); }