예제 #1
0
        public Boolean realizarPago(int idGasto, int idCuenta)
        {
            Gasto  tmpGasto  = new Gasto();
            Cuenta tmpCuenta = new Cuenta();

            try
            {
                //Armo los objetos de cuenta y gasto
                tmpGasto  = tmpGasto.obtenerObjGasto(idGasto);
                tmpCuenta = tmpCuenta.obtenerObjCuenta(idCuenta);

                //Creo la transaccion
                Transaccion transac = new Transaccion("Pago cuenta", tmpGasto.Monto, DateTime.Today.ToString("dd/MM/yyyy"), tipoTransaccion.Extraccion, estado.Realizada, tmpGasto.Id, tmpCuenta.Id, 0, "");
                //Descuento los montos de la cuenta y cambio de estado al gasto
                tmpCuenta.realizarMovimiento(transac);
                tmpGasto.Estado = estado.Realizada;

                //guardo la cuenta y el gasto
                tmpCuenta.modificarCuenta(tmpCuenta);
                tmpGasto.modificarEstadoGasto(tmpGasto.Id, (int)tmpGasto.Estado);
                transac.ingresarTransaccion(transac);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public Boolean realizarExtraccion(int idCuenta, Decimal monto, String concepto)
        {
            Cuenta cuenta = new Cuenta();

            cuenta.obtenerObjCuenta(idCuenta);
            Transaccion transacExt = new Transaccion(concepto, monto, idCuenta, tipoTransaccion.Extraccion, estado.Realizada);

            if (cuenta.realizarMovimiento(transacExt))
            {
                transacExt.ingresarTransaccion(transacExt);
                return(true);
            }
            return(false);
        }
예제 #3
0
        public Boolean realizarTransferencia(int pCuentaOrig, int pCuentaDestino, Decimal monto, String concepto)
        {
            Cuenta orig = new Cuenta();
            Cuenta dest = new Cuenta();

            orig = orig.obtenerObjCuenta(pCuentaOrig);
            dest = dest.obtenerObjCuenta(pCuentaDestino);
            Transaccion transac = new Transaccion(concepto, monto, pCuentaOrig, pCuentaDestino, tipoTransaccion.Transferencia, estado.Realizada);

            if (orig.realizarMovimiento(transac) && dest.realizarMovimiento(transac))
            {
                transac.ingresarTransaccion(transac);
                return(true);
            }
            return(false);
        }
예제 #4
0
        public Boolean confirmarPagoCliente(int idtransac)
        {
            Transaccion tmptransac = new Transaccion();

            try
            {
                tmptransac.obtenerObjTransac(idtransac);
                tmptransac.EstadoTransaccion = estado.Realizada;
                Cuenta cuen = new Cuenta();
                cuen = cuen.obtenerObjCuenta(tmptransac.IdCuentainicial);
                cuen.realizarMovimiento(tmptransac);
                tmptransac.modificarTransaccion(tmptransac);
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }