public void Events_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case TwNotificationProperty.OnStartClassify: case TwNotificationProperty.OnStartMergeSplit: case TwNotificationProperty.OnStartApplyConversionFactor: fixtureSummariesOld = new FixtureSummaries(Analysis.Events); fixtureSummariesOld.Update(); break; case TwNotificationProperty.OnEndMergeSplit: UpdateFixturesSummaryPanels(fixtureSummariesOld, Analysis.FixtureSummaries); CollapseFixturePanels(fixtureSummariesOld); UpdateButtons(); break; case TwNotificationProperty.OnEndClassify: UpdateFixturesSummaryPanels(fixtureSummariesOld, Analysis.FixtureSummaries); CollapseFixturePanels(fixtureSummariesOld); UpdateButtons(); break; case TwNotificationProperty.OnEndSelect: UpdateSelectedCountLabels(); UpdateButtons(); break; case TwNotificationProperty.OnEndApplyConversionFactor: UpdateFixturesSummaryPanels(fixtureSummariesOld, Analysis.FixtureSummaries); UpdateButtons(); break; } }
public ProjectReportProperties CalculateProjectReportProperties(Events events, List <FixtureClass> fixtureClassesOutdoor) { Events = events; FixtureSummaries = new FixtureSummaries(Events); FixtureSummaries.Update(); List <FixtureClass> fixtureClassesIndoor = new List <FixtureClass>(); foreach (FixtureClass fixtureClass in FixtureClasses.Items.Values) { if (!fixtureClassesOutdoor.Contains(fixtureClass)) { fixtureClassesIndoor.Add(fixtureClass); } } var ProjectReportProperties = new ProjectReportProperties(); ProjectReportProperties.TotalVolume = Events.Volume; ProjectReportProperties.TraceBegins = Events.StartTime; ProjectReportProperties.TraceEnds = Events.EndTime; ProjectReportProperties.TraceLengthDays = Events.EndTime.Date.Subtract(Events.StartTime.Date).Days + 1; ProjectReportProperties.TotalGpd = Events.Volume / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.IndoorTotalGal = CalculateVolume(fixtureClassesIndoor); ProjectReportProperties.OutdoorTotalGal = CalculateVolume(fixtureClassesOutdoor); ProjectReportProperties.BathtubTotalGal = FixtureSummaries[FixtureClasses.Bathtub].Volume; ProjectReportProperties.ClotheswasherTotalGal = FixtureSummaries[FixtureClasses.Clotheswasher].Volume; ProjectReportProperties.CoolerTotalGal = FixtureSummaries[FixtureClasses.Cooler].Volume; ProjectReportProperties.DishwasherTotalGal = FixtureSummaries[FixtureClasses.Dishwasher].Volume; ProjectReportProperties.FaucetTotalGal = FixtureSummaries[FixtureClasses.Faucet].Volume; ProjectReportProperties.LeakTotalGal = FixtureSummaries[FixtureClasses.Leak].Volume; ProjectReportProperties.ShowerTotalGal = FixtureSummaries[FixtureClasses.Shower].Volume; ProjectReportProperties.ToiletTotalGal = FixtureSummaries[FixtureClasses.Toilet].Volume; ProjectReportProperties.TreatmentTotalGal = FixtureSummaries[FixtureClasses.Treatment].Volume; ProjectReportProperties.OtherTotalGal = ProjectReportProperties.IndoorTotalGal - FixtureSummaries[FixtureClasses.Bathtub].Volume - FixtureSummaries[FixtureClasses.Clotheswasher].Volume - FixtureSummaries[FixtureClasses.Cooler].Volume - FixtureSummaries[FixtureClasses.Dishwasher].Volume - FixtureSummaries[FixtureClasses.Faucet].Volume - FixtureSummaries[FixtureClasses.Leak].Volume - FixtureSummaries[FixtureClasses.Shower].Volume - FixtureSummaries[FixtureClasses.Toilet].Volume - FixtureSummaries[FixtureClasses.Treatment].Volume ; ProjectReportProperties.IndoorGpd = ProjectReportProperties.IndoorTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.OutdoorGpd = ProjectReportProperties.OutdoorTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.BathtubGpd = ProjectReportProperties.BathtubTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.ClotheswasherGpd = ProjectReportProperties.ClotheswasherTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.CoolerGpd = ProjectReportProperties.CoolerTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.DishwasherGpd = ProjectReportProperties.DishwasherTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.FaucetGpd = ProjectReportProperties.FaucetTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.LeakGpd = ProjectReportProperties.LeakTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.ShowerGpd = ProjectReportProperties.ShowerTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.ToiletGpd = ProjectReportProperties.ToiletTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.TreatmentGpd = ProjectReportProperties.TreatmentTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.OtherGpd = ProjectReportProperties.OtherTotalGal / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.BathtubEvents = FixtureSummaries[FixtureClasses.Bathtub].Count; ProjectReportProperties.ClotheswasherEvents = FixtureSummaries[FixtureClasses.Clotheswasher].FirstCycles; ProjectReportProperties.CoolerEvents = FixtureSummaries[FixtureClasses.Cooler].Count; ProjectReportProperties.DishwasherEvents = FixtureSummaries[FixtureClasses.Dishwasher].FirstCycles; ProjectReportProperties.FaucetEvents = FixtureSummaries[FixtureClasses.Faucet].Count; ProjectReportProperties.LeakEvents = FixtureSummaries[FixtureClasses.Leak].Count; ProjectReportProperties.ShowerEvents = FixtureSummaries[FixtureClasses.Shower].Count; ProjectReportProperties.ToiletEvents = FixtureSummaries[FixtureClasses.Toilet].Count; ProjectReportProperties.TreatmentEvents = FixtureSummaries[FixtureClasses.Treatment].Count; ProjectReportProperties.OtherEvents = CalculateEvents(fixtureClassesIndoor) - FixtureSummaries[FixtureClasses.Bathtub].Count - FixtureSummaries[FixtureClasses.Clotheswasher].Count - FixtureSummaries[FixtureClasses.Cooler].Count - FixtureSummaries[FixtureClasses.Dishwasher].Count - FixtureSummaries[FixtureClasses.Faucet].Count - FixtureSummaries[FixtureClasses.Leak].Count - FixtureSummaries[FixtureClasses.Shower].Count - FixtureSummaries[FixtureClasses.Toilet].Count - FixtureSummaries[FixtureClasses.Treatment].Count ; ProjectReportProperties.AverageClotheswasherLoadGal = ProjectReportProperties.ClotheswasherTotalGal / ProjectReportProperties.ClotheswasherEvents; ProjectReportProperties.ClotheswasherLoadsPerDay = ((double)ProjectReportProperties.ClotheswasherEvents) / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.TotalShowerMinutes = CalculateTotalMinutes(FixtureClasses.Shower); ProjectReportProperties.AverageShowerSeconds = (ProjectReportProperties.TotalShowerMinutes / ProjectReportProperties.ShowerEvents) * 60; ProjectReportProperties.TotalShowerGal = ProjectReportProperties.ShowerTotalGal; ProjectReportProperties.AverageShowerGal = ProjectReportProperties.ShowerTotalGal / ProjectReportProperties.ShowerEvents; ProjectReportProperties.AverageShowerModeFlowGpm = CalculateMeanMode(FixtureClasses.Shower); ProjectReportProperties.ShowersPerDay = ((double)FixtureSummaries[FixtureClasses.Shower].Count) / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.ShowerMinutesPerDay = ProjectReportProperties.TotalShowerMinutes / ProjectReportProperties.TraceLengthDays; ProjectReportProperties.AverageToiletFlushVolume = ProjectReportProperties.ToiletTotalGal / ProjectReportProperties.ToiletEvents; ProjectReportProperties.ToiletFlushStDev = CalculateVolumeStandardDeviation(FixtureClasses.Toilet); ProjectReportProperties.NumberOfToiletFlushesLessThan2Point2Gal = CalculateToiletEventsLessThan(2.2);; ProjectReportProperties.NumberOfToiletFlushesGreaterThan2Point2Gal = ProjectReportProperties.ToiletEvents - ProjectReportProperties.NumberOfToiletFlushesLessThan2Point2Gal; ProjectReportProperties.FlushesPerDay = ((double)ProjectReportProperties.ToiletEvents) / ProjectReportProperties.TraceLengthDays; return(ProjectReportProperties); }