Ejemplo n.º 1
0
        private void agregarEmpleadoToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FormPersona agregarPersona = new FormPersona("Empleado");

            agregarPersona.Text = "AGREGAR EMPLEADO";
            if (agregarPersona.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Empleado agregado correctamente");
            }
        }
Ejemplo n.º 2
0
        private void agregarClienteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormPersona agregarPersona = new FormPersona("Cliente");

            agregarPersona.Text = "AGREGAR CLIENTE";
            if (agregarPersona.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Cliente agregado correctamente");
            }
        }
Ejemplo n.º 3
0
        private void listaClientesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMostrarLista mostrarLista = new FormMostrarLista();

            mostrarLista.ListaDtgv.DataSource = Administracion.Clientes;
            mostrarLista.BotonAgregar.Enabled = true;
            mostrarLista.Text = "LISTA CLIENTES";
            if (mostrarLista.ShowDialog() == DialogResult.Yes) //si presiona agregar
            {
                FormPersona agregarPersona = new FormPersona("Cliente");
                if (agregarPersona.ShowDialog() == DialogResult.OK) //aceptar en formPersona
                {
                    listaClientesToolStripMenuItem_Click(sender, e);
                }
            }
        }
Ejemplo n.º 4
0
 private void btnRealizarVenta_Click(object sender, EventArgs e)
 {
     RestearTiempoInactividad();
     if (carritoDeCompras.Count > 0 && this.txbDniCliente.BackColor != Color.Red)
     {
         Compra compra = new Compra((Administracion.UltimoNroCompras) + 1, carritoDeCompras);
         compra.ReducirTotal(compra.Total * descuento);
         if (Administracion.Add(compra))
         {
             if (Administracion.FindClienteIndexByDni(Validaciones.StringToInt(this.txbDniCliente.Text)) == -1 || (Validaciones.StringToInt(this.txbDniCliente.Text) == 0))
             {
                 //preguntar si crear nuevo cliente o no (si no agregarlo a anonimo)
                 if (Validaciones.StringToInt(this.txbDniCliente.Text) == 0 || MessageBox.Show("El DNI no se encuantra registrado en clientes desea crear uno nuevo", "CLIENTE NO REGISTRADO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                 {
                     Administracion.Clientes[Administracion.FindClienteIndexByDni(0)].AgregarCompra(compra); //se agrega la compra al cliente con dni 0 (anonimo)
                 }
                 else
                 {
                     FormPersona formPersona = new FormPersona("Cliente");
                     if (formPersona.ShowDialog() == DialogResult.OK)
                     {
                         MessageBox.Show("Cliente agregado correctamente");
                     }
                 }
             }
             else
             {
                 Administracion.Clientes[Administracion.FindClienteIndexByDni(Validaciones.StringToInt(this.txbDniCliente.Text))].AgregarCompra(compra); //agrego compra a un cliente existente mediante su dni
             }
             Administracion.Empleados[Administracion.FindEmpleadoIndexByDni(Validaciones.StringToInt(this.txbEmpleadoDni.Text))].AgregarCompra(compra);  //agergo compra al empleado actual
             this.lblVuelvaProntoss.Visible = true;
             compra.GenerarTicket("tickets");
             carritoDeCompras = new List <ItemCompra>(); //limpio el carritoDeCompras
             sonidoCompra.Play();
             CargarAllDataGrid();
         }
         else
         {
             MessageBox.Show("No se pudo realizar la compra!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Ejemplo n.º 5
0
        private void listaEmpleadosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMostrarLista mostrarLista = new FormMostrarLista();

            mostrarLista.ListaDtgv.DataSource  = Administracion.Empleados;
            mostrarLista.BotonAgregar.Enabled  = true;
            mostrarLista.BotonDetalles.Enabled = true;
            mostrarLista.Text = "EMPLEADOS";
            if (mostrarLista.ShowDialog() == DialogResult.Yes) // si se apreta el boton agregar
            {
                FormPersona agregarPersona = new FormPersona("Empleado");
                if (agregarPersona.ShowDialog() == DialogResult.OK) //cuando apretan aceptar en el FormPersona
                {
                    listaEmpleadosToolStripMenuItem_Click(sender, e);
                }
            }
            else if (mostrarLista.DialogResult == DialogResult.No) //si apretan el boton detalles
            {
                mostrarLista.ListaDtgv.DataSource = ((Empleado)(mostrarLista.Dato)).ListaVentas;
                mostrarLista.BotonAgregar.Enabled = false;
                mostrarLista.Text = "LISTA DE VENTAS";
                if (mostrarLista.ShowDialog() == DialogResult.OK) //boton salir del FormMostrarLista
                {
                    listaEmpleadosToolStripMenuItem_Click(sender, e);
                }
                else if (mostrarLista.DialogResult == DialogResult.No) //si apreta detalles de compra
                {
                    mostrarLista.ListaDtgv.DataSource  = ((Compra)(mostrarLista.Dato)).ListaItemsCompra;
                    mostrarLista.BotonAgregar.Enabled  = false;
                    mostrarLista.BotonDetalles.Enabled = false;
                    mostrarLista.Text = "DETALLES DE COMPRA";
                    if (mostrarLista.ShowDialog() == DialogResult.OK) //boton salir del FormMostrarLista
                    {
                        listaEmpleadosToolStripMenuItem_Click(sender, e);
                    }
                }
            }
        }