Пример #1
0
        public CLSLoteCollection MostrarLoteBAL(string psCriterio)
        {
            CLSLoteCollection coleccion = new CLSLoteCollection();

            try
            {
                coleccion = base.ConsultarLoteCollection(psCriterio);
                return(coleccion);
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        protected CLSLoteCollection ConsultarLoteCollection(string psCriterio)
        {
            DataSet           ds             = new DataSet();
            SqlDataAdapter    da             = new SqlDataAdapter();
            CLSLoteCollection loteCollection = new CLSLoteCollection();
            CLSLote           lote;

            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsLote, 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++)
                    {
                        lote          = new CLSLote();
                        lote.Almacen  = ds.Tables[0].Rows[contador]["LGORT"].ToString().Trim();
                        lote.Lote     = ds.Tables[0].Rows[contador]["CHARG"].ToString().Trim();
                        lote.Remision = ds.Tables[0].Rows[contador]["REMISION"].ToString().Trim();
                        lote.Tatuaje  = ds.Tables[0].Rows[contador]["TATUAJE"].ToString().Trim();
                        lote.PesoProm = ds.Tables[0].Rows[contador]["PPC"].ToString().Trim();
                        lote.Fecha    = ds.Tables[0].Rows[contador]["FECHA_REG"].ToString().Trim();
                        lote.Clabs    = Convert.ToDouble(ds.Tables[0].Rows[contador]["CLABS"].ToString().Trim());
                        lote.CwmClabs = Convert.ToDouble(ds.Tables[0].Rows[contador]["/CWM/CLABS"].ToString().Trim());
                        loteCollection.Add(lote);
                    }
                }

                return(loteCollection);
            }
            catch (Exception ex)
            {
                throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
            }
            finally
            {
                this.Conexion.Close();
            }
        }