Example #1
0
        private void Imprimirbutton_Click(object sender, EventArgs e)
        {
            RepositorioFactura    factura = new RepositorioFactura();
            List <DetalleFactura> lista   = new List <DetalleFactura>();

            lista = factura.Buscar((int)IDnumericUpDown.Value).Detalles;

            if (Detalle.Count > 0)
            {
                ReporteFacturaConsumidor reporte = new ReporteFacturaConsumidor(lista);
                reporte.ShowDialog();
            }
            else
            {
                MyerrorProvider.Clear();
                MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir.");
            }
        }
Example #2
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (!Validar())
            {
                return;
            }
            bool               paso;
            Facturas           facturas;
            RepositorioFactura repositorio = new RepositorioFactura();

            facturas = LlenaClase();

            if (IDnumericUpDown.Value == 0)
            {
                paso = repositorio.Guardar(facturas);
            }
            else
            {
                if (!Existe())
                {
                    MessageBox.Show("No se puede modificar porque no existe en la base de datos.",
                                    "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                paso = repositorio.Modificar(facturas);
            }

            if (paso)
            {
                MessageBox.Show("Guardado!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
                var resultado = MessageBox.Show("Deseas imprimir esta factura?.", "ButterSoft", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (resultado == DialogResult.Yes)
                {
                    ReporteFacturaConsumidor reporte = new ReporteFacturaConsumidor(Detalle);
                    reporte.ShowDialog();
                }
                Limpiar();
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }