public TotalesSubregistroNacimientosRespuesta ConsultaTotalesSubregistroNacimientos(string anosUnion, string mesesUnion, string municipiosUnion)
        {
            TotalesSubregistroNacimientosRespuesta totalesSubregistroNacimientosRespuesta = new TotalesSubregistroNacimientosRespuesta();

            try
            {
                using (DataSet dataSet = new DataSet())
                {
                    dataSet.Locale = CultureInfo.InvariantCulture;

                    EjecutaProcedimiento(PRN_CONSULTA_TOTALES_SUBREGISTRO_NACIMIENTOS, CreaParametrosSubregistroNacimientos(anosUnion, mesesUnion, municipiosUnion), dataSet);

                    if (this.Codigo == 0 && ValidaDataSet(dataSet))
                    {
                        totalesSubregistroNacimientosRespuesta.ColTotales = new Collection <SubregistroTotal>();

                        foreach (DataRow r in dataSet.Tables[0].Rows)
                        {
                            SubregistroTotal sub = new SubregistroTotal
                            {
                                IdGrupo     = r.Field <int>("IdGrupo"),
                                NombreGrupo = r.Field <string>("NombreGrupo"),
                                Total       = r.Field <int>("Total")
                            };

                            totalesSubregistroNacimientosRespuesta.ColTotales.Add(sub);
                        }
                    }
                    else
                    {
                        throw new EmptyDataException(this.Mensaje);
                    }
                }
            }
            catch (Exception de)
            {
                Bitacora.Error(de.Message);
                if (de is EmptyDataException)
                {
                    throw new DAOException(1, de.Message);
                }
                throw new DAOException(-1, de.Message);
            }

            return(totalesSubregistroNacimientosRespuesta);
        }
        public SubregistroNacimientosRespuesta ConsultaDTSubregistroNacimientos(string anosUnion, string mesesUnion, string municipiosUnion)
        {
            SubregistroNacimientosRespuesta SubregistroNacimientosRespuesta = new SubregistroNacimientosRespuesta
            {
                ColDataTables = new Collection <DataTable>()
            };

            try
            {
                using (DataSet dataSet = new DataSet())
                {
                    dataSet.Locale = CultureInfo.InvariantCulture;

                    EjecutaProcedimiento(PRN_CONSULTA_SUBREGISTRO_NACIMIENTOS, CreaParametrosSubregistroNacimientos(anosUnion, mesesUnion, municipiosUnion), dataSet);

                    if (this.Codigo == 0)
                    {
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SubregistroNacimientosRespuesta.ColTotales = new Collection <SubregistroTotal>();

                            foreach (DataRow r in dataSet.Tables[0].Rows)
                            {
                                SubregistroTotal sub = new SubregistroTotal
                                {
                                    IdGrupo     = r.Field <int>("IdGrupo"),
                                    NombreGrupo = r.Field <string>("NombreGrupo"),
                                    Total       = r.Field <int>("Total")
                                };

                                SubregistroNacimientosRespuesta.ColTotales.Add(sub);
                            }
                        }

                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SubregistroNacimientosRespuesta.ColSubregistros = new Collection <Subregistro>();

                            SubregistroNacimientosRespuesta.ColDataTables.Add(dataSet.Tables[1]);

                            foreach (DataRow r in dataSet.Tables[1].Rows)
                            {
                                Subregistro sub = new Subregistro
                                {
                                    Folio           = r.Field <string>("Folio"),
                                    MaNombre        = r.Field <string>("Nombre"),
                                    MaApPaterno     = r.Field <string>("Paterno"),
                                    MaApMaterno     = r.Field <string>("Materno"),
                                    FechaNacimiento = r.Field <string>("FechaNacimiento"),
                                    HoraNacimiento  = r.Field <string>("HoraNacimiento"),
                                    SexoId          = r.Field <int>("SexoId"),
                                    SexoDesc        = r.Field <string>("SexoDesc"),
                                    EdoId           = r.Field <int>("EdoId"),
                                    EdoDesc         = r.Field <string>("EdoDesc"),
                                    MpioId          = r.Field <int>("MpioId"),
                                    MpioDesc        = r.Field <string>("MpioDesc"),
                                    LocId           = r.Field <int>("LocId"),
                                    LocDesc         = r.Field <string>("LocDesc"),
                                    Colonia         = r.Field <string>("Colonia"),
                                    Calle           = r.Field <string>("Calle"),
                                    NoExt           = r.Field <string>("NoExt"),
                                    NoInt           = r.Field <string>("NoInt"),
                                    Edad            = r.Field <int>("Edad"),
                                    NumNacimiento   = r.Field <int>("NumNacimiento"),
                                    Ocupacion       = r.Field <string>("Ocupacion"),
                                    EdoCivilId      = r.Field <int>("EdoCivilId"),
                                    EdoCivilDesc    = r.Field <string>("EdoCivilDesc"),
                                    EscolId         = r.Field <int>("EscolId"),
                                    EscolDesc       = r.Field <string>("EscolDesc")
                                };

                                SubregistroNacimientosRespuesta.ColSubregistros.Add(sub);
                            }
                        }

                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SubregistroNacimientosRespuesta.ColOportunos = new Collection <Subregistro>();

                            SubregistroNacimientosRespuesta.ColDataTables.Add(dataSet.Tables[2]);

                            foreach (DataRow r in dataSet.Tables[2].Rows)
                            {
                                Subregistro sub = new Subregistro
                                {
                                    Folio           = r.Field <string>("Folio"),
                                    MaNombre        = r.Field <string>("Nombre"),
                                    MaApPaterno     = r.Field <string>("Paterno"),
                                    MaApMaterno     = r.Field <string>("Materno"),
                                    FechaNacimiento = r.Field <string>("FechaNacimiento"),
                                    HoraNacimiento  = r.Field <string>("HoraNacimiento"),
                                    SexoId          = r.Field <int>("SexoId"),
                                    SexoDesc        = r.Field <string>("SexoDesc"),
                                    EdoId           = r.Field <int>("EdoId"),
                                    EdoDesc         = r.Field <string>("EdoDesc"),
                                    MpioId          = r.Field <int>("MpioId"),
                                    MpioDesc        = r.Field <string>("MpioDesc"),
                                    LocId           = r.Field <int>("LocId"),
                                    LocDesc         = r.Field <string>("LocDesc"),
                                    Colonia         = r.Field <string>("Colonia"),
                                    Calle           = r.Field <string>("Calle"),
                                    NoExt           = r.Field <string>("NoExt"),
                                    NoInt           = r.Field <string>("NoInt"),
                                    Edad            = r.Field <int>("Edad"),
                                    NumNacimiento   = r.Field <int>("NumNacimiento"),
                                    Ocupacion       = r.Field <string>("Ocupacion"),
                                    EdoCivilId      = r.Field <int>("EdoCivilId"),
                                    EdoCivilDesc    = r.Field <string>("EdoCivilDesc"),
                                    EscolId         = r.Field <int>("EscolId"),
                                    EscolDesc       = r.Field <string>("EscolDesc")
                                };

                                SubregistroNacimientosRespuesta.ColOportunos.Add(sub);
                            }
                        }

                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SubregistroNacimientosRespuesta.ColExtemporaneos = new Collection <Subregistro>();

                            SubregistroNacimientosRespuesta.ColDataTables.Add(dataSet.Tables[3]);

                            foreach (DataRow r in dataSet.Tables[3].Rows)
                            {
                                Subregistro sub = new Subregistro
                                {
                                    Folio           = r.Field <string>("Folio"),
                                    MaNombre        = r.Field <string>("Nombre"),
                                    MaApPaterno     = r.Field <string>("Paterno"),
                                    MaApMaterno     = r.Field <string>("Materno"),
                                    FechaNacimiento = r.Field <string>("FechaNacimiento"),
                                    HoraNacimiento  = r.Field <string>("HoraNacimiento"),
                                    SexoId          = r.Field <int>("SexoId"),
                                    SexoDesc        = r.Field <string>("SexoDesc"),
                                    EdoId           = r.Field <int>("EdoId"),
                                    EdoDesc         = r.Field <string>("EdoDesc"),
                                    MpioId          = r.Field <int>("MpioId"),
                                    MpioDesc        = r.Field <string>("MpioDesc"),
                                    LocId           = r.Field <int>("LocId"),
                                    LocDesc         = r.Field <string>("LocDesc"),
                                    Colonia         = r.Field <string>("Colonia"),
                                    Calle           = r.Field <string>("Calle"),
                                    NoExt           = r.Field <string>("NoExt"),
                                    NoInt           = r.Field <string>("NoInt"),
                                    Edad            = r.Field <int>("Edad"),
                                    NumNacimiento   = r.Field <int>("NumNacimiento"),
                                    Ocupacion       = r.Field <string>("Ocupacion"),
                                    EdoCivilId      = r.Field <int>("EdoCivilId"),
                                    EdoCivilDesc    = r.Field <string>("EdoCivilDesc"),
                                    EscolId         = r.Field <int>("EscolId"),
                                    EscolDesc       = r.Field <string>("EscolDesc")
                                };

                                SubregistroNacimientosRespuesta.ColExtemporaneos.Add(sub);
                            }
                        }

                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SubregistroNacimientosRespuesta.ColDataTables.Add(dataSet.Tables[4]);
                        }
                    }
                    else
                    {
                        throw new EmptyDataException(this.Mensaje);
                    }
                }
            }
            catch (Exception de)
            {
                Bitacora.Error(de.Message);
                if (de is EmptyDataException)
                {
                    throw new DAOException(1, de.Message);
                }
                throw new DAOException(-1, de.Message);
            }

            return(SubregistroNacimientosRespuesta);
        }