/// <summary> /// Metodo utilizado para mandar un error a el departamento de sistemas /// </summary> /// <param name="ex"></param> /// <param name="pIdParametroSistemaDetalle"></param> /// <returns></returns> protected NotificacionEmail TraerDatosNotificacionError(NotificacionEmail pNotiex, int pIdParametroSistemaDetalle) { NotificacionEmail NE = new NotificacionEmail(); try { switch (Tipo) { case 0: NotificacionEmailDA NDA = new NotificacionEmailDA(ConGenral); this.MyNotificacionEmail = NDA.TraerDatosNotificacion(pIdParametroSistemaDetalle); this.MyNotificacionEmail.AsuntoMensaje = "Error de Sistema : " +pNotiex.AsuntoMensaje; break; case 1: this.MyNotificacionEmail = new NotificacionEmail(1, "*****@*****.**", "*****@*****.**", "Error de Sistema : " + pNotiex.AsuntoMensaje ,"<table> <tbody> <tr> <td>Este es un Mensaje Generado Automaticamente <b>DLOG</b></td></tr> <tr> <td><br /> </td></tr> <tr> <td>Tienes un Nuevo Caso Con las Siguientes Caracteristicas:</td></tr> <tr> <td><br /> </td></tr> <tr> <td><br /> </td></tr> <tr> <td> <table> <tbody> <tr> <td><b>Mensaje de Excepcion:</b></td> <td>{0}</td></tr> <tr> <td><b>Fuente de Excepcion:</b></td> <td>{1}</td></tr> <tr> <td><b>Excepción Interna:</b></td> <td>{2}</td></tr> <tr> <td><b>Ocurrió: </b></td> <td>{3}</td></tr> <tr> <td><b>Procedimiento que la genero: </b></td> <td>{4}</td></tr> <tr> <td><b>Fecha en que ocurrió:</b></td> <td>{5}</td></tr> <tr> <td><b>Hora en que ocurrió:</b></td> <td>{6}</td></tr> <tr> <td><b>Maquina:</b></td> <td>{7}</td></tr> <tr> <td><b>IP:</b></td> <td>{8}</td></tr></tbody></table></td></tr> <tr> <td><br /> </td></tr> <tr> <td><br /> </td></tr> <tr> <td> <p>******************************FIN DE MENSAJE***************************</p></td></tr> <tr> <td><br /> </td></tr> <tr> <td><br /> </td></tr> <tr> <td><br /> </td></tr> <tr> <td><b>Favor de No Responder a este Correo</b></td></tr></tbody></table>" ,"Error Sistema"); this.MyNotificacionEmail.CopiaPara = new List<string>(); this.MyNotificacionEmail.CopiaPara.Add("*****@*****.**"); this.MyNotificacionEmail.CopiaPara.Add("*****@*****.**"); break; default: break; } } catch (Exception e) { throw new ExceptionNotificacionEmail("No Fue posible Traer Los datos para Notificacion de Error" +" || " + e); } ///Lleno el formato del correo con las variables ya establecidas en el formato de la BD. if (pNotiex.Exception != null) { try { string NombreDeMaquina = System.Net.Dns.GetHostName(); System.Net.IPAddress[] Ip = System.Net.Dns.GetHostAddresses(NombreDeMaquina); this.MyNotificacionEmail.CuerpoMensaje = string.Format(this.MyNotificacionEmail.CuerpoMensaje , string.IsNullOrEmpty(pNotiex.Exception.Message.ToString()) ? "" : pNotiex.Exception.Message.ToString() , pNotiex.Exception.Source == null ? "" : pNotiex.Exception.Source.ToString() , pNotiex.Exception.InnerException == null ? "" : pNotiex.Exception.InnerException.ToString() , pNotiex.Exception.StackTrace == null ? "" : pNotiex.Exception.StackTrace.ToString() , pNotiex.Exception.TargetSite == null ? "" : pNotiex.Exception.TargetSite.ToString() , System.DateTime.Now.ToShortDateString() , System.DateTime.Now.ToShortTimeString() , NombreDeMaquina,Ip[0].ToString()); } catch (Exception e) { throw; } } else { throw new ExceptionParametroNulo("el Parametro no puede ser nulo ," + "Exception ex"); } return this.MyNotificacionEmail; }
/// <summary> /// metodo utilizado para traer un formato de notificacion deseado. /// </summary> /// <param name="pIdParametroSistemaDetalle"></param> /// <returns></returns> public NotificacionEmail TraerDatosNotificacion(int pIdParametroSistemaDetalle) { try { NotificacionEmailDA NDA = new NotificacionEmailDA(ConGenral); this.MyNotificacionEmail = NDA.TraerDatosNotificacion(pIdParametroSistemaDetalle); } catch (Exception e) { ExceptionNotificacionEmail NotificacionException = new ExceptionNotificacionEmail("El Metodo TraerDatosNotificacion fallo" + " || " + e); NotificacionEmail notificacion = new NotificacionEmail("Error en SMEHL", NotificacionException); notificacion.TipoNotificacion = EnumTipoNotificacion.Error; NotificacionEmailService NS = new NotificacionEmailService(ConGenral); NS.EnviarNotificacion(notificacion); throw NotificacionException; } return this.MyNotificacionEmail; }