public void CurrentWeek() { StartOfWeek = DateTime.Now.StartOfWeek(); AddToList(_foodRepository.GetRange(StartOfWeek, StartOfWeek.AddDays(5))); NotifyOfPropertyChange(() => CanPreviousWeek); NotifyOfPropertyChange(() => CanPreviousTwoWeeks); }
private IEnumerable <Food> MoveCurrentWeek(int days) { StartOfWeek = StartOfWeek.AddDays(days); NotifyOfPropertyChange(() => CanPreviousWeek); NotifyOfPropertyChange(() => CanPreviousTwoWeeks); return(_foodRepository.GetRange(StartOfWeek, EndOfWeek)); }
public ExaminationsViewModel() { int day = (int)DateTime.Now.DayOfWeek; StartOfWeek = DateTime.Now.AddDays(-day + 1); WeekString = StartOfWeek.ToString("dd.MM.") + " - " + StartOfWeek.AddDays(7).ToString("dd.MM."); PopulateWeek(); }
protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}"); toStringOutput.Add($"StartOfWeek = {(StartOfWeek == null ? "null" : StartOfWeek.ToString())}"); toStringOutput.Add($"StartOfDayLocalTime = {(StartOfDayLocalTime == null ? "null" : StartOfDayLocalTime == string.Empty ? "" : StartOfDayLocalTime)}"); toStringOutput.Add($"Version = {(Version == null ? "null" : Version.ToString())}"); toStringOutput.Add($"CreatedAt = {(CreatedAt == null ? "null" : CreatedAt == string.Empty ? "" : CreatedAt)}"); toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}"); }
public PrognoseWeekVM(int days) { StartOfWeek = DateTime.Now.Date; var result = new List <PrognoseDayVM>(); for (int i = 1; i <= days; i++) { result.Add(new PrognoseDayVM() { DagVanPrognose = StartOfWeek.AddDays(i) }); } PrognoseDays = result; }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is WorkweekConfig other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((StartOfWeek == null && other.StartOfWeek == null) || (StartOfWeek?.Equals(other.StartOfWeek) == true)) && ((StartOfDayLocalTime == null && other.StartOfDayLocalTime == null) || (StartOfDayLocalTime?.Equals(other.StartOfDayLocalTime) == true)) && ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true))); }
public override int GetHashCode() { int hashCode = 1176790268; if (Id != null) { hashCode += Id.GetHashCode(); } if (StartOfWeek != null) { hashCode += StartOfWeek.GetHashCode(); } if (StartOfDayLocalTime != null) { hashCode += StartOfDayLocalTime.GetHashCode(); } if (Version != null) { hashCode += Version.GetHashCode(); } if (CreatedAt != null) { hashCode += CreatedAt.GetHashCode(); } if (UpdatedAt != null) { hashCode += UpdatedAt.GetHashCode(); } return(hashCode); }
private void OnDoCommence(object sender, CommenceArgs e) { Today = StartDate; if (DoInitialSummary != null) { DoInitialSummary.Invoke(this, args); } if (StartOfSimulation != null) { StartOfSimulation.Invoke(this, args); } if (CLEMInitialiseResource != null) { CLEMInitialiseResource.Invoke(this, args); } if (CLEMInitialiseActivity != null) { CLEMInitialiseActivity.Invoke(this, args); } if (FinalInitialise != null) { FinalInitialise.Invoke(this, args); } if (CLEMValidate != null) { CLEMValidate.Invoke(this, args); } while (Today <= EndDate && (e.CancelToken == null || !e.CancelToken.IsCancellationRequested)) { if (DoWeather != null) { DoWeather.Invoke(this, args); } if (DoDailyInitialisation != null) { DoDailyInitialisation.Invoke(this, args); } if (StartOfDay != null) { StartOfDay.Invoke(this, args); } if (Today.Day == 1 && StartOfMonth != null) { StartOfMonth.Invoke(this, args); } if (Today.DayOfYear == 1 && StartOfYear != null) { StartOfYear.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Sunday && StartOfWeek != null) { StartOfWeek.Invoke(this, args); } if (DoManagement != null) { DoManagement.Invoke(this, args); } if (DoPestDiseaseDamage != null) { DoPestDiseaseDamage.Invoke(this, args); } if (DoEnergyArbitration != null) { DoEnergyArbitration.Invoke(this, args); } if (DoSoilWaterMovement != null) { DoSoilWaterMovement.Invoke(this, args); } if (DoSoilTemperature != null) { DoSoilTemperature.Invoke(this, args); } if (DoSoilOrganicMatter != null) { DoSoilOrganicMatter.Invoke(this, args); } if (DoSurfaceOrganicMatterDecomposition != null) { DoSurfaceOrganicMatterDecomposition.Invoke(this, args); } if (DoUpdateWaterDemand != null) { DoUpdateWaterDemand.Invoke(this, args); } if (DoWaterArbitration != null) { DoWaterArbitration.Invoke(this, args); } if (PrePhenology != null) { PrePhenology.Invoke(this, args); } if (DoPhenology != null) { DoPhenology.Invoke(this, args); } if (DoPotentialPlantGrowth != null) { DoPotentialPlantGrowth.Invoke(this, args); } if (DoPotentialPlantPartioning != null) { DoPotentialPlantPartioning.Invoke(this, args); } if (DoNutrientArbitration != null) { DoNutrientArbitration.Invoke(this, args); } if (DoActualPlantPartioning != null) { DoActualPlantPartioning.Invoke(this, args); } if (DoActualPlantGrowth != null) { DoActualPlantGrowth.Invoke(this, args); } if (DoStock != null) { DoStock.Invoke(this, args); } if (DoLifecycle != null) { DoLifecycle.Invoke(this, args); } if (DoUpdate != null) { DoUpdate.Invoke(this, args); } if (DoManagementCalculations != null) { DoManagementCalculations.Invoke(this, args); } if (DoReportCalculations != null) { DoReportCalculations.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Saturday && EndOfWeek != null) { EndOfWeek.Invoke(this, args); } if (Today.Day == 31 && Today.Month == 12 && EndOfYear != null) { EndOfYear.Invoke(this, args); } if (Today.AddDays(1).Day == 1 && EndOfMonth != null) // is tomorrow the start of a new month? { // CLEM events performed before APSIM EndOfMonth if (CLEMStartOfTimeStep != null) { CLEMStartOfTimeStep.Invoke(this, args); } if (CLEMUpdateLabourAvailability != null) { CLEMUpdateLabourAvailability.Invoke(this, args); } if (CLEMUpdatePasture != null) { CLEMUpdatePasture.Invoke(this, args); } if (CLEMPastureReady != null) { CLEMPastureReady.Invoke(this, args); } if (CLEMDoCutAndCarry != null) { CLEMDoCutAndCarry.Invoke(this, args); } if (CLEMAnimalBreeding != null) { CLEMAnimalBreeding.Invoke(this, args); } if (CLEMAnimalMilkProduction != null) { CLEMAnimalMilkProduction.Invoke(this, args); } if (CLEMPotentialIntake != null) { CLEMPotentialIntake.Invoke(this, args); } if (CLEMGetResourcesRequired != null) { CLEMGetResourcesRequired.Invoke(this, args); } if (CLEMAnimalWeightGain != null) { CLEMAnimalWeightGain.Invoke(this, args); } if (CLEMCalculateManure != null) { CLEMCalculateManure.Invoke(this, args); } if (CLEMCollectManure != null) { CLEMCollectManure.Invoke(this, args); } if (CLEMAnimalDeath != null) { CLEMAnimalDeath.Invoke(this, args); } if (CLEMAnimalMilking != null) { CLEMAnimalMilking.Invoke(this, args); } if (CLEMCalculateEcologicalState != null) { CLEMCalculateEcologicalState.Invoke(this, args); } if (CLEMAnimalManage != null) { CLEMAnimalManage.Invoke(this, args); } if (CLEMAnimalStock != null) { CLEMAnimalStock.Invoke(this, args); } if (CLEMAnimalSell != null) { CLEMAnimalSell.Invoke(this, args); } if (CLEMDetachPasture != null) { CLEMDetachPasture.Invoke(this, args); } if (CLEMHerdSummary != null) { CLEMHerdSummary.Invoke(this, args); } if (CLEMAgeResources != null) { CLEMAgeResources.Invoke(this, args); } if (CLEMAnimalBuy != null) { CLEMAnimalBuy.Invoke(this, args); } if (CLEMEndOfTimeStep != null) { CLEMEndOfTimeStep.Invoke(this, args); } EndOfMonth.Invoke(this, args); } if (EndOfDay != null) { EndOfDay.Invoke(this, args); } if (DoReport != null) { DoReport.Invoke(this, args); } Today = Today.AddDays(1); } Today = EndDate; if (EndOfSimulation != null) { EndOfSimulation.Invoke(this, args); } Summary?.WriteMessage(this, "Simulation terminated normally"); }
private void OnDoCommence(object sender, Simulation.CommenceArgs e) { if (DoInitialSummary != null) { DoInitialSummary.Invoke(this, args); } if (StartOfSimulation != null) { StartOfSimulation.Invoke(this, args); } while (Today <= EndDate) { // If this is being run on a background worker thread then check for cancellation if (e != null && e.workerThread != null && e.workerThread.CancellationPending) { Summary.WriteMessage(this, "Simulation cancelled"); return; } if (DoWeather != null) { DoWeather.Invoke(this, args); } if (DoDailyInitialisation != null) { DoDailyInitialisation.Invoke(this, args); } if (StartOfDay != null) { StartOfDay.Invoke(this, args); } if (Today.Day == 1 && StartOfMonth != null) { StartOfMonth.Invoke(this, args); } if (Today.DayOfYear == 1 && StartOfYear != null) { StartOfYear.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Sunday && StartOfWeek != null) { StartOfWeek.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Saturday && EndOfWeek != null) { EndOfWeek.Invoke(this, args); } if (DoManagement != null) { DoManagement.Invoke(this, args); } if (DoEnergyArbitration != null) { DoEnergyArbitration.Invoke(this, args); } if (DoSoilWaterMovement != null) { DoSoilWaterMovement.Invoke(this, args); } if (DoSoilTemperature != null) { DoSoilTemperature.Invoke(this, args); } if (DoSoilOrganicMatter != null) { DoSoilOrganicMatter.Invoke(this, args); } if (DoSurfaceOrganicMatterDecomposition != null) { DoSurfaceOrganicMatterDecomposition.Invoke(this, args); } if (Today.DayOfYear == 16) { } if (DoWaterArbitration != null) { DoWaterArbitration.Invoke(this, args); } if (DoPhenology != null) { DoPhenology.Invoke(this, args); } if (DoPotentialPlantGrowth != null) { DoPotentialPlantGrowth.Invoke(this, args); } if (DoPotentialPlantPartioning != null) { DoPotentialPlantPartioning.Invoke(this, args); } if (DoNutrientArbitration != null) { DoNutrientArbitration.Invoke(this, args); } if (DoActualPlantPartioning != null) { DoActualPlantPartioning.Invoke(this, args); } if (DoActualPlantGrowth != null) { DoActualPlantGrowth.Invoke(this, args); } if (DoPlantGrowth != null) { DoPlantGrowth.Invoke(this, args); } if (DoUpdate != null) { DoUpdate.Invoke(this, args); } if (DoManagementCalculations != null) { DoManagementCalculations.Invoke(this, args); } if (DoStock != null) { DoStock.Invoke(this, args); } if (DoLifecycle != null) { DoLifecycle.Invoke(this, args); } if (DoReportCalculations != null) { DoReportCalculations.Invoke(this, args); } if (Today == EndDate && EndOfSimulation != null) { EndOfSimulation.Invoke(this, args); } if (Today.Day == 31 && Today.Month == 12 && EndOfYear != null) { EndOfYear.Invoke(this, args); } if (Today.AddDays(1).Day == 1 && EndOfMonth != null) // is tomorrow the start of a new month? { // WholeFarm events performed before APSIM EndOfMonth if (WFUpdatePasture != null) { WFUpdatePasture.Invoke(this, args); } if (WFDoCutAndCarry != null) { WFDoCutAndCarry.Invoke(this, args); } if (WFAnimalBreeding != null) { WFAnimalBreeding.Invoke(this, args); } if (WFPotentialIntake != null) { WFPotentialIntake.Invoke(this, args); } if (WFGetResourcesRequired != null) { WFGetResourcesRequired.Invoke(this, args); } if (WFAnimalMilkProduction != null) { WFAnimalMilkProduction.Invoke(this, args); } if (WFAnimalWeightGain != null) { WFAnimalWeightGain.Invoke(this, args); } if (WFAnimalDeath != null) { WFAnimalDeath.Invoke(this, args); } if (WFAnimalMilking != null) { WFAnimalMilking.Invoke(this, args); } if (WFAnimalManage != null) { WFAnimalManage.Invoke(this, args); } if (WFAnimalStock != null) { WFAnimalStock.Invoke(this, args); } if (WFAnimalSell != null) { WFAnimalSell.Invoke(this, args); } if (WFAgeResources != null) { WFAgeResources.Invoke(this, args); } EndOfMonth.Invoke(this, args); } if (EndOfDay != null) { EndOfDay.Invoke(this, args); } if (DoReport != null) { DoReport.Invoke(this, args); } Today = Today.AddDays(1); } Summary.WriteMessage(this, "Simulation terminated normally"); }
private void OnDoCommence(object sender, Core.Runners.RunSimulation.CommenceArgs e) { try { if (DoInitialSummary != null) { DoInitialSummary.Invoke(this, args); } if (StartOfSimulation != null) { StartOfSimulation.Invoke(this, args); } while (Today <= EndDate && !e.CancelToken.IsCancellationRequested) { if (DoWeather != null) { DoWeather.Invoke(this, args); } if (DoDailyInitialisation != null) { DoDailyInitialisation.Invoke(this, args); } if (StartOfDay != null) { StartOfDay.Invoke(this, args); } if (Today.Day == 1 && StartOfMonth != null) { StartOfMonth.Invoke(this, args); } if (Today.DayOfYear == 1 && StartOfYear != null) { StartOfYear.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Sunday && StartOfWeek != null) { StartOfWeek.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Saturday && EndOfWeek != null) { EndOfWeek.Invoke(this, args); } if (DoManagement != null) { DoManagement.Invoke(this, args); } if (DoEnergyArbitration != null) { DoEnergyArbitration.Invoke(this, args); } if (DoSoilWaterMovement != null) { DoSoilWaterMovement.Invoke(this, args); } if (DoSoilTemperature != null) { DoSoilTemperature.Invoke(this, args); } if (DoSoilOrganicMatter != null) { DoSoilOrganicMatter.Invoke(this, args); } if (DoSurfaceOrganicMatterDecomposition != null) { DoSurfaceOrganicMatterDecomposition.Invoke(this, args); } if (DoWaterArbitration != null) { DoWaterArbitration.Invoke(this, args); } if (DoPhenology != null) { DoPhenology.Invoke(this, args); } if (DoPotentialPlantGrowth != null) { DoPotentialPlantGrowth.Invoke(this, args); } if (DoPotentialPlantPartioning != null) { DoPotentialPlantPartioning.Invoke(this, args); } if (DoNutrientArbitration != null) { DoNutrientArbitration.Invoke(this, args); } if (DoActualPlantPartioning != null) { DoActualPlantPartioning.Invoke(this, args); } if (DoActualPlantGrowth != null) { DoActualPlantGrowth.Invoke(this, args); } if (DoPlantGrowth != null) { DoPlantGrowth.Invoke(this, args); } if (DoUpdate != null) { DoUpdate.Invoke(this, args); } if (DoManagementCalculations != null) { DoManagementCalculations.Invoke(this, args); } if (DoStock != null) { DoStock.Invoke(this, args); } if (DoLifecycle != null) { DoLifecycle.Invoke(this, args); } if (DoReportCalculations != null) { DoReportCalculations.Invoke(this, args); } if (Today == EndDate && EndOfSimulation != null) { EndOfSimulation.Invoke(this, args); } if (Today.Day == 31 && Today.Month == 12 && EndOfYear != null) { EndOfYear.Invoke(this, args); } if (Today.AddDays(1).Day == 1 && EndOfMonth != null) // is tomorrow the start of a new month? { // WholeFarm events performed before APSIM EndOfMonth if (WFUpdatePasture != null) { WFUpdatePasture.Invoke(this, args); } if (WFDoCutAndCarry != null) { WFDoCutAndCarry.Invoke(this, args); } if (WFAnimalBreeding != null) { WFAnimalBreeding.Invoke(this, args); } if (WFPotentialIntake != null) { WFPotentialIntake.Invoke(this, args); } if (WFGetResourcesRequired != null) { WFGetResourcesRequired.Invoke(this, args); } if (WFAnimalMilkProduction != null) { WFAnimalMilkProduction.Invoke(this, args); } if (WFAnimalWeightGain != null) { WFAnimalWeightGain.Invoke(this, args); } if (WFAnimalDeath != null) { WFAnimalDeath.Invoke(this, args); } if (WFAnimalMilking != null) { WFAnimalMilking.Invoke(this, args); } if (WFAnimalManage != null) { WFAnimalManage.Invoke(this, args); } if (WFAnimalStock != null) { WFAnimalStock.Invoke(this, args); } if (WFAnimalSell != null) { WFAnimalSell.Invoke(this, args); } if (WFAgeResources != null) { WFAgeResources.Invoke(this, args); } EndOfMonth.Invoke(this, args); } if (EndOfDay != null) { EndOfDay.Invoke(this, args); } if (DoReport != null) { DoReport.Invoke(this, args); } Today = Today.AddDays(1); } Summary.WriteMessage(this, "Simulation terminated normally"); } catch (Exception ex) { Summary.WriteMessage(this, "Simulation terminated due to exception: " + ex.Message); // Is there a good mechanism for letting our invoker know that an error has occurred? // Throwing this back to the caller doesn't seem to work. This seems to be a consequence // of the Invoke method used to call us crossing the native/managed boundary. I'm not // sure why this is so... // throw ex; } }
private void PopulateWeek() { DaysOfWeek.Clear(); DayStrings.Clear(); for (int i = 0; i <= 6; i++) { DateTime dayOfWeek = StartOfWeek.AddDays(i); DaysOfWeek.Add(dayOfWeek); DayStrings.Add(dayOfWeek.ToString("dd.MM.yyyy")); DayNotEmpty[i] = false; } OnPropertyChanged("DayStrings"); MondayAppointments = new ObservableCollection <Appointment>(); TuesdayAppointments = new ObservableCollection <Appointment>(); WednesdayAppointments = new ObservableCollection <Appointment>(); ThursdayAppointments = new ObservableCollection <Appointment>(); FridayAppointments = new ObservableCollection <Appointment>(); SaturdayAppointments = new ObservableCollection <Appointment>(); SundayAppointments = new ObservableCollection <Appointment>(); foreach (Appointment a in AppointmentsDB.Instance.Appointments) { if (a.StartTime.Date == DaysOfWeek[0].Date) { MondayAppointments.Add(a); DayNotEmpty[0] = true; } else if (a.StartTime.Date == DaysOfWeek[1].Date) { TuesdayAppointments.Add(a); DayNotEmpty[1] = true; } else if (a.StartTime.Date == DaysOfWeek[2].Date) { WednesdayAppointments.Add(a); DayNotEmpty[2] = true; } else if (a.StartTime.Date == DaysOfWeek[3].Date) { ThursdayAppointments.Add(a); DayNotEmpty[3] = true; } else if (a.StartTime.Date == DaysOfWeek[4].Date) { FridayAppointments.Add(a); DayNotEmpty[4] = true; } else if (a.StartTime.Date == DaysOfWeek[5].Date) { SaturdayAppointments.Add(a); DayNotEmpty[5] = true; } else if (a.StartTime.Date == DaysOfWeek[6].Date) { SundayAppointments.Add(a); DayNotEmpty[6] = true; } OnPropertyChanged("SundayAppointments"); OnPropertyChanged("SaturdayAppointments"); OnPropertyChanged("FridayAppointments"); OnPropertyChanged("ThursdayAppointments"); OnPropertyChanged("WednesdayAppointments"); OnPropertyChanged("TuesdayAppointments"); OnPropertyChanged("MondayAppointments"); OnPropertyChanged("DayNotEmpty"); } }
private static (DateTime startDate, DateTime endDate) BetweenOfCurrentWeek(DateTime somedate, StartOfWeek sw = StartOfWeek.Sunday) { var dayOfWeek = (int)somedate.DayOfWeek - (int)sw; var startOfWeek = somedate.Date.AddDays(-1 * dayOfWeek); var endOfWeek = somedate.Date.AddDays(7 - dayOfWeek).AddSeconds(-1); return(startOfWeek, endOfWeek); }
public static IEnumerable <Holiday> NextWeek(StartOfWeek sw = StartOfWeek.Sunday) { var between = BetweenOfCurrentWeek(DateTime.Today.AddDays(7), sw); return(Between(between.startDate, between.endDate)); }
private void OnDoCommence(object sender, EventArgs e) { System.ComponentModel.BackgroundWorker bw = sender as System.ComponentModel.BackgroundWorker; if (DoInitialSummary != null) { DoInitialSummary.Invoke(this, args); } if (StartOfSimulation != null) { StartOfSimulation.Invoke(this, args); } while (Today <= EndDate) { // If this is being run on a background worker thread then check for cancellation if (bw != null && bw.CancellationPending) { Summary.WriteMessage(this, "Simulation cancelled"); return; } if (DoWeather != null) { DoWeather.Invoke(this, args); } if (DoDailyInitialisation != null) { DoDailyInitialisation.Invoke(this, args); } if (StartOfDay != null) { StartOfDay.Invoke(this, args); } if (Today.Day == 1 && StartOfMonth != null) { StartOfMonth.Invoke(this, args); } if (Today.DayOfYear == 1 && StartOfYear != null) { StartOfYear.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Sunday && StartOfWeek != null) { StartOfWeek.Invoke(this, args); } if (Today.DayOfWeek == DayOfWeek.Saturday && EndOfWeek != null) { EndOfWeek.Invoke(this, args); } if (DoManagement != null) { DoManagement.Invoke(this, args); } if (DoEnergyArbitration != null) { DoEnergyArbitration.Invoke(this, args); } if (DoSoilWaterMovement != null) { DoSoilWaterMovement.Invoke(this, args); } if (DoSoilOrganicMatter != null) { DoSoilOrganicMatter.Invoke(this, args); } if (DoSurfaceOrganicMatterDecomposition != null) { DoSurfaceOrganicMatterDecomposition.Invoke(this, args); } if (Today.DayOfYear == 16) { } if (DoWaterArbitration != null) { DoWaterArbitration.Invoke(this, args); } if (DoPhenology != null) { DoPhenology.Invoke(this, args); } if (DoPotentialPlantGrowth != null) { DoPotentialPlantGrowth.Invoke(this, args); } if (DoPotentialPlantPartioning != null) { DoPotentialPlantPartioning.Invoke(this, args); } if (DoNutrientArbitration != null) { DoNutrientArbitration.Invoke(this, args); } if (DoActualPlantPartioning != null) { DoActualPlantPartioning.Invoke(this, args); } if (DoActualPlantGrowth != null) { DoActualPlantGrowth.Invoke(this, args); } if (DoPlantGrowth != null) { DoPlantGrowth.Invoke(this, args); } if (DoUpdate != null) { DoUpdate.Invoke(this, args); } if (DoManagementCalculations != null) { DoManagementCalculations.Invoke(this, args); } if (DoReportCalculations != null) { DoReportCalculations.Invoke(this, args); } if (Today == EndDate && EndOfSimulation != null) { EndOfSimulation.Invoke(this, args); } if (Today.Day == 31 && Today.Month == 12 && EndOfYear != null) { EndOfYear.Invoke(this, args); } if (Today.AddDays(1).Day == 1 && EndOfMonth != null) // is tomorrow the start of a new month? { EndOfMonth.Invoke(this, args); } if (EndOfDay != null) { EndOfDay.Invoke(this, args); } if (DoReport != null) { DoReport.Invoke(this, args); } Today = Today.AddDays(1); } Summary.WriteMessage(this, "Simulation terminated normally"); }