private static void SendMail(LogEvento log) { var configFile = Config.Mailing.MailingConfiguration; if (string.IsNullOrEmpty(configFile)) { throw new Exception("No pudo cargarse configuracion de mailing."); } var sender = new MailSender(configFile); var monitor = Config.Monitor.SubEntidadesMonitorLink; var link = string.Format(@"{0}?ID_SUBENTIDAD={1}", monitor, log.SubEntidad != null ? log.SubEntidad.Id : -1); var parameters = new List <string> { log.SubEntidad != null && log.SubEntidad.Linea != null ? log.SubEntidad.Linea.Descripcion : log.SubEntidad != null && log.SubEntidad.Empresa != null ? log.SubEntidad.Empresa.RazonSocial : "Sistema", log.SubEntidad != null ? log.SubEntidad.Descripcion : "", log.Sensor != null ? log.Sensor.Descripcion : "", GetFecha(log, true), AddresserHelper.GetDescripcionEsquinaMasCercana(log.SubEntidad != null ? log.SubEntidad.Entidad.ReferenciaGeografica.Latitude : 0, log.SubEntidad != null ? log.SubEntidad.Entidad.ReferenciaGeografica.Longitude : 0), log.Texto, link }; SendMailToAllDestinations(log, sender, parameters); }
/// <summary> /// Sends a mail with info about the event. /// </summary> /// <param name="log"></param> private static void SendMail(LogMensaje log) { var configFile = Config.Mailing.MailingConfiguration; if (string.IsNullOrEmpty(configFile)) { throw new Exception("No pudo cargarse configuracion de mailing."); } var sender = new MailSender(configFile); const int minutes = 15; var monitor = Config.Monitor.HistoricMonitorLink; var link = string.Format(@"{0}?Planta={1}&TypeMobile={2}&Movil={3}&InitialDate={4}&FinalDate={5}&MessageCenterIndex={6}&ShowMessages=1&Empresa={7}&ShowPOIS=1", monitor, log.Coche.Linea != null ? log.Coche.Linea.Id : -1, log.Coche.TipoCoche.Id, log.Coche.Id, log.Fecha.AddMinutes(-minutes).ToString(CultureInfo.InvariantCulture), log.Fecha.AddMinutes(minutes).ToString(CultureInfo.InvariantCulture), log.Id, log.Coche.Empresa != null ? log.Coche.Empresa.Id : log.Coche.Linea != null ? log.Coche.Linea.Empresa.Id : -1); var chofer = log.Chofer != null?string.Format("Chofer: {0}", log.Chofer.Entidad.Descripcion) : "Sin Chofer Identificado"; var responsable = log.Coche.Chofer != null && log.Coche.Chofer.Entidad != null ? log.Coche.Chofer.Entidad.Descripcion : "Sin Responsable Asignado"; var parameters = new List <string> { log.Coche.Linea != null ? log.Coche.Linea.Descripcion : log.Coche.Empresa != null ? log.Coche.Empresa.RazonSocial : "Sistema", string.Concat(log.Coche.Interno, " - ", chofer), responsable, GetFecha(log, true), AddresserHelper.GetDescripcionEsquinaMasCercana(log.Latitud, log.Longitud), log.Texto, link }; SendMailToAllDestinations(log, sender, parameters); }