Example #1
0
        void CargarGrid()
        {
            try
            {
                using (Profit_RGEntities context = new Profit_RGEntities())
                {
                    var H = context.pBuscarActivo(cbo_empresa.SelectedValue.ToString(), cbo_catalogo.SelectedValue.ToString()).ToList();
                    buscar23.Clear();

                    foreach (var item in H)
                    {
                        buscar23.Add(new GridBusqueda
                        {
                            activo      = item.id_activo,
                            descripcion = item.descrip,
                            serial      = item.serial,
                            adquisicion = item.fecha_adq.ToShortDateString(),
                            ubicacion   = item.ubicacion,
                            catalogo    = item.catalogo,
                            nombre      = item.nombre,
                        });
                    }
                    Grd_busqueda.DataSource          = "";
                    Grd_busqueda.DataSource          = buscar23;
                    Grd_busqueda.AutoGenerateColumns = false;
                    Grd_busqueda.Refresh();
                }
            }

            catch (EntityException ex)
            {
                MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }