Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!Regex.IsMatch(txtNroFactura.Text, regexSoloNumeros))
            {
                MessageBox.Show("Ingrese un numero de factura valido");
            }
            else
            {
                if (this.facturaRepetida(decimal.Parse(txtNroFactura.Text)) == true)
                {
                    MessageBox.Show("La factura ya esta en la lista");
                }
                else
                {
                    Factura factura = new Factura();

                    int a;

                    if (!int.TryParse(txtNroFactura.Text, out a))
                    {
                        MessageBox.Show("La factura debe ser un numero");
                    }
                    else
                    {
                        if (FacturasRepository.GetFacturaByNro(decimal.Parse(txtNroFactura.Text)).EmpresaCuit == null)
                        {
                            MessageBox.Show("No existe una factura con ese numero, debe crearla primero");
                        }
                        else
                        {
                            factura = FacturasRepository.GetFacturaByNro(a);

                            factura.Monto = FacturasRepository.ImporteFactura(factura.Nro);

                            importePago += factura.Monto;

                            lblImporte.Text = "$" + importePago;

                            listBox1.Items.Add(factura);
                        }
                    }
                }
            }

            txtNroFactura.Text = "";

            txtNroFactura.Focus();
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItems.Count > 0)
            {
                Factura f = new Factura();

                f = (Factura)listBox1.SelectedItems[0];

                importePago -= FacturasRepository.ImporteFactura(f.Nro);

                listBox1.Items.Remove(listBox1.SelectedItems[0]);
                listBox1.Refresh();

                lblImporte.Text = "$" + importePago;

                txtNroFactura.Text = "";
            }
        }