Exemplo n.º 1
0
        public CLSCatDestinoCollection MostrarCatDestinoBAL(string psCriterio)
        {
            CLSCatDestinoCollection coleccion = new CLSCatDestinoCollection();

            try
            {
                coleccion = base.ConsultarCatDestinoCollection(psCriterio);
                return(coleccion);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        protected CLSCatDestinoCollection ConsultarCatDestinoCollection(string psCriterio)
        {
            DataSet                 ds = new DataSet();
            SqlDataAdapter          da = new SqlDataAdapter();
            CLSCatDestinoCollection CatDestinoCollection = new CLSCatDestinoCollection();
            CLSCatDestino           CatDestino;

            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsCatDestino, 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++)
                    {
                        CatDestino             = new CLSCatDestino();
                        CatDestino.Werks       = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim();
                        CatDestino.CodDestino  = ds.Tables[0].Rows[contador]["CODDESTINO"].ToString().Trim();
                        CatDestino.DescDestino = ds.Tables[0].Rows[contador]["DESCRIPCION"].ToString().Trim();
                        CatDestino.MatnrComp   = ds.Tables[0].Rows[contador]["MATNR_COMP"].ToString().Trim();
                        CatDestino.MatnrProd   = ds.Tables[0].Rows[contador]["MATNR_PROD"].ToString().Trim();
                        CatDestino.MatnrMaq    = ds.Tables[0].Rows[contador]["MATNR_MAQ"].ToString().Trim();
                        CatDestino.PesarCab    = ds.Tables[0].Rows[contador]["PESAR_CAB"].ToString();
                        CatDestinoCollection.Add(CatDestino);
                    }
                }

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