RespuestaServicio evaluateResponse(string s)
        {
            RespuestaServicio respuestaGuate = new RespuestaServicio();
            Resultado         serialize;
            string            resultado = "";
            var matches = Regex.Matches(s, @"<dte:GTDocumento (.*)<\/dte:GTDocumento>", RegexOptions.Singleline)
                          .Cast <Match>()
                          .Select(m => m.Value)
                          .ToArray();

            if (matches.Length > 0)
            {
                resultado = matches[0];
                // getInfo(resultado);
                GTDocumento gTDocumento = DeserializeDate <GTDocumento>(resultado);
                respuestaGuate.resultado = true;
                respuestaGuate.mensaje   = "Sin errores";
                respuestaGuate.XML       = resultado;
                respuestaGuate.UUUI      = gTDocumento.SAT.DTE.Certificacion.NumeroAutorizacion.Text;
                respuestaGuate.fecha     = gTDocumento.SAT.DTE.Certificacion.FechaHoraCertificacion;
            }
            else
            {
                ///    serialize = DeserializeResponse<Resultado>(s);
                respuestaGuate.resultado = false;
                respuestaGuate.mensaje   = s;
                if (respuestaGuate.mensaje == null)
                {
                    respuestaGuate.mensaje = s;
                }
            }
            return(respuestaGuate);
        }
Beispiel #2
0
        RespuestaServicio evaluateResponse(string s)
        {
            RespuestaServicio respuestaGuate = new RespuestaServicio();
            string            resultado      = "";
            var matches = Regex.Matches(s, @"<ESTADO>(.*)<\/ESTADO>", RegexOptions.Singleline)
                          .Cast <Match>()
                          .Select(m => m.Value)
                          .ToArray();

            if (matches.Length > 0)
            {
                resultado = matches[0];
                // getInfo(resultado);
                GTDocumento gTDocumento = null;// DeserializeDate<GTDocumento>(resultado);
                respuestaGuate.resultado = true;
                respuestaGuate.mensaje   = matches[0];
            }
            else
            {
                respuestaGuate.resultado = false;
                respuestaGuate.mensaje   = s;
                if (respuestaGuate.mensaje == null)
                {
                    respuestaGuate.mensaje = s;
                }
            }
            return(respuestaGuate);
        }