public CLSLipsCollection ConsultarLipsCollectionBAL(string psCriterio) { CLSLipsCollection lips = new CLSLipsCollection(); try { lips = base.ConsultarLipsCollectionDAL(psCriterio); return(lips); } catch { throw; } }
protected CLSLipsCollection ConsultarLipsCollectionDAL(string psCriterio) { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); CLSLipsCollection lipsCollection = new CLSLipsCollection(); CLSLips lips; try { da.SelectCommand = new SqlCommand(Procedimientos.sp_ConsLIPS, 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++) { lips = new CLSLips(); lips.Entrega = ds.Tables[0].Rows[contador]["VBELN"].ToString().Trim(); lips.Centro = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim(); lips.Matnr = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim(); lips.Lgort = ds.Tables[0].Rows[contador]["LGORT"].ToString().Trim(); lips.Lfimg = Convert.ToDouble(ds.Tables[0].Rows[contador]["LFIMG"].ToString().Trim()); lips.Vgbel = ds.Tables[0].Rows[contador]["VGBEL"].ToString().Trim(); lips.Vgpos = ds.Tables[0].Rows[contador]["VGPOS"].ToString().Trim(); lips.Netpr = ds.Tables[0].Rows[contador]["NETPR"].ToString().Trim(); lips.Waerk = ds.Tables[0].Rows[contador]["WAERK"].ToString().Trim(); lips.Meins = ds.Tables[0].Rows[contador]["MEINS"].ToString().Trim(); try { lips.Picking = double.Parse(ds.Tables[0].Rows[contador]["PICKING"].ToString().Trim()); } catch { lips.Picking = 0.0; } try { lips.Uniemp = int.Parse(ds.Tables[0].Rows[contador]["UNIEMP"].ToString().Trim()); } catch { lips.Uniemp = 0; } lipsCollection.Add(lips); } } return(lipsCollection); } catch (Exception ex) { throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString()); } finally { this.Conexion.Close(); } }