Example #1
0
        //HACER!!!
        //LISTAR POR nombre de entidad
        public static List <Tramites> ListarTramites(string NEntidad)
        {
            int    codigoT;
            string TipoTramite  = null;
            string DescripcionT = null;
            //string NomEntidad = null;

            List <N_EntidadesCompartidas.Tramites> _ListarTramites = new List <N_EntidadesCompartidas.Tramites>();

            N_EntidadesCompartidas.Tramites CT = null;
            SqlDataReader _Reader;
            //CONEXION CON BD
            SqlConnection cnn = new SqlConnection(Conexion._Cnn);
            SqlCommand    cmd = new SqlCommand("ListarTramites ", cnn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@NEntidad", NEntidad);


            try
            {
                cnn.Open();
                _Reader = cmd.ExecuteReader();
                while (_Reader.Read())//El read siempre me devuelve true or false, pude leer algo o no
                {
                    codigoT      = (int)_Reader["CodigoT"];
                    TipoTramite  = (string)_Reader["TipoTramite"];
                    DescripcionT = (string)_Reader["DescripcionT"];
                    //NomEntidad = (string)_Reader["NEntidad"];

                    CT = new Tramites(TipoTramite, DescripcionT, codigoT);//****xqe no trae la info de la bd de telefonos???????????
                    _ListarTramites.Add(CT);
                    //_ListarEntidades.Add(new Entidades() { pNombreEntidad  = NEntidad });
                }



                // if (_Reader.Read())
                //CARGO LAS VARIABLES CON LA INFORMACION DE LA BD
                //***************************COMO HICE QUE HEREDE TUVE QUE AGREGAR LAS ULTIMAS 3 VARIABLES PERO NO QUIERO QUE SE MUESTREN, IGUAL QUEDA ASI?? LO MISMO SUCEDE CON PERSISTENCIA SOLICITUDES QUE HEREDA DE TRAMITES!!
                ////   CT = new Tramites(_Reader["TipoTramite"].ToString(), _Reader["DescripcionT"].ToString(), Convert.ToInt32(_Reader["CodigoT"]), null);

                //  _Reader.Close();
            }

            catch (Exception ex)
            {
                throw new ApplicationException("algo salio mal con la base de datos" + ex.Message);
            }
            finally
            {
                cnn.Close();
            }
            //VARIABLE CON VALORES CARGADOS
            return(_ListarTramites);

            #endregion
        }
        //Constructores
        public Entidades(string pNombreEntidad, string pDireccion, List <string> ListaTelefonos, Tramites pTramiteAsoEntidad)


        {
            NombreEntidad     = pNombreEntidad;
            Direccion         = pDireccion;
            Telefonos         = ListaTelefonos;
            TramiteAsoEntidad = pTramiteAsoEntidad;
        }