Beispiel #1
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!");
     }
 }
Beispiel #2
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!");
     }
 }