public CLSOrdenProdCollection MostrarOrdenProdBAL(string psCriterio) { CLSOrdenProdCollection coleccion = new CLSOrdenProdCollection(); try { coleccion = base.ConsultarOrdenProdCollection(psCriterio); return(coleccion); } catch { throw; } }
protected CLSOrdenProdCollection ConsultarOrdenProdCollection(string psCriterio) { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); CLSOrdenProdCollection ordenCollection = new CLSOrdenProdCollection(); CLSOrdenProd orden; try { da.SelectCommand = new SqlCommand(Procedimientos.sp_ConsOrdenProd, this.Conexion); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@Criterio", SqlDbType.VarChar).Value = psCriterio; da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { int renglones = ds.Tables[0].Rows.Count; int columnas = ds.Tables[0].Columns.Count; for (int contador = 0; contador < ds.Tables[0].Rows.Count; contador++) { orden = new CLSOrdenProd(); orden.Werks = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim(); orden.Aufnr = ds.Tables[0].Rows[contador]["AUFNR"].ToString().Trim(); orden.Charg = ds.Tables[0].Rows[contador]["CHARG"].ToString().Trim(); orden.Matnr = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim(); orden.MatnrComp = ds.Tables[0].Rows[contador]["MATNR_COMP"].ToString().Trim(); orden.Lgort = ds.Tables[0].Rows[contador]["LGORT"].ToString().Trim(); ordenCollection.Add(orden); } } return(ordenCollection); } catch (Exception ex) { throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString()); } finally { this.Conexion.Close(); } }