public void HandleMessage(DeliverStatusReportCommand command) { Logger.DebugFormat("Received message command of type {0} ", command.GetType()); var statusReport = new ReportStatus(); try { NHibernateHelper.CreateSession(); Logger.Debug("Nhibernate session created"); ProcessGenerateDeliverStatusReportCommand(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); } }
private void ProcessGenerateDeliverStatusReportCommand(DeliverStatusReportCommand command, ReportStatus statusReport) { using ( var reportStream = ReportService.GenerateDeliverStatusReport(command, statusReport)) { if (reportStream == null) { ReportService.SendEmptyReport(command, command.ReportName, false); } ReportService.SendReport(reportStream, command, command.ReportName); } }
private void EnviarReporte(LogMensaje log) { var queue = GetMailReportMsmq(); IReportCommand reportCommand = null; var reportId = DaoFactory.ProgramacionReporteDAO.GetReportIdByReportName("MANUAL"); switch (log.Accion.Reporte) { case ProgramacionReporte.Reportes.EstadoEntregas: //var vehicles = new List<int> {log.Viaje.Vehiculo.Id}; //reportCommand = ReportService.CreateDeliverStatusReportCommand(reportId, log.Viaje.Empresa.Id, -1, log.Accion.DestinatariosMailReporte, // log.Fecha, log.Viaje.InicioReal.Value, vehicles); reportCommand = new DeliverStatusReportCommand { ReportId = reportId, //log.Id, CustomerId = log.Viaje.Empresa.Id, Email = log.Accion.DestinatariosMailReporte, FinalDate = log.Fecha, InitialDate = log.Viaje.InicioReal.Value, VehiclesId = new List <int> { log.Viaje.Vehiculo.Id }, ReportName = log.Viaje.Codigo }; break; default: break; } if (queue == null) { throw new ApplicationException("No se pudo acceder a la cola"); } if (reportCommand != null) { queue.Send(reportCommand); } }