Esempio n. 1
0
        private void MostrarProducto()
        {
            CNProducto objeto = new CNProducto();
            string     filtro;

            filtro = txtFiltro.Text.Replace("'", "");
            dgwProducto.DataSource = objeto.listaDeProducto(filtro);
            labelContador.Text     = dgwProducto.Rows.Count.ToString();
        }
Esempio n. 2
0
        private void agregarDgv()
        {
            for (int i = 0; i < 16; i++)
            {
                if (chkArray[i].Checked)

                {
                    int sent = 0, pos = 0;
                    btnFactura.Enabled = true;
                    CEDetalleFactura det  = new CEDetalleFactura();
                    CEProducto       prod = new CEProducto();
                    CNProducto       get  = new CNProducto();
                    //asignar id a objeto producto, recuperar valores de la BD
                    prod.IdProducto = i + 1;
                    prod.Nombre     = get.NombreProducto(prod.IdProducto);
                    prod.Precio     = get.PrecioProducto(prod.IdProducto);
                    //Agregar fila a detalle factura
                    det.IdProducto = prod.IdProducto;
                    det.Cantidad   = int.Parse(nudArray[i].Value.ToString());


                    DataGridViewRow row = (DataGridViewRow)dgvDetalleFactura.Rows[0].Clone();
                    row.Cells[0].Value = prod.Nombre;
                    row.Cells[1].Value = nudArray[i].Value;
                    row.Cells[2].Value = prod.Precio;
                    row.Cells[3].Value = prod.Precio * nudArray[i].Value;
                    dgvDetalleFactura.Rows.Add(row);
                    for (int j = 0; j < detallesFactura.Count; j++)
                    {
                        if (detallesFactura[j].IdProducto == det.IdProducto)
                        {
                            sent = 1;
                            pos  = j;
                        }
                    }
                    if (sent == 1)
                    {
                        detallesFactura[pos].Cantidad += det.Cantidad;
                    }
                    else
                    {
                        detallesFactura.Add(det);
                    }
                }
            }
        }
Esempio n. 3
0
        public JsonResult buscaProducto(string xml)
        {
            try
            {
                CNProducto productos          = new CNProducto();
                IEnumerable <CEProducto> data = productos.listarProducto(xml);
                return(Json(data));
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
        }
 private void Mostrar()
 {
     this.dataListado.DataSource = CNProducto.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Esempio n. 5
0
        private void mostrar()
        {
            CNProducto objeto = new CNProducto();

            dataGridView1.DataSource = objeto.Mostrar();
        }