Example #1
0
        public bool AgregarAbonoCC(Abono _abono)
        {
            DAOAbono abono = new DAOAbono();

            if (abono.CantidadAbonos(_abono.Factura) == 0)
            {
                System.Diagnostics.Debug.WriteLine(abono.CantidadAbonos(_abono.Factura));
                if (abono.AgregarPrimerAbono(_abono))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (abono.AgregarAbonoCC(_abono))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #2
0
        public bool ValidarMonto(int miFactura, double monto)
        {
            try
            {
                DAOAbono abono = new DAOAbono();
                double   deuda = abono.ConsultarDeuda(miFactura);
                if (deuda == 0)
                {
                    return(true);
                }
                else
                {
                    if (monto < deuda)
                    {
                        return(true);
                    }
                    else
                    {
                        if (deuda - monto == 0)
                        {
                            //aqui se llama al procedimiento para settear el estado de la factura en 1
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }

                        return(false);
                    }
                }
            }

            catch (NullReferenceException e)
            {
                throw new Exception("No hay deuda", e);
            }
            catch (Exception e)
            {
                throw new Exception("Error en la consulta de la Deuda", e);
            }
        }