Exemple #1
0
        private int ChooseId(bool valid = false)
        {
            iOProvider.WriteLine(phraseProvider.GetPhrase("EnterStockId"));
            if (valid)
            {
                iOProvider.WriteLine(phraseProvider.GetPhrase("InputError"));
            }

            if (int.TryParse(iOProvider.ReadLine(), out int id))
            {
                return(id);
            }
            return(ChooseId(true));
        }
Exemple #2
0
        private string EnterSurname(bool Valid = false)
        {
            iOProvider.Clear();
            iOProvider.WriteLine(phraseProvider.GetPhrase("EnterSurname"));
            if (Valid)
            {
                iOProvider.WriteLine(phraseProvider.GetPhrase("InputError"));
            }

            string value;

            if (string.IsNullOrWhiteSpace(value = iOProvider.ReadLine()))
            {
                return(EnterName(true));
            }
            else
            {
                return(value);
            }
        }
Exemple #3
0
 private int SelectFeature(bool inputError = false)
 {
     PrintFeature(inputError);
     if (int.TryParse(iOProvider.ReadLine(), out int UserSelect))
     {
         return(UserSelect);
     }
     else
     {
         return(SelectFeature(true));
     }
 }
        public void Run()
        {
            logger.InitLogger();
            string userInput = "";

            logger.WriteInfo("Program started");
            logger.WriteInfo(phraseProvider.GetPhrase("Welcome"));
            while (!userInput.ToLower().Equals("e"))
            {
                userInput = ioProvider.ReadLine();
                logger.WriteInfo($"User input: {userInput}");
                logger.RunWithExceptionLogging(() => processUserInput(userInput));
            }

            logger.WriteInfo("Program ended");
        }