Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public string notificaFallaDetalle(string Atencion, string Solicitud, string Cups, string mensaje)
        {
            string        respuesta = string.Empty;
            string        _mensaje  = DateTime.Now.ToString() + mensaje;
            string        celular   = Properties.Resources.nroReporte;
            SqlConnection conexion  = new SqlConnection(Properties.Settings.Default.DBConexion);

            using (conexion)
            {
                conexion.Open();
                string     strValidaMSG = "SELECT  FECHA_MSG FROM TAT_MSG_CEL_ENV WHERE ATEN_MSG=@atencion AND SOLI_MSG=@solicitud AND CUPS_MSG=@cups";
                SqlCommand cmdValidaMSG = new SqlCommand(strValidaMSG, conexion);
                cmdValidaMSG.Parameters.Add("@atencion", SqlDbType.VarChar);
                cmdValidaMSG.Parameters.Add("@solicitud", SqlDbType.VarChar);
                cmdValidaMSG.Parameters.Add("@cups", SqlDbType.VarChar);
                cmdValidaMSG.Parameters["@atencion"].Value  = Atencion;
                cmdValidaMSG.Parameters["@solicitud"].Value = Solicitud;
                cmdValidaMSG.Parameters["@cups"].Value      = Cups;
                SqlDataReader rdValidaMSG = cmdValidaMSG.ExecuteReader();
                if (!rdValidaMSG.HasRows)
                {
                    WSAldea.SmsSendSoapClient mensajeAenviar = new WSAldea.SmsSendSoapClient();
                    respuesta = mensajeAenviar.smsSendSoap("Husi", "Husi123*", 57, celular, _mensaje, "");
                    string     FechaMsg = DateTime.Now.Date.ToShortDateString();
                    string     HoraMsg  = DateTime.Now.ToLongTimeString();
                    String[]   RptaTot  = respuesta.Split('|');
                    string     codRpta  = RptaTot[0];
                    string     msgRpta  = RptaTot[1].Replace("'", "").ToString();
                    string     Insertar = "INSERT INTO hceInterconsultaSMS (FECHA_MSG,CONT_MSG,COD_RPTA,MSG_RPTA,MSG_NTEL,MSG_ESPE,DOC_PCTE,NRO_SOLI,NOM_PCTE,UBIC_PCTE,TIPO_INTR,NROR_MSG) VALUES (getdate(),'" + _mensaje + "','" + codRpta + "','" + msgRpta + "','" + celular + "','" + 999 + "','',999,'Trazabilidad','Trazabilidad','Errores'," + 1 + ")";
                    SqlCommand sqlIns1  = new SqlCommand(Insertar, conexion);
                    sqlIns1.ExecuteNonQuery();
                    string     strInsertMsgs = "INSERT INTO TAT_MSG_CEL_ENV(FECHA_MSG,ATEN_MSG,SOLI_MSG,CUPS_MSG) VALUES(@fecha,@atencion,@solicitud,@cups)";
                    SqlCommand cmdInsertMsgs = new SqlCommand(strInsertMsgs, conexion);
                    cmdInsertMsgs.Parameters.Add("@fecha", SqlDbType.DateTime);
                    cmdInsertMsgs.Parameters.Add("@atencion", SqlDbType.VarChar);
                    cmdInsertMsgs.Parameters.Add("@solicitud", SqlDbType.VarChar);
                    cmdInsertMsgs.Parameters.Add("@cups", SqlDbType.VarChar);
                    cmdInsertMsgs.Parameters["@fecha"].Value     = DateTime.Now;
                    cmdInsertMsgs.Parameters["@atencion"].Value  = Atencion;
                    cmdInsertMsgs.Parameters["@solicitud"].Value = Solicitud;
                    cmdInsertMsgs.Parameters["@cups"].Value      = Cups;
                    cmdInsertMsgs.ExecuteNonQuery();
                }
                else
                {
                    respuesta = "No se envia. Mensaje Repetido";
                }
            }
            return(respuesta);
        }
Esempio n. 2
0
        /// <summary>
        /// Notifica la alarma de falla en una operacion.
        /// </summary>
        /// <param name="mensaje">mensaje que se desea enviar.</param>
        /// <returns></returns>
        public string notificaFalla(string mensaje)
        {
            string        respuesta = string.Empty;
            string        _mensaje  = DateTime.Now.ToString() + mensaje;
            string        celular   = Properties.Resources.nroReporte;
            SqlConnection conexion  = new SqlConnection(Properties.Settings.Default.DBConexion);

            using (conexion)
            {
                conexion.Open();
                WSAldea.SmsSendSoapClient mensajeAenviar = new WSAldea.SmsSendSoapClient();
                respuesta = mensajeAenviar.smsSendSoap("Husi", "Husi123*", 57, celular, _mensaje, "");
                string     FechaMsg = DateTime.Now.Date.ToShortDateString();
                string     HoraMsg  = DateTime.Now.ToLongTimeString();
                String[]   RptaTot  = respuesta.Split('|');
                string     codRpta  = RptaTot[0];
                string     msgRpta  = RptaTot[1].Replace("'", "").ToString();
                string     Insertar = "INSERT INTO hceInterconsultaSMS (FECHA_MSG,CONT_MSG,COD_RPTA,MSG_RPTA,MSG_NTEL,MSG_ESPE,DOC_PCTE,NRO_SOLI,NOM_PCTE,UBIC_PCTE,TIPO_INTR,NROR_MSG) VALUES (getdate(),'" + _mensaje + "','" + codRpta + "','" + msgRpta + "','" + celular + "','" + 999 + "','',999,'Trazabilidad','Trazabilidad','Errores'," + 1 + ")";
                SqlCommand sqlIns1  = new SqlCommand(Insertar, conexion);
                sqlIns1.ExecuteNonQuery();
            }
            return(respuesta);
        }