Exemple #1
0
        private void PrintFeature(bool inputError)
        {
            iOProvider.Clear();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(phraseProvider.GetPhrase("WelcomeMain"));
            if (!tradeStart)
            {
                sb.AppendLine(string.Format("1. {0}", phraseProvider.GetPhrase("StartTrading")));
            }
            else
            {
                sb.AppendLine(string.Format("1. {0}", phraseProvider.GetPhrase("StopTrading")));
            }
            sb.AppendLine(string.Format("2. {0}", phraseProvider.GetPhrase("UsersList")));
            sb.AppendLine(string.Format("3. {0}", phraseProvider.GetPhrase("CreateUser")));
            sb.AppendLine(string.Format("4. {0}", phraseProvider.GetPhrase("StocksList")));
            sb.AppendLine(string.Format("5. {0}", phraseProvider.GetPhrase("ChangeStockPrice")));
            sb.AppendLine(string.Format("6. {0}", phraseProvider.GetPhrase("OrangeZone")));
            sb.AppendLine(string.Format("7. {0}", phraseProvider.GetPhrase("BlackZone")));

            if (inputError)
            {
                sb.AppendLine(phraseProvider.GetPhrase("InputError"));
            }

            iOProvider.WriteLine(sb.ToString());
        }
Exemple #2
0
        public void PrintAllShares(ICollection <ShareEntity> shares)
        {
            iOProvider.Clear();
            StringBuilder result = new StringBuilder();

            foreach (var share in shares)
            {
                result.AppendLine($"{share.Id}. {share.Name} от компании {share.CompanyName} по цене {share.Price}");
            }
            iOProvider.WriteLine(result.ToString());
        }
Exemple #3
0
        public void PrinaAllUsers(ICollection <UserEntity> users)
        {
            iOProvider.Clear();
            StringBuilder result = new StringBuilder();

            foreach (var user in users)
            {
                result.AppendLine($"Клиент {user.Name} {user.SurName} имеет баланс {user.Balance} и телефон {user.Phone}");
                if (user.UsersShares.Count == 0)
                {
                    result.AppendLine($"\tУ пользователя еще нет акций");
                }
                else
                {
                    foreach (var item in user.UsersShares)
                    {
                        result.AppendLine($"\t{item.Share.Name} в кол-ве {item.Amount} по цене {item.Share.Price}");
                    }
                }
                result.AppendLine();
            }
            result.AppendLine(phraseProvider.GetPhrase("BackToMain"));
            iOProvider.WriteLine(result.ToString());
        }