public Convertidor ObtenerConvertidor(GRUPO_MENSAJE grupoMensaje, EnumTipoMensaje tipo) { switch (tipo) { case EnumTipoMensaje.Bitmap: return new ConvertidorISO8583(grupoMensaje); case EnumTipoMensaje.XML: return new ConvertidorXML(grupoMensaje); } return null; }
/// <summary> /// Procesa el mensaje a registrar en log /// </summary> /// <param name="message">Mensaje para el registro de log</param> /// <param name="logToFile">indica si se escribe en archivo</param> /// <param name="logToDatabase">indica si se escribe en base de datos</param> /// <param name="tipo">tipo de mensaje(1:INFO, 2:ALERTA, 3:ERROR)</param> public void LogMessage(string message, bool logToFile, bool logToDatabase, EnumTipoMensaje tipo) { message.Trim(); if (String.IsNullOrEmpty(message)) { return; } if (!logToFile && !logToDatabase) { throw new Exception("Código incorrecto"); } if (tipo != EnumTipoMensaje.ALERTA && tipo != EnumTipoMensaje.ERROR && tipo != EnumTipoMensaje.INFO) { throw new Exception("Especificar tipo de mensaje"); } Log log = new Log { Mensaje = message, Tipo = (int)tipo, Fecha = DateTime.Now }; if (logToDatabase) { this.tecsoLoggerToDatabase.InsertarLogEnBd(log); } if (logToFile) { this.tecsoLoggerToFile.EscribirLogEnArchivo(log); } //if (logToConsole) //{ // LogConsole(message); //} }
internal MensajeXML(EnumTipoMensaje tipo) : base(tipo) { }
public static void subEnviarMensaje(String psIdMensaje, String psAsunto, String psNextel, EnumTipoMensaje poTipo) { try { //se agrega un 0 al inicio para diferenciar un mensaje de un chat String parametros = "0|" + psIdMensaje + "|" + ((Int32)poTipo) + "|" + psAsunto; StringBuilder loSB = new StringBuilder(); loSB.Append(ConfigurationManager.AppSettings["urlPush3G"].ToString()).Append("?"); loSB.Append("nextel=").Append(psNextel).Append("&"); loSB.Append("cliente=").Append(ConfigurationManager.AppSettings["keyCliente3G"].ToString()).Append("&"); loSB.Append("mensaje=").Append(parametros); byte[] byteData = UTF8Encoding.UTF8.GetBytes(loSB.ToString()); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(loSB.ToString()); request.Method = "POST"; request.ContentLength = byteData.Length; using (Stream postStream = request.GetRequestStream()) { postStream.Write(byteData, 0, byteData.Length); } using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { StreamReader reader = new StreamReader(response.GetResponseStream()); string[] rpta = reader.ReadToEnd().Split('|'); if (!rpta[0].Equals("1")) { throw new Exception(rpta[1]); } reader.Close(); } } catch (Exception ex) { throw ex; } }
public CE_Mensaje(EnumTipoMensaje tipo, string valor) { Tipo = tipo; Valor = valor; }