Пример #1
0
 static void RunDefferedTransferCommand(DoDefferedTransferOptions opts)
 {
     if (Customer.IsAccountOwner(currentCustomer.IdCustomer, opts.AccountIdOrigin))
     {
         AbstractAccount accountOrigin      = DBQuery.GetAccountFromDB(opts.AccountIdOrigin);
         AbstractAccount accountDestination = DBQuery.GetAccountFromDB(opts.AccountIdDestination);
         if (accountOrigin.CanBeDebited(opts.AmountToTransfer, accountDestination) && accountDestination.CanBeCredited(opts.AmountToTransfer))
         {
             currentCustomer.MakeNewTransaction(opts.AmountToTransfer, accountOrigin, accountDestination, DateTime.Parse(opts.DefferedDate));
         }
     }
     else
     {
         IO.DisplayWarning("You can't make this deferred transfer, you aren't the account owner!");
     }
 }
Пример #2
0
 static void RunInstantTransferCommand(DoInstantTransferOptions opts)
 {
     if (Customer.IsAccountOwner(currentCustomer.IdCustomer, opts.AccountIdOrigin))
     {
         AbstractAccount accountOrigin      = DBQuery.GetAccountFromDB(opts.AccountIdOrigin);
         AbstractAccount accountDestination = DBQuery.GetAccountFromDB(opts.AccountIdDestination);
         if (accountOrigin.CanBeDebited(opts.AmountToTransfer, accountDestination) && accountOrigin.isMoneyEnough(opts.AmountToTransfer) && accountDestination.CanBeCredited(opts.AmountToTransfer) && accountDestination.isTransferNotReachingCeiling(opts.AmountToTransfer))
         {
             currentCustomer.MakeNewTransaction(opts.AmountToTransfer, accountOrigin, accountDestination);
         }
     }
     else
     {
         IO.DisplayWarning("You can't make this instant transfer, you aren't the account owner!");
     }
 }
Пример #3
0
 public override bool CanBeDebited(decimal amountToTransfer, AbstractAccount accountDestination)
 {
     if (isDebitAuthorized(this))
     {
         return(true);
     }
     else if (Customer.IsAccountOwner(Program.currentCustomer.IdCustomer, accountDestination.AccountNumber) == false)
     {
         IO.DisplayWarning(this.AccountNumber + " can not credit " + accountDestination.AccountNumber);
         return(false);
     }
     else
     {
         IO.DisplayWarning(this.AccountNumber + " is not authorized to debit " + accountDestination.AccountNumber);
         return(false);
     }
 }