Beispiel #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,
                                                  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)));
                    }
                });
            }
        }
 private PerformanceMeasureReportedValue(PerformanceMeasureActual performanceMeasureActual)
 {
     PerformanceMeasure = performanceMeasureActual.PerformanceMeasure;
     CalendarYear       = performanceMeasureActual.CalendarYear;
     ReportedValue      = performanceMeasureActual.ActualValue;
     Project            = performanceMeasureActual.Project;
     PerformanceMeasureActualSubcategoryOptions = new List <IPerformanceMeasureValueSubcategoryOption>(performanceMeasureActual.PerformanceMeasureActualSubcategoryOptions);
 }
 /// <summary>
 /// Constructor for building a new simple object with the POCO class
 /// </summary>
 public PerformanceMeasureActualSimple(PerformanceMeasureActual performanceMeasureActual)
     : this()
 {
     PerformanceMeasureActualID = performanceMeasureActual.PerformanceMeasureActualID;
     ProjectID            = performanceMeasureActual.ProjectID;
     PerformanceMeasureID = performanceMeasureActual.PerformanceMeasureID;
     CalendarYear         = performanceMeasureActual.CalendarYear;
     ActualValue          = performanceMeasureActual.ActualValue;
     PerformanceMeasureActualSubcategoryOptions = PerformanceMeasureValueSubcategoryOption.GetAllPossibleSubcategoryOptions(performanceMeasureActual);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public PerformanceMeasureActualSubcategoryOption(PerformanceMeasureActual performanceMeasureActual, PerformanceMeasureSubcategoryOption performanceMeasureSubcategoryOption, PerformanceMeasure performanceMeasure, PerformanceMeasureSubcategory performanceMeasureSubcategory) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.PerformanceMeasureActualSubcategoryOptionID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.PerformanceMeasureActualID = performanceMeasureActual.PerformanceMeasureActualID;
     this.PerformanceMeasureActual   = performanceMeasureActual;
     performanceMeasureActual.PerformanceMeasureActualSubcategoryOptions.Add(this);
     this.PerformanceMeasureSubcategoryOptionID = performanceMeasureSubcategoryOption.PerformanceMeasureSubcategoryOptionID;
     this.PerformanceMeasureSubcategoryOption   = performanceMeasureSubcategoryOption;
     performanceMeasureSubcategoryOption.PerformanceMeasureActualSubcategoryOptions.Add(this);
     this.PerformanceMeasureID = performanceMeasure.PerformanceMeasureID;
     this.PerformanceMeasure   = performanceMeasure;
     performanceMeasure.PerformanceMeasureActualSubcategoryOptions.Add(this);
     this.PerformanceMeasureSubcategoryID = performanceMeasureSubcategory.PerformanceMeasureSubcategoryID;
     this.PerformanceMeasureSubcategory   = performanceMeasureSubcategory;
     performanceMeasureSubcategory.PerformanceMeasureActualSubcategoryOptions.Add(this);
 }
Beispiel #6
0
        public static List <PerformanceMeasureActualSubcategoryOptionSimple> GetAllPossibleSubcategoryOptions(PerformanceMeasureActual performanceMeasureActual)
        {
            var allPossibleSubcategoryOptionsForPerformanceMeasureValue = GetAllPossibleSubcategoryOptionsForPerformanceMeasureValue(performanceMeasureActual);

            return(allPossibleSubcategoryOptionsForPerformanceMeasureValue.Select(x => new PerformanceMeasureActualSubcategoryOptionSimple(x, performanceMeasureActual)).ToList());
        }
 public PerformanceMeasureActualSubcategoryOptionSimple(PerformanceMeasureValueSubcategoryOption performanceMeasureActualSubcategoryOption, PerformanceMeasureActual performanceMeasureActual)
     : this(
         performanceMeasureActualSubcategoryOption.PrimaryKey,
         performanceMeasureActual.PerformanceMeasureActualID,
         performanceMeasureActualSubcategoryOption.PerformanceMeasureSubcategoryOptionID,
         performanceMeasureActualSubcategoryOption.PerformanceMeasure.PerformanceMeasureID,
         performanceMeasureActualSubcategoryOption.PerformanceMeasureSubcategory.PerformanceMeasureSubcategoryID)
 {
 }
Beispiel #8
0
 public static void DeletePerformanceMeasureActual(this IQueryable <PerformanceMeasureActual> performanceMeasureActuals, PerformanceMeasureActual performanceMeasureActualToDelete)
 {
     DeletePerformanceMeasureActual(performanceMeasureActuals, new List <PerformanceMeasureActual> {
         performanceMeasureActualToDelete
     });
 }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static PerformanceMeasureActualSubcategoryOption CreateNewBlank(PerformanceMeasureActual performanceMeasureActual, PerformanceMeasureSubcategoryOption performanceMeasureSubcategoryOption, PerformanceMeasure performanceMeasure, PerformanceMeasureSubcategory performanceMeasureSubcategory)
 {
     return(new PerformanceMeasureActualSubcategoryOption(performanceMeasureActual, performanceMeasureSubcategoryOption, performanceMeasure, performanceMeasureSubcategory));
 }