Estoy empezando a conocer mas sobre c# y que mejor comenzando con un proyectito utilizando
programacion en 3 capas .
Mi problema no se como llenar un listview pasando por mi 3 capas estoy un poco desorientado he buscado y no he encontrado si alquien me puede ayudar
EN MI CAPA DAL:
TENGO LO SIGUIENTE
Código:
public List<MESubCategoria> ADListarGaleriaSubCategorias(String vchbyIdCatAll, String vchbyIdCat) { SqlConnection sqlCnx = null; SqlCommand sqlCmd = null; SqlDataReader sqlReader = null; List<MESubCategoria> lstMeGaleriaSubCategorias = new List<MESubCategoria>(); try { String strConectionString = ConfigurationManager.ConnectionStrings["cnxDBCGallery"].ConnectionString; sqlCnx = new SqlConnection(strConectionString); sqlCmd = new SqlCommand("uspSubCategoria_LIST", sqlCnx); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@vchbyIdAll", SqlDbType.NVarChar, 11); sqlCmd.Parameters.Add("@vchbyId", SqlDbType.NVarChar, 11); sqlCmd.Parameters[0].Value = UTHelper.ToDBNull(vchbyIdCatAll); sqlCmd.Parameters[1].Value = UTHelper.ToDBNull(vchbyIdCat); sqlCnx.Open(); sqlReader = sqlCmd.ExecuteReader(); if (sqlReader != null) { if (sqlReader.HasRows) { while (sqlReader.Read()) { MESubCategoria objMeSubCategoria = new MESubCategoria(); objMeSubCategoria.SubCategoriaId = sqlReader["SubCategoriaId"].ToString(); objMeSubCategoria.Nombre = sqlReader["Nombre"].ToString(); lstMeGaleriaSubCategorias.Add(objMeSubCategoria); } } } } catch (Exception) { throw; } finally { if (sqlCnx != null) { sqlCnx.Dispose(); } if (sqlCmd != null) { sqlReader.Dispose(); } if (sqlReader != null) { sqlReader.Dispose(); } } return lstMeGaleriaSubCategorias; }
CAPA NEGOCIOS :
Código:
CAPA PRESENTACION :public List<MESubCategoria> ListarBLGaleriaSubCategorias(String blvchbyIdCatAll, String blvchbyIdCat) { List<MESubCategoria> lstBLGaleriasSubCategorias = null; lstBLGaleriasSubCategorias = adSubCategorias.ADListarGaleriaSubCategorias(blvchbyIdCatAll, blvchbyIdCat); return lstBLGaleriasSubCategorias; }
Aqui es el problema no se como
llenarlo estoy probando un foreach de la siguiente manera
Código:
aunque no tiene logica pero no se o estoy haciendo mal en mi capa de negociosint x=0; foreach (BLSubCategoria blListarSubCateorias in blListarSubCategorias.ListarBLGaleriaSubCategorias("%", null)) { lstVistaCatalogo.Items.Add(blListarSubCategorias.ToString()); x=x+1; }
por favor si alguien me da una mano le agradeceria mucho
gracias