예제 #1
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (textBox1.Text == "")
                {
                    if (cbOficina.Text == "")
                    {
                        carga();
                    }
                    else
                    {
                        carga2();
                    }
                }
                else
                {
                    dataGridView1.Rows.Clear();
                    if (cbOficina.Text == "")
                    {
                        string bus_descripcion = textBox1.Text;


                        Models.Product product = new Models.Product();
                        using (product)
                        {
                            List <Models.Product> result = product.getProductByDescription(bus_descripcion);

                            foreach (Models.Product item in result)
                            {
                                dataGridView1.Rows.Add(item.Id, item.Code1, item.Code2, item.Description, item.Cost, (item.Existencia + item.Devoluciones), item.Price1, item.Price2);
                            }
                        }
                    }
                    else
                    {
                        string bus_descripcion = textBox1.Text;

                        intercambios.conector = connectionstring2;
                        Models.Produc_suc product = new Models.Produc_suc();
                        using (product)
                        {
                            List <Models.Produc_suc> result = product.getProductByDescription(bus_descripcion);

                            foreach (Models.Produc_suc item in result)
                            {
                                dataGridView1.Rows.Add(item.Id, item.Code1, item.Code2, item.Description, item.Cost, (item.Existencia + item.Devoluciones), item.Price1, item.Price2);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        public void carga2()
        {
            intercambios.conector = connectionstring2;
            dataGridView1.Rows.Clear();
            Models.Produc_suc product = new Models.Produc_suc();
            using (product)
            {
                List <Models.Produc_suc> result = product.getProductNoSub();

                foreach (Models.Produc_suc item in result)
                {
                    dataGridView1.Rows.Add(item.Id, item.Code1, item.Code2, item.Description, item.Cost, (item.Existencia + item.Devoluciones), item.Price1, item.Price2);
                }
            }
        }