Esempio n. 1
0
 public ManagerATM(object card)
 {
     StartATM(card);
     if (!cardInput)
     {
         DataInputOutputManager.OutputMessenger("Cant get card.");
     }
 }
Esempio n. 2
0
 public bool BlockCommandLimit(int counter)
 {
     if (counter < countCommandLimit)
     {
         return(false);
     }
     else
     {
         DataInputOutputManager.OutputMessenger("So much command!");
         return(true);
     }
 }
Esempio n. 3
0
 public bool BlockBadCommand(int counter)
 {
     if (counter < countBadCommand)
     {
         DataInputOutputManager.OutputMessager("Limit of bad attempts ", countBadCommand - counter);
         return(false);
     }
     else
     {
         DataInputOutputManager.OutputMessenger("Bad command. YOURS CARD WAS BLOCK!");
         return(true);
     }
 }
Esempio n. 4
0
 //Counters
 public bool BlockBadSum(int counter)
 {
     ++counterBadCommand;
     if (counter < counBadSum && !BlockBadCommand(counterBadCommand))
     {
         DataInputOutputManager.OutputMessager("Wrong sum, you have attempts: ", counBadSum - counter);
         return(false);
     }
     else
     {
         DataInputOutputManager.OutputMessenger("So much bad sum. YOUR CARD WAS BLOCKED!");
         return(true);
     }
 }
Esempio n. 5
0
 public bool BlockCardPinCode(int counter)
 {
     if (counter < countBadPinCode)
     {
         ++counterBadCommand;
         DataInputOutputManager.OutputMessager("Wrong pin code, you have attempts: ", countBadPinCode - counter);
         return(false);
     }
     else
     {
         DataInputOutputManager.OutputMessenger("Wrong pin code. YOUR CARD WAS BLOCKED!");
         return(true);
     }
 }
Esempio n. 6
0
 public bool BlockTimeLimitSassion(bool i)
 {
     if (i)
     {
         blockStateTimer = false;
         timerSession.Start();
     }
     timerSession.Elapsed += TimerSassionElapsed;
     if (blockSassionTimer)
     {
         DataInputOutputManager.OutputMessenger("Time session is out!");
     }
     return(blockSassionTimer);
 }
Esempio n. 7
0
 //Timers
 public bool BlockTimeLimitState(bool i)
 {
     if (i)
     {
         blockStateTimer = false;
         timerState.Stop();
         timerState.Start();
     }
     timerState.Elapsed += TimerStateElapsed;
     if (blockStateTimer)
     {
         DataInputOutputManager.OutputMessenger("Time state is out!");
     }
     return(blockStateTimer);
 }
Esempio n. 8
0
        public void Operations(Card card, ManagerATM managarATM)
        {
            while (!card.BlockCard && !BlockMenu)
            {
                ++countCommands;
                BlockMenu     = (blocker.BlockBadCommand(countBadCommands) || blocker.BlockTimeLimitState(true) || blocker.BlockTimeLimitSassion(false) || blocker.BlockCommandLimit(countCommands)) ? true : false;
                enterUserData = enterUserData.CheckCommandSimbols();
                Enum.TryParse(enterUserData, true, out userCommand);
                switch (userCommand)
                {
                case UserCommand.BALANCE:
                    DataInputOutputManager.OutputMessenger(GetBalance(card).ToString());
                    BlockMenu            = (blocker.BlockTimeLimitState(false) || blocker.BlockTimeLimitSassion(false) || blocker.BlockCommandLimit(countCommands)) ? true : false;
                    managarATM.cardInput = (BlockMenu || card.BlockCard) ? false : true;
                    break;

                case UserCommand.CASH:
                    GetCash(card, cash.CheckSumSimbols());
                    DataInputOutputManager.OutputMessenger(card.Balance.ToString());
                    BlockMenu            = (blocker.BlockTimeLimitState(false) || blocker.BlockTimeLimitSassion(false) || blocker.BlockCommandLimit(countCommands)) ? true : false;
                    managarATM.cardInput = (BlockMenu || card.BlockCard) ? false : true;
                    break;

                case UserCommand.EXIT:
                    Exit(card);
                    BlockMenu            = (blocker.BlockTimeLimitState(false) || blocker.BlockTimeLimitSassion(false) || blocker.BlockCommandLimit(countCommands)) ? true : false;
                    managarATM.cardInput = (BlockMenu || card.BlockCard) ? false : true;
                    break;

                default:
                    ++countBadCommands;
                    BlockMenu            = (blocker.BlockTimeLimitState(false) || blocker.BlockTimeLimitSassion(false) || blocker.BlockCommandLimit(countCommands)) ? true : false;
                    managarATM.cardInput = (BlockMenu || card.BlockCard) ? false : true;
                    break;
                }
            }
            while (!managarATM.cardInput)
            {
                DataInputOutputManager.OutputMessenger("Menu blocked");
                DataInputOutputManager.InputMessenger();
                managarATM.cardInput = true;
                blocker.BlockTimeLimitSassion(true);
                blocker.BlockTimeLimitState(true);
                card.BlockCard = false;
                BlockMenu      = false;
                managarATM.StartMainMenu(card);
            }
        }
Esempio n. 9
0
 public MainMenu(Card card)
 {
     Run();
     CheckPinCode(card);
     if (!card.BlockCard && !BlockMenu)
     {
         DataInputOutputManager.OutputMessenger("MENU");
     }
     else
     {
         while (card.BlockCard && BlockMenu)
         {
             DataInputOutputManager.InputMessenger();
         }
     }
 }
Esempio n. 10
0
 public void Run()
 {
     blocker.BlockTimeLimitSassion(true);
     blocker.BlockTimeLimitState(true);
     DataInputOutputManager.OutputMessenger("INSERT");
 }