Пример #1
0
        //public Boolean existenciaCertificado(string rfc, string nocert)
        //{
        //    DB.Configurar2();
        //    DB.Conectar();
        //    DB.CrearComando("select no_serie,edo_certificado,fec_final_cert RFC from Certificado where RFC=@RFC and no_serie=@nocert and ");
        //    DB.AsignarParametroCadena("@RFC", rfc);
        //    DB.AsignarParametroCadena("@nocert", nocert);
        //    DbDataReader DR = DB.EjecutarConsulta3(ref error);

        //    while (DR.Read())
        //    {
        //        DB.Desconectar();
        //        return true;
        //    }
        //    DB.Desconectar();

        //    if (!String.IsNullOrEmpty(error))
        //    {
        //        msjT += error + Environment.NewLine;
        //    }
        //    msj += "RFC y Número de certificado no encontrados.";
        //    return false;

        //}

        public Boolean existenciaCertificado(string rfc, string nocert)
        {
            try
            {
                DB.Configurar2();
                DB.Conectar();
                DB.CrearComando(@"select no_serie,edo_certificado,fec_final_cert,RFC 
                             from 
                             Certificado where RFC=@RFC and no_serie=@nocert AND edo_certificado ='A'");
                DB.AsignarParametroCadena("@RFC", rfc);
                DB.AsignarParametroCadena("@nocert", nocert);
                DbDataReader DR2 = DB.EjecutarConsulta3(ref error);

                if (DR2.Read())
                {
                    DB.Desconectar();
                    return(true);
                }
                else
                {
                    msj += "El Certificado es incorrecto (es invalido, esta cancelado o esta revocado).";
                    DB.Desconectar();
                    return(false);
                }
                // DB.Desconectar();

                //if (!String.IsNullOrEmpty(error))
                //{
                //    msjT += error + Environment.NewLine;
                //}
            }catch (Exception y) {
                return(false);
            }
        }
Пример #2
0
        public Boolean folioyserie(string rfc, string serie, string folio, string anoaprob, string noaprob)
        {
            string folioInicial, folioFinal, auxaprob;
            int    fol, folI, folF;

            if (String.IsNullOrEmpty(serie))
            {
                DB.Configurar2();
                DB.Conectar();
                DB.CrearComando("select noAprobacion, folioInicial, folioFinal, RFC from Folios where RFC=@RFC and noAprobacion=@noaprob and anoAprobacion=@anoaprob");
                DB.AsignarParametroCadena("@RFC", rfc);
                DB.AsignarParametroCadena("@noaprob", noaprob);
                DB.AsignarParametroCadena("@anoaprob", anoaprob);
                //DbDataReader DR = DB.EjecutarConsulta3(ref error);
            }
            else
            {
                DB.Configurar2();
                DB.Conectar();
                DB.CrearComando("select noAprobacion, folioInicial, folioFinal, RFC from Folios where RFC=@RFC and noAprobacion=@noaprob and anoAprobacion=@anoaprob and serie=@serie");
                DB.AsignarParametroCadena("@RFC", rfc);
                DB.AsignarParametroCadena("@noaprob", noaprob);
                DB.AsignarParametroCadena("@anoaprob", anoaprob);
                DB.AsignarParametroCadena("@serie", serie);
            }
            DbDataReader DR = DB.EjecutarConsulta3(ref error);

            while (DR.Read())
            {
                auxaprob     = DR[0].ToString();
                folioInicial = DR[1].ToString();
                folioFinal   = DR[2].ToString();
                DB.Desconectar();

                fol  = Convert.ToInt32(folio);
                folI = Convert.ToInt32(folioInicial);
                folF = Convert.ToInt32(folioFinal);
                if (fol >= folI && fol <= folF)
                {
                    if (noaprob == auxaprob)
                    {
                        return(true);
                    }
                    else
                    {
                        msj    = "El número de aprobación es invalido.";
                        estado = "1";
                        return(false);
                    }
                }
                else
                {
                    msj    = "El número de folio no esta dentro del rango, o no esta autorizado por el SAT.";
                    estado = "3";
                    return(false);
                }
            }
            DB.Desconectar();
            if (!String.IsNullOrEmpty(error))
            {
                msjT += error + Environment.NewLine;
            }
            msj   += "Serie y/o año de aprobación no Existen en la BD.";
            estado = "3";
            return(false);
        }