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); } }
static void Main(string[] args) { Card card= new Card { Balance = 1000, BlockCard = false, IDUser = "******", }; ManagerATM managerATM = new ManagerATM(card); MainMenu mainMenu = managerATM.StartMainMenu(card); while (!card.BlockCard && !mainMenu.BlockMenu) { mainMenu.Operations(card, managerATM); } DataInputOutputManager.InputMessenger(); }
static void Main(string[] args) { Card card = new Card { Balance = 1000, BlockCard = false, IDUser = "******", }; ManagerATM managerATM = new ManagerATM(card); MainMenu mainMenu = managerATM.StartMainMenu(card); while (!card.BlockCard && !mainMenu.BlockMenu) { mainMenu.Operations(card, managerATM); } DataInputOutputManager.InputMessenger(); }