Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Seguro desea eliminar esta venta?", "Ventas", MessageBoxButtons.OK);

            DataGridViewRow current = dataGridView_GestionarVentas.CurrentRow;

            InfoCosteProgramaGenNHibernate.CEN.InfoCoste.PedidoClienteCEN ccen = new InfoCosteProgramaGenNHibernate.CEN.InfoCoste.PedidoClienteCEN();
            ccen.Borrar(Convert.ToInt32(current.Cells[0].Value));

            GestionarVentas_Load(null, null);
        }
Esempio n. 2
0
        private void GestionarVentas_Load(object sender, EventArgs e)
        {
            PedidoClienteCEN pcCEN = new PedidoClienteCEN();
            IList<PedidoClienteEN> listaPedidos = pcCEN.LeerTodos(0,100);

            dataGridView_GestionarVentas.Rows.Clear();
            foreach(PedidoClienteEN pedido in listaPedidos)
            {
                LineaPedidoCP lpCP = new LineaPedidoCP();
                List<List<String>> filas = lpCP.getLineasPedidoPorId(pedido.Id);

                double total = 0;

                foreach (List<String> fila in filas)
                {
                    total += Double.Parse(fila[5]);
                }

                LineaPedidoCP lpCP2 = new LineaPedidoCP();

                dataGridView_GestionarVentas.Rows.Add(pedido.Id, lpCP2.getClienteDePedido(pedido.Id).NombreCompleto, pedido.Fecha, total.ToString());
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if(cliente.Text == "")
            {
                MessageBox.Show(this, "Selecciona un cliente", "Error");
            }
            else if(dataGridView1.Rows.Count == 0)
            {
                MessageBox.Show(this, "Agregue productos a la venta", "Error");
            }
            else
            {
                PedidoClienteCEN pcCEN = new PedidoClienteCEN();
                IList<PedidoClienteEN> listaPed = pcCEN.LeerTodos(0,100);

                int nID = 0;
                try
                {
                    nID = listaPed.Last().Id + 1;
                }
                catch (Exception ex) { }

                pcCEN.PedidoCliente(nID, DateTime.Now, c.Id);

                PedidoClienteEN pcEN = pcCEN.LeerPorOID(nID);

                LineaPedidoCEN lpCEN = new LineaPedidoCEN();

                int id = 0;
                try
                {
                    id = lpCEN.LeerTodos(0, 10000).Last().Id + 1;
                }
                catch (Exception ex) { }

                int i = 0;
                List<int> listaID = new List<int>();
                foreach (DataGridViewRow fila in dataGridView1.Rows)
                {
                    lpCEN.LineaPedido(id, i,Convert.ToInt32(fila.Cells[1].Value.ToString()), Double.Parse(fila.Cells[3].Value.ToString()),Convert.ToInt32(fila.Cells[0].Value.ToString()));
                    listaID.Add(id);

                    i++;
                    id++;
                }
                pcCEN.AnyadirLinea(pcEN.Id, listaID);

                // hasta aki va pedido, seguir con tipofactura

                MessageBox.Show(this, "Creado como pedido numero " + pcEN.Id+"\nCreada Factura", "Guardar documento");

                DialogResult = DialogResult.OK;
                this.Close();
            }
        }