Beispiel #1
0
        public int VerificaCSDRevocado(string serieCert, string fecha)
        {
            //var lcoLogic = new LcoLogic();
            var  lcoLogic = new Operaciones_IRFC();
            vLCO lco      = lcoLogic.SearchLCOByNoCertificado(serieCert);

            try
            {
                if (lco == null)
                {
                    return(304);
                }
                DateTime fechaEmision = Convert.ToDateTime(fecha);
                if (lco.ValidezObligaciones.Equals("0", StringComparison.CurrentCultureIgnoreCase) ||
                    (fechaEmision < lco.FechaInicio || DateTime.Now > lco.FechaFinal) ||
                    !lco.EstatusCertificado.Contains("A"))
                {
                    return(304);
                }
                return(0);
            }
            catch (Exception ee)
            {
                Logger.Error("", ee);
                return(304);
            }
        }
Beispiel #2
0
 //-------------------------------------------------------------------------------------
 public int ValidaRFCLCO(string rfc)
 {
     try
     {
         //var lcoLogic = new LcoLogic();
         var  lcoLogic = new Operaciones_IRFC();
         vLCO lco      = lcoLogic.SearchLCOByRFC(rfc);
         return(lco == null ? 402 : 0);
     }
     catch (Exception ee)
     {
         Logger.Error("", ee);
         return(402);
     }
 }
        public int VerificaCSDRevocado(string serieCert, DateTime fecha, string version)
        {
            var lcoLogic  = new LcoLogic();
            var lcoLogic2 = new Operaciones_IRFC();

            if (version == "3.2")
            {
                vLCO lco = lcoLogic2.SearchLCOByNoCertificado(serieCert);
                try
                {
                    if (lco == null)
                    {
                        return(304);
                    }

                    if (lco.ValidezObligaciones.Equals("0", StringComparison.CurrentCultureIgnoreCase) ||
                        (fecha < lco.FechaInicio || fecha > lco.FechaFinal) ||
                        !lco.EstatusCertificado.Contains("A"))
                    {
                        return(304);
                    }
                    return(0);
                }
                catch (Exception ee)
                {
                    Logger.Error("", ee);
                    return(304);
                }
            }
            else
            {
                var lco = lcoLogic.SearchCsdBySerie(serieCert, fecha);
                try
                {
                    if (lco == null)
                    {
                        return(304);
                    }
                    return(0);
                }
                catch (Exception ee)
                {
                    Logger.Error("", ee);
                    return(304);
                }
            }
        }
Beispiel #4
0
        public vLCO SearchLCOByRFC(string rfc)
        {
            vLCO result;

            try
            {
                using (DescargasSatEntities db = new DescargasSatEntities())
                {
                    vLCO lco = db.vLCO.FirstOrDefault((vLCO p) => p.Rfc == rfc);
                    result = lco;
                }
            }
            catch (Exception ee_A4)
            {
                result = null;
            }
            return(result);
        }
Beispiel #5
0
        public vLCO SearchLCOByNoCertificado(string noCertificado)
        {
            vLCO result;

            try
            {
                using (DescargasSatEntities db = new DescargasSatEntities())
                {
                    vLCO lco = db.vLCO.FirstOrDefault((vLCO p) => p.noCertificado == noCertificado);
                    result = lco;
                }
            }
            catch (Exception ee_A4)
            {
                result = null;
            }
            return(result);
        }
Beispiel #6
0
        public vLCO RFCValidezObligacionesAll(string rfc)
        {
            vLCO result;

            try
            {
                using (DescargasSatEntities db = new DescargasSatEntities())
                {
                    vLCO lco = db.vLCO.FirstOrDefault((vLCO p) => p.Rfc == rfc);
                    result = lco;
                }
            }
            catch (Exception ee_E02)
            {
                result = null;
            }
            return(result);
        }
 public bool ValidaCSDEmisor(byte[] certificado)
 {
     try
     {
         X509Certificate2 cer = new X509Certificate2(certificado);
         if (certificado != null)
         {
             if (cer.SerialNumber != null)
             {
                 string serialNumber =
                     cer.SerialNumber.Trim();
                 string a = serialNumber;
                 for (int i = 0; i < a.Length; i++)
                 {
                     if (i < serialNumber.Length)
                     {
                         serialNumber = serialNumber.Remove(i, 1);
                     }
                 }
                 Operaciones_IRFC o     = new Operaciones_IRFC();
                 vLCO             valor = o.CSDValidar(serialNumber);
                 //RfcLco valor = CSDValidar(serialNumber);
                 if (valor != null)
                 {
                     return(true);
                 }
             }
         }
     }
     catch (Exception ee)
     {
         Logger.Error(ee);
         return(false);
     }
     return(false);
 }