private void HeaderControlButtonPrintDisplayerRequested(object sender, ReferenceEventArgs e) { if (sender == itemPrintReportStatusSchedule || sender == itemPrintReportStatusUnschedule) { MaintenanceStatusReportBuilder builder = new MaintenanceStatusReportBuilder(); string caption = CurrentAircraft.RegistrationNumber + "." + "Maintenance Status report"; builder.ReportedAircraft = CurrentAircraft; builder.LifelengthAircraftSinceNew = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); if (sender == itemPrintReportStatusSchedule) { builder.FilterSelection = true;//(Schedule) builder.ReportedDirectives = new MaintenanceCheckCollection(_checkItems.Where(c => c.Schedule).ToList()); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Status Schedule)"); } if (sender == itemPrintReportStatusUnschedule) { builder.FilterSelection = false;//(Unschedule) builder.ReportedDirectives = new MaintenanceCheckCollection(_checkItems.Where(c => c.Schedule == false).ToList()); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Status Store)"); } builder.ForecastData = null; e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; e.RequestedEntity = new ReportScreen(builder); } if (sender == itemPrintReportProgramSchedule || sender == itemPrintReportProgramUnschedule) { MaintenanceProgramReportBuilder builder = new MaintenanceProgramReportBuilder(); string caption = CurrentAircraft.RegistrationNumber + "." + "Maintenance Program report"; builder.ReportedAircraft = CurrentAircraft; builder.LifelengthAircraftSinceNew = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); if (sender == itemPrintReportProgramSchedule) { builder.FilterSelection = true;//(Schedule) builder.ReportedDirectives = new MaintenanceCheckCollection(_checkItems.Where(c => c.Schedule).ToList()); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Program Schedule)"); } if (sender == itemPrintReportProgramUnschedule) { builder.FilterSelection = false;//(Unschedule) builder.ReportedDirectives = new MaintenanceCheckCollection(_checkItems.Where(c => c.Schedule == false).ToList()); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Program Store)"); } builder.ForecastData = null; e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; e.RequestedEntity = new ReportScreen(builder); } if (sender == itemPrintReportRecords) { MaintenanceRecordReportBuilder builder = new MaintenanceRecordReportBuilder(); string caption = CurrentAircraft.RegistrationNumber + "." + "Maintenance Record report"; builder.ReportedAircraft = CurrentAircraft; builder.LifelengthAircraftSinceNew = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); builder.FilterSelection = true;//(Schedule) builder.ReportedDirectives = new MaintenanceCheckCollection(_checkItems.ToList()); builder.ForecastData = null; e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; e.RequestedEntity = new ReportScreen(builder); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Records)"); } if (sender == itemPrintReportHistory) { List <MaintenanceCheckRecord> records = new List <MaintenanceCheckRecord>(complianceControl.GetItemsArray()); MaintenanceHistoryReportBuilder builder = new MaintenanceHistoryReportBuilder(); string caption = CurrentAircraft.RegistrationNumber + "." + "Maintenance History report"; builder.ReportedAircraft = CurrentAircraft; builder.LifelengthAircraftSinceNew = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); builder.FilterSelection = true;//(Schedule) builder.ReportedDirectives = records; builder.ForecastData = null; e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; e.RequestedEntity = new ReportScreen(builder); GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "MaintenanceScreen (Compliance history)"); } }