public List<Fabricante> obtenerTodosLista() { string[] parametros = { }; List<Fabricante> fabricantes = new List<Fabricante>(); DatosSistema datos = new DatosSistema(); DataTable dt = datos.getDatosTabla("[INFONIONIOS].[spObtenerFabricantes]", parametros); foreach (DataRow r in dt.Rows) { Fabricante f = new Fabricante(); f.idFabricante = Int32.Parse(r["FABRICANTE_ID"].ToString()); f.nombreFabricante = r["FABRICANTE_NOMBRE"].ToString(); fabricantes.Add(f); } return fabricantes; }
public Fabricante obtenerPorIdModelo(int idModelo) { Fabricante f = new Fabricante(); string[] parametros = { "@idModelo" }; DatosSistema datos = new DatosSistema(); DataTable dt = datos.getDatosTabla("[INFONIONIOS].[spObtenerFabricantePorIdModelo]", parametros, idModelo); if (dt.Rows.Count != 0) { f.idFabricante = Int32.Parse(dt.Rows[0]["FABRICANTE_ID"].ToString()); f.nombreFabricante = dt.Rows[0]["FABRICANTE_NOMBRE"].ToString(); } else { return null; } return f; }