protected override BankWindow createOperations(int number)
 {
     OperationFactory factory = new OperationFactory();
     BankWindow bankWindow = new BankWindow(number, new BankWindowFreeState());
     bankWindow.addOperation(factory.createOperation(Credit.CREDIT));
     bankWindow.addOperation(factory.createOperation(Deposit.DEPOSIT));
     return bankWindow;
 }
 protected override BankWindow createOperations(int number, OperationManager manager)
 {
     OperationFactory factory = new OperationFactory();
     BankWindow bankWindow = new BankWindow(number, manager, new BankWindowFreeState());
     bankWindow.addOperation(factory.createOperation(Transfer.TRANSFER));
     bankWindow.addOperation(factory.createOperation(Payment.PAYMENT));
     return bankWindow;
 }
 protected override BankWindow createOperations(int number)
 {
     OperationFactory factory = new OperationFactory();
     BankWindow bankWindow = new BankWindow(number, new BankWindowFreeState());
     bankWindow.addOperation(factory.createOperation(Deposit.DEPOSIT));
     bankWindow.addOperation(factory.createOperation(Card.CARD));
     bankWindow.addOperation(factory.createOperation(Transfer.TRANSFER));
     return bankWindow;
 }
 protected override BankWindow createOperations(int number, OperationManager manager)
 {
     OperationFactory factory = new OperationFactory();
     BankWindow bankWindow = new BankWindow(number, manager);
     bankWindow.addOperation(factory.createOperation(Credit.CREDIT));
     bankWindow.addOperation(factory.createOperation(Deposit.DEPOSIT));
     bankWindow.addOperation(factory.createOperation(Card.CARD));
     bankWindow.addOperation(factory.createOperation(Transfer.TRANSFER));
     bankWindow.addOperation(factory.createOperation(Payment.PAYMENT));
     return bankWindow;
 }
Beispiel #5
0
        public Bank()
        {
            //this.listBankWindows = new List<BankWindow>();
            this.clientQueue = new ClientQueue();
            this.periodTimer = 1000;
            this.numberOfNewClients = 0;
            this.timer = new Timer(periodTimer);
            this.timer.Elapsed += OnTimedEvent;
            this.countBankWindows = 0;
            this.nameClients = new List<string>();
            string line;
            System.IO.StreamReader file = new System.IO.StreamReader(@"nameClients.txt",System.Text.Encoding.Default);
            while ((line = file.ReadLine()) != null)
            {
                this.nameClients.Add(line);
            }
            file.Close();

            bankWindows = new BankWindowComposite();
            BankWindowComponent one = new BankWindowComposite();
            BankWindowComponent two = new BankWindowComposite();
            BankWindowComponent three = new BankWindowComposite();

            BankWindowComponent oneWindow = new BankWindow(1);
            oneWindow.addOperation(new Credit());
            oneWindow.addOperation(new Deposit());
            bankWindows.add(oneWindow);
            bankWindows.add(one);

            BankWindowComponent twoWindow = new BankWindow(2);
            twoWindow.addOperation(new Credit());
            twoWindow.addOperation(new Deposit());
            twoWindow.addOperation(new Card());
            BankWindowComponent threeWindow = new BankWindow(3);
            threeWindow.addOperation(new Payment());
            threeWindow.addOperation(new Transfer());
            threeWindow.addOperation(new CurrencyExchangeAdapter(new CurrencyExchange()));
            one.add(twoWindow);
            one.add(threeWindow);
            one.add(two);

            BankWindowComponent fourWindow = new BankWindow(4);
            fourWindow.addOperation(new Deposit());
            fourWindow.addOperation(new Transfer());
            two.add(fourWindow);
            two.add(three);

            BankWindowComponent fiveWindow = new BankWindow(5);
            fiveWindow.addOperation(new Deposit());
            fiveWindow.addOperation(new Transfer());
            fiveWindow.addOperation(new Card());
            three.add(fiveWindow);
        }
 protected override BankWindow createOperations(int number, OperationManager manager)
 {
     OperationFactory factory = new OperationFactory();
     BankWindow bankWindow = new BankWindow(number, manager);
     Random r = new Random();
     List<int> operations = new List<int>();
     int count = r.Next(1, NUMBER_OF_OPERATION + 1);
     while (true)
     {
         bool flag = true;
         int numberOperation = r.Next(1, NUMBER_OF_OPERATION + 1);
         for (int k = 0; k < operations.Count; k++)
         {
             if (numberOperation == operations[k])
                 flag = false;
         }
         if (flag)
         {
             bankWindow.addOperation(factory.createOperation(numberOperation));
             operations.Add(numberOperation);
             count--;
         }
         if (count == 0) break;
     }
     return bankWindow;
 }
Beispiel #7
0
 //добавление окна
 public void addBankWindow(List<string> operations)
 {
     this.countBankWindows++;
     BankWindow bankWindow = new BankWindow(this.countBankWindows);
     for (int i = 0; i < operations.Count; i++)
     {
         switch(operations[i])
         {
             case Credit.CREDIT: bankWindow.addOperation(new Credit()); break;
             case Deposit.DEPOSIT: bankWindow.addOperation(new Deposit()); break;
             case Card.CARD: bankWindow.addOperation(new Card()); break;
             case Transfer.TRANSFER: bankWindow.addOperation(new Transfer()); break;
             case Payment.PAYMENT: bankWindow.addOperation(new Payment()); break;
         }
     }
     this.listBankWindows.Add(bankWindow);
 }