Beispiel #1
0
        //Ingresar pago
        private void ingresarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                IServicio serv = new ServicioClient();

                try
                {   //Si hay facturas ingresadas
                    if (lasFacturas.Count != 0)
                    {
                        Pago unPago = new Pago();

                        unPago.NumeroInt   = 0;
                        unPago.MontoTotal  = Convert.ToInt32(txtMontoTotal.Text);
                        unPago.Fecha       = DateTime.Today;
                        unPago.LasFacturas = lasFacturas.ToArray();
                        unPago.UsuCajero   = usuLogueado;

                        //Alto el pago
                        serv.AltaPago(unPago, usuLogueado);

                        //Limpio los controles
                        LimpiarDatosFactura();
                        gvListaFacturas.Columns.Clear();
                        lasFacturas.Clear();
                        txtMontoTotal.Text = "";

                        dt = new DataTable();
                        CargarColumnasGridView();

                        lblMensaje.Text = "Pago agregado correctamente";
                    }
                    else
                    {
                        throw new Exception("El pago debe contener al menos una factura");
                    }
                }
                catch (Exception ex)
                {
                    lblMensaje.Text = "Error: " + ex.Message;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text = "Error: " + ex.Message;
            }
        }