Esempio n. 1
0
        private void AbrirBuscador(ProductoCriterioBusqueda criterio)
        {
            if (!this.OwnedForms.Any())
            {
                var idsAgregados = new List <int>();
                idsAgregados.Add(0);

                var productos = ProductosDatasource.Where(p => idsAgregados.All(c => c != p.ProductoId)).ToList();
                var frm       = new Productos.frmBuscador(txtProducto.Text, productos, false, criterio);
                frm.WidthBuscador  = txtProducto.Width;
                frm.Cambio        += BuscarArticulo;
                frm.TeclaApretada += FrmOnTeclaApretada;
                frm.Owner          = this;
                Point locationOnForm = txtProducto.PointToScreen(Point.Empty);
                //frm.ShowDialog();
                frm.Top  = locationOnForm.Y + 24;
                frm.Left = locationOnForm.X;
                frm.Show();
                frm.AplicarFiltros(txtProducto.Text);
                txtProducto.Focus();
            }
            else
            {
                var buscador = this.OwnedForms.First() as Productos.frmBuscador;
                buscador.AplicarFiltros(txtProducto.Text);
            }
        }
        private void AbrirBuscador(ProductoCriterioBusqueda criterio)
        {
            if (!this.OwnedForms.Any())
            {
                var idsAgregados = new List<int>();
                idsAgregados.Add(0);

                var productos = ProductosDatasource.Where(p => idsAgregados.All(c => c != p.ProductoId)).ToList();
                var frm = new Productos.frmBuscador(txtProducto.Text, productos, false, criterio);
                frm.WidthBuscador = txtProducto.Width;
                frm.Cambio += BuscarArticulo;
                frm.TeclaApretada += FrmOnTeclaApretada;
                frm.Owner = this;
                Point locationOnForm = txtProducto.PointToScreen(Point.Empty);
                //frm.ShowDialog();
                frm.Top = locationOnForm.Y + 24;
                frm.Left = locationOnForm.X;
                frm.Show();
                frm.AplicarFiltros(txtProducto.Text);
                txtProducto.Focus();
            }
            else
            {
                var buscador = this.OwnedForms.First() as Productos.frmBuscador;
                buscador.AplicarFiltros(txtProducto.Text);
            }
        }