public CLSCanalFinCollection MostrarCanalBAL(string psCriterio) { CLSCanalFinCollection coleccion = new CLSCanalFinCollection(); try { coleccion = base.ConsultarCanalCollection(psCriterio); return(coleccion); } catch { throw; } }
protected CLSCanalFinCollection ConsultarCanalCollection(string psCriterio) { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); CLSCanalFinCollection catCentroCollection = new CLSCanalFinCollection(); CLSCanalFin canalFin; try { da.SelectCommand = new SqlCommand(Procedimientos.sp_ConsCanalFin, 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++) { canalFin = new CLSCanalFin(); canalFin.Centro = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim(); canalFin.CodDestino = ds.Tables[0].Rows[contador]["CODDESTINO"].ToString().Trim(); canalFin.OrdenProp = ds.Tables[0].Rows[contador]["ORDENPROP"].ToString().Trim(); canalFin.Descripcion = ds.Tables[0].Rows[contador]["DESCRIP"].ToString().Trim(); canalFin.Matnr = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim(); canalFin.MatnrVirt = ds.Tables[0].Rows[contador]["MATNR_VIRT"].ToString().Trim(); canalFin.Desensamble = ds.Tables[0].Rows[contador]["DESENSAMBLE"].ToString().Trim(); canalFin.Autorizado = ds.Tables[0].Rows[contador]["AUTORIZADO"].ToString().Trim(); canalFin.ICanaVenta = ds.Tables[0].Rows[contador]["ICANAVENTA"].ToString().Trim(); canalFin.IRemisionado = ds.Tables[0].Rows[contador]["IREMISIONADO"].ToString().Trim(); canalFin.ICanaCorte = ds.Tables[0].Rows[contador]["ICANACORTE"].ToString().Trim(); catCentroCollection.Add(canalFin); } } return(catCentroCollection); } catch (Exception ex) { throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString()); } finally { this.Conexion.Close(); } }