コード例 #1
0
 public IOperation createOperation(int number)
 {
     IOperation operation = null;
     switch (number)
     {
         case Credit.CREDIT: operation = new Credit(); break;
         case Deposit.DEPOSIT: operation = new Deposit(); break;
         case Card.CARD: operation = new Card(); break;
         case Transfer.TRANSFER: operation = new Transfer(); break;
         case Payment.PAYMENT: operation = new Payment(); break;
     }
     return operation;
 }
コード例 #2
0
 public IOperation getOperation(int number)
 {
     int count = this.operations.Count;
     for (int i = 0; i < count; i++)
     {
         if (operations[i].getNumberOperation() == number)
         {
             IOperation op = operations[i];
             operations.RemoveAt(i);
             return op;
         }
     }
     IOperation currentOperation = new Credit();
     switch (number)
     {
         case Credit.CREDIT: currentOperation = new Credit(); break;
         case Deposit.DEPOSIT: currentOperation = new Deposit(); break;
         case Card.CARD: currentOperation = new Card(); break;
         case Transfer.TRANSFER: currentOperation = new Transfer(); break;
         case Payment.PAYMENT: currentOperation = new Payment(); break;
     }
     return currentOperation;
 }