Ejemplo n.º 1
0
        private void btnComprar_Click(object sender, EventArgs e)
        {
            cantidad  = Convert.ToInt32(txtCantidad.Text);
            resultado = AdmOfertas.comprarOferta(dni, fecha, cantidad, codigoOferta);

            switch (resultado)
            {
            case 0:
                MessageBox.Show("Compra realizada");
                break;

            case 1:
                MessageBox.Show("Error en la compra. No hay saldo suficiente");
                break;

            case 2:
                MessageBox.Show("Error en la compra. No hay cantidad suficiente");
                break;

            case 3:
                MessageBox.Show("Error en la compra. La oferta no esta disponible");
                break;

            case 4:
                MessageBox.Show("Error en la compra. La cantidad supera a la maxima");
                break;
            }
        }
Ejemplo n.º 2
0
        private void ListadoOfertas_Load(object sender, EventArgs e)
        {
            dgvCliente.Hide();
            dgvOfertas.DataSource = AdmOfertas.obtenerOfertasDisponibles().Tables[0];
            this.Controls.Add(Form1.MainMenu);

            dgvCliente.DataSource = AdmClientes.obtenerClientesNyA().Tables[0];

            if (ElegirRol.rolElegido == 1)
            {
                dgvCliente.Show();
            }
            else
            {
                dni = AdmClientes.obtenerDniDelUsuario(Login.username);
                label2.Hide();
            }
        }
Ejemplo n.º 3
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            if (txtDesc.Text != "" && txtPrecioLista.Text != "" && txtPrecioOferta.Text != "" && txtCantidad.Text != "" && txtCodigo.Text != "")
            {
                Oferta of;
                if (ProveSeleccionado != "")
                {
                    of = new Oferta(txtCodigo.Text, Convert.ToDecimal(txtPrecioOferta.Text), Convert.ToDecimal(txtPrecioLista.Text),
                                    dtpFechaPub.Value.Date, dtpFechaVec.Value.Date, Convert.ToDecimal(txtCantidad.Text), txtDesc.Text,
                                    1, ProveSeleccionado, Convert.ToDecimal(txtCantxCli.Text));
                }
                else
                {
                    of = new Oferta(txtCodigo.Text, Convert.ToDecimal(txtPrecioOferta.Text), Convert.ToDecimal(txtPrecioLista.Text),
                                    dtpFechaPub.Value.Date, dtpFechaVec.Value.Date, Convert.ToDecimal(txtCantidad.Text), txtDesc.Text,
                                    1, AdmProveedores.obtenerCuitDelUsuario(Login.username), Convert.ToDecimal(txtCantxCli.Text));
                }

                int filas = AdmOfertas.altaOferta(of);
                if (filas > 0)
                {
                    MessageBox.Show("Oferta creada correctamente");
                    Form1 f1 = new Form1();
                    f1.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Error en la creacion");
                }
            }
            else
            {
                MessageBox.Show("Complete todos los campos obligatorios");
            }
        }