コード例 #1
0
ファイル: Account.cs プロジェクト: DFirsa/itmo-OOP
 public override void transfer(double sum, Account recipient)
 {
     try
     {
         TransactionHandler transaction = new ReplanishHandler(this);
         TransactionHandler refill      = new RefillHandler(recipient);
         transaction.setNext(refill);
         transaction.handleRequest(sum);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         throw new Exception();
     }
 }
コード例 #2
0
ファイル: Account.cs プロジェクト: DFirsa/itmo-OOP
 public virtual void transfer(double sum, Account recipient)
 {
     if (isSuspicious() && sum > operationLimit)
     {
         throw new SuspiciousAccException();
     }
     else
     {
         try
         {
             TransactionHandler transaction = new ReplanishHandler(this);
             TransactionHandler refill      = new RefillHandler(recipient);
             transaction.setNext(refill);
             transaction.handleRequest(sum);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
             throw new Exception();
         }
     }
 }