コード例 #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     nVenta   = new nVenta();
     nCliente = new nCliente();
     //ACTUALIZAR EL TIPO DE CLIENTE A PREMIUM SI TIENE MAS DE S/1000 en COMPRAS
     if (nVenta.listarVentas() != null)
     {
         List <decimal> cantidadComprasxCliente = new List <decimal>();
         decimal        aux = 0;
         foreach (eCliente cliente in nCliente.listarClientes())
         {
             foreach (eVenta venta in nVenta.listarVentas())
             {
                 if (venta.dniCliente == cliente.dniCliente)
                 {
                     aux += venta.totalVenta;
                 }
             }
             cantidadComprasxCliente.Add(aux);
             aux = 0;
         }
         int i = 0;
         foreach (eCliente cliente in nCliente.listarClientes())
         {
             if (cantidadComprasxCliente.ElementAt(i) > 1000)
             {
                 nCliente.actualizarCliente(cliente.dniCliente, "Premium");
             }
             i++;
         }
     }
     listaDetalles = new List <eDetalleVenta>();
     if (nVenta.listarVentas() != null)
     {
         foreach (eVenta venta in nVenta.listarVentas())
         {
             numeroCorrelativo = ++venta.idVenta;
         }
     }
     else
     {
         numeroCorrelativo = 0;
     }
 }
コード例 #2
0
        public frmReportes()
        {
            InitializeComponent();
            nCliente      = new nCliente();
            nProducto     = new nProducto();
            nVenta        = new nVenta();
            nDetalleVenta = new nDetalleVenta();
            decimal monto = 0;

            if (nVenta.listarVentas() != null && nProducto.listarProductos() != null && nCliente.listarClientes() != null)
            {
                label1.Text = "Cantidad de Ventas: " + nVenta.listarVentas().Count().ToString();
                //
                foreach (eVenta nventa in nVenta.listarVentas())
                {
                    monto += nventa.totalVenta;
                }
                //
                label2.Text = "Ganancias(S/.): " + string.Format("{0:F2}", Convert.ToDouble(monto));
                label4.Text = "Cantidad de Productos: " + nProducto.listarProductos().Count();
                //
                int x1, x2, x3;
                x1 = x2 = x3 = 0;
                foreach (eCliente cliente in nCliente.listarClientes())
                {
                    if (cliente.tipoCliente == "No Premium")
                    {
                        x1++;
                    }
                    else if (cliente.tipoCliente == "Premium")
                    {
                        x2++;
                    }
                    else if (cliente.tipoCliente == "Administrador")
                    {
                        x3++;
                    }
                }
                label6.Text = "Cantidad de Clientes No Premium: " + x1;
                label7.Text = "Cantidad de Clientes Premium: " + x2;
                label8.Text = "Cantidad de Administradores: " + x3;
                //
                if (nDetalleVenta.listarDetalles() != null)
                {
                    List <int> cantidadProductos = new List <int>();
                    foreach (eProducto producto in nProducto.listarProductos())
                    {
                        int aux = 0;
                        foreach (eDetalleVenta detalle in nDetalleVenta.listarDetalles())
                        {
                            if (detalle.codigoProducto == producto.codigoProducto)
                            {
                                aux += detalle.cantidad;
                            }
                        }
                        cantidadProductos.Add(aux);
                    }
                    int       mayor = 0;
                    int       i     = 0;
                    eProducto pro   = null;
                    foreach (eProducto producto in nProducto.listarProductos())
                    {
                        if (cantidadProductos.ElementAt(i) > mayor)
                        {
                            mayor = cantidadProductos.ElementAt(i);
                            pro   = producto;
                        }
                        i++;
                    }
                    label3.Text = "Producto con Mayor Demanda: " + pro.nombreProducto + "(" + pro.codigoProducto + ")";
                }
            }
        }
コード例 #3
0
 public frmRealizarCompra()
 {
     InitializeComponent();
     nVenta    = new nVenta();
     nProducto = new nProducto();
 }