private void ProcessGenerateDriversInfractionsReportCommand(DriversInfractionsReportCommand command, ReportStatus statusReport) { if (ProgramacionReporte.FormatoReporte.Excel.Equals(command.ReportFormat)) { using (var reportStream = ReportService.GenerateDriversInfractionReport(command, statusReport)) { if (reportStream == null) { ReportService.SendEmptyReport(command, command.ReportName, false); } ReportService.SendReport(reportStream, command, command.ReportName); } } else { var report = ReportService.GenerateSummarizedDriversInfractionReport(command, statusReport); if (report == null) { ReportService.SendEmptyReport(command, command.ReportName, false); } ReportService.SendHtmlReport(report, command.Email, command.ReportName); } }
public void HandleMessage(DriversInfractionsReportCommand command) { Logger.DebugFormat("Received message command of type {0} ", command.GetType()); var statusReport = new ReportStatus(); try { NHibernateHelper.CreateSession(); Logger.Debug("Nhibernate session created"); ProcessGenerateDriversInfractionsReportCommand(command, statusReport); NHibernateHelper.CloseSession(); Logger.Debug("Nhibernate close session"); } catch (Exception e) { statusReport.Error = true; Logger.Error(e); ReportService.NotifyError(command, e.Message); throw; } finally { ReportService.LogReportExecution(command.ReportId, statusReport); } }