Beispiel #1
0
        private void btn_agregarvarios_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            //prueba Teclado Numerico

            tecladoNum teclado = new tecladoNum(false);

            teclado.ShowDialog();
            int    c    = int.Parse(teclado.response.ToString());
            string prod = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();

            recueraIdProducto(prod);
            agregaLista(c, prod);

            //tecladoNum teclado = new tecladoNum(false);
            //teclado.ShowDialog();
            //int c = int.Parse(teclado.response.ToString());
            //for (int i = 0; i <= lproductos.Count() - 1; i++)
            //{
            //    if (lproductos[i].ToString() == label1.Text.Trim())
            //    {
            //        c = c + 1;
            //    }
            //}
            //int bandera = 0;
            //int r1, r2;
            //if (dataGridView1.Rows[0].Cells[0].Value != null)
            //{
            //    for (int j = 0; j < dataGridView1.Rows.Count - 1; j++)
            //    {
            //        r1 = int.Parse(dataGridView1.Rows[j].Cells[1].Value.ToString());
            //        r2 = recueraIdProducto(label1.Text.Trim());
            //        if (r1 == r2)
            //        {
            //            dataGridView1.Rows[j].Cells[3].Value = c;
            //            bandera = 1;
            //        }
            //    }
            //    if (bandera == 0)
            //    {
            //        dataGridView1.Rows.Add(recuperaidCategoria(categoria), recueraIdProducto(label1.Text.Trim()), label1.Text.Trim(), c, preciomay);

            //    }
            //}
            //else
            //    dataGridView1.Rows.Add(recuperaidCategoria(categoria), recueraIdProducto(label1.Text.Trim()), label1.Text.Trim(), c, preciomay);

            ////falta funcionalida de recuperar el dato del teclado
            //agregaLista(int.Parse(teclado.response.ToString()), label1.Text.Trim());
        }
Beispiel #2
0
        private void btn_agregarvarios_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            //prueba Teclado Numerico

            tecladoNum teclado = new tecladoNum(false);

            teclado.ShowDialog();
            int c = int.Parse(teclado.response.ToString());

            int idSeleccionado;

            if (dataGridView1.SelectedRows.Count > 0)
            {
                idSeleccionado = int.Parse(dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString());
            }
            else
            {
                return;
            }


            DataSet1TableAdapters.SP_tabla_ventaDetalleTableAdapter vdta = new Bar.DataSet1TableAdapters.SP_tabla_ventaDetalleTableAdapter();
            vdta.GetData("A", null, idSeleccionado, c, null, idVenta);

            cargarVenta(idVenta);

            //string prod = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            //recueraIdProducto(prod);
            //agregaLista(c, prod);
            //txt_total.Text = calculatotal();

            //for (int i = 0; i <= lproductos.Count() - 1; i++)
            //{
            //    if (lproductos[i].ToString() == label1.Text.Trim())
            //    {
            //        c = c + 1;
            //    }
            //}
            //int bandera = 0;
            //int r1, r2;
            //if (dataGridView1.Rows[0].Cells[0].Value != null)
            //{
            //    for (int j = 0; j < dataGridView1.Rows.Count - 1; j++)
            //    {
            //        r1 = int.Parse(dataGridView1.Rows[j].Cells[0].Value.ToString());
            //        r2 = recueraIdProducto(label1.Text.Trim());
            //        if (r1 == r2)
            //        {
            //            dataGridView1.Rows[j].Cells[2].Value = c;
            //            bandera = 1;
            //        }
            //    }
            //    if (bandera == 0)
            //    {
            //        dataGridView1.Rows.Add(recuperaidCategoria(categoria), recueraIdProducto(label1.Text.Trim()), label1.Text.Trim(), c, preciomay);

            //    }
            //}
            //else
            //    dataGridView1.Rows.Add(recuperaidCategoria(categoria), recueraIdProducto(label1.Text.Trim()), label1.Text.Trim(), c,preciomay);
            //txt_total.Text = calculatotal();
            //agregar a cantidad a lista
            //   agregaLista(int.Parse(teclado.response.ToString()), label1.Text.Trim());
        }