Ejemplo n.º 1
0
        public List <UBIGEO> ListarDistrito(string idprovi, string iddepacomer)
        {
            string        findAll  = "select*from v_Distrito where IdProvincia='" + idprovi + "'and IdDepartamento='" + iddepacomer + "'order by DISTRITO";
            List <UBIGEO> listapro = new List <UBIGEO>();

            try
            {
                string cnx = db.Database.Connection.ConnectionString;
                con     = new SqlConnection(cnx);
                comando = new SqlCommand(findAll, con);
                con.Open();
                SqlDataReader reader = comando.ExecuteReader();
                while (reader.Read())
                {
                    UBIGEO objpro = new UBIGEO();
                    objpro.UBIGEO1  = reader[0].ToString();
                    objpro.DISTRITO = reader[1].ToString();
                    listapro.Add(objpro);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            return(listapro);
        }
Ejemplo n.º 2
0
        public List <UBIGEO> ListarDepartamento()
        {
            string        findAll  = "select*from v_Departamento order by DEPARTAM";
            List <UBIGEO> listapro = new List <UBIGEO>();

            try
            {
                string cnx = db.Database.Connection.ConnectionString;
                con     = new SqlConnection(cnx);
                comando = new SqlCommand(findAll, con);
                con.Open();
                SqlDataReader reader = comando.ExecuteReader();
                while (reader.Read())
                {
                    UBIGEO objpro = new UBIGEO();
                    objpro.UBIGEO1  = reader[0].ToString();
                    objpro.DEPARTAM = reader[1].ToString();
                    listapro.Add(objpro);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            return(listapro);
        }