private void btHacerVenta_Click(object sender, RoutedEventArgs e)
        {
            int   acidez   = cbAcidez.SelectedIndex + 1;
            float pres     = Conexion.getPresentacion(cbPresent.SelectedIndex);
            int   cantidad = Int16.Parse(txtCantidad.Text);
            int   id       = Int16.Parse(txtCliente.Text);

            if (id == 0)
            {
                Cliente cl;
                cl = new Cliente();
                cl.crearCliente();
                id = cl.getidCliente();
            }
            Compra   comp   = new Compra(id, acidez, pres, cantidad);
            int      totalC = comp.generarCompra();
            DateTime fecha  = DateTime.Now;

            if (totalC > 0)
            {
                MessageBox.Show("compra realizada:  total:  " + totalC + ".0 $ pesos" + fecha.ToString());
            }
            else
            {
                MessageBox.Show("error en la compra");
            }
        }
        private void btComprobar_Click(object sender, RoutedEventArgs e)
        {
            float      present = Conexion.getPresentacion(cbAcidez.SelectedIndex);
            Disolvente d       = new Disolvente(cbAcidez.SelectedIndex + 1, present);
            int        cuantos = d.buscarCantidad();

            MessageBox.Show("la cantidad actual de disolvente es: " + cuantos);
        }
        private void btHacerPedido_Click(object sender, RoutedEventArgs e)
        {
            float      present = Conexion.getPresentacion(cbAcidez.SelectedIndex);
            Disolvente d       = new Disolvente(cbAcidez.SelectedIndex + 1, present);
            int        nuevC   = d.actualizarCantidad(1000);

            if (nuevC <= 0)
            {
                MessageBox.Show("no se pudo realizar el pedido");
            }
        }
Exemple #4
0
        private void btBusqPer_Click(object sender, RoutedEventArgs e)
        {
            int        acidez = cbAcidezInv.SelectedIndex + 1;
            float      pres   = Conexion.getPresentacion(cbPresenInv.SelectedIndex);
            Disolvente d      = new Disolvente(acidez, pres);

            txtExistencia.Text = d.buscarCantidad().ToString();
            int ganancias = d.gananciasParciales();

            if (ganancias >= 0)
            {
                txtGanPar.Text = ganancias + ".0 $";
            }
            else
            {
                MessageBox.Show("no se pudo actualizar el producto");
            }
        }
        private void btCalcular_Click(object sender, RoutedEventArgs e)
        {
            float present = Conexion.getPresentacion(cbAcidez.SelectedIndex);

            MessageBox.Show("" + present);
            Disolvente d        = new Disolvente(cbAcidez.SelectedIndex + 1, present);
            int        cantidad = Int16.Parse(txtCantidad.Text);
            int        total    = d.calcularPrecio(cantidad);

            if (total > 0)
            {
                txtTotal.Text = total + ".0 $";
            }
            else
            {
                MessageBox.Show("error ");
            }
        }