Пример #1
0
        public string ConsultaEstatusCFDI(string expresion)
        {
            string result;

            try
            {
                ConsultaCFDIServiceClient CFDI = new ConsultaCFDIServiceClient();
                int i = expresion.IndexOf("&rr=");
                i += 4;
                int    j = expresion.IndexOf("&tt=");
                string c = expresion.Substring(i, j - i);
                string z = c.Replace("&", "&");
                expresion = expresion.Replace(c, z);
                i         = expresion.IndexOf("&re=");
                i        += 4;
                j         = expresion.IndexOf("&rr=");
                c         = expresion.Substring(i, j - i);
                z         = c.Replace("&", "&");
                expresion = expresion.Replace(c, z);
                SAT.CFDI.Cliente.Procesamiento.ServicioConsultaCFDI.Acuse x = CFDI.Consulta(expresion);
                result = string.Concat(new string[]
                {
                    x.Estado,
                    "|",
                    x.EsCancelable,
                    "|",
                    x.EstatusCancelacion
                });
            }
            catch (Exception exception)
            {
                AccesoServicios.Log.Error("(ConsultaCFDI) Error al consultar los CFDI's " + exception.ToString());
                result = "Error en la consulta al sat";
            }
            return(result);
        }
Пример #2
0
        public string ConsultaCFDI(string expresion, string uuid, string rfcReceptor, SAT.CFDI.Cliente.Procesamiento.ServicioRelacionados.SignatureType asig)
        {
            string result;

            try
            {
                /*
                 * if (expresion.Contains("&id="))
                 * {
                 *  expresion = expresion.Replace("&id=", "&id=");
                 * }
                 * if (expresion.Contains("&re="))
                 * {
                 *  expresion = expresion.Replace("&re=", "&re=");
                 * }
                 * if (expresion.Contains("&rr="))
                 * {
                 *  expresion = expresion.Replace("&rr=", "&rr=");
                 * }
                 * if (expresion.Contains("&tt="))
                 * {
                 *  expresion = expresion.Replace("&tt=", "&tt=");
                 * }
                 * if (expresion.Contains("&fe="))
                 * {
                 *  expresion = expresion.Replace("&fe=", "&fe=");
                 * }
                 */

                int i = expresion.IndexOf("&rr=");
                i += 4;
                int    j = expresion.IndexOf("&tt=");
                string c = expresion.Substring(i, j - i);
                string z = c.Replace("&", "&");
                expresion = expresion.Replace(c, z);
                i         = expresion.IndexOf("&re=");
                i        += 4;
                j         = expresion.IndexOf("&rr=");
                c         = expresion.Substring(i, j - i);
                z         = c.Replace("&", "&");
                expresion = expresion.Replace(c, z);



                ConsultaCFDIServiceClient CFDI = new ConsultaCFDIServiceClient();
                SAT.CFDI.Cliente.Procesamiento.ServicioConsultaCFDI.Acuse x = CFDI.Consulta(expresion);
                if (x.Estado != "No Encontrado")
                {
                    if (x.Estado == "Vigente")
                    {
                        if (x.EsCancelable != "No Cancelable")
                        {
                            result = "OK";
                        }
                        else
                        {
                            result = x.EsCancelable;
                        }
                    }
                    else if (x.Estado == "Cancelado")
                    {
                        result = "OK";
                    }
                    else
                    {
                        result = x.Estado;
                    }
                }
                else
                {
                    result = x.Estado;
                }
            }
            catch (Exception exception)
            {
                AccesoServicios.Log.Error("(ConsultaCFDI) Error al consultar los CFDI's  expresion:" + expresion + "---" + exception.ToString());
                result = null;
            }
            return(result);
        }