public override void SendMessage(string message) { if (String.IsNullOrWhiteSpace(replyChannel)) { IO.WriteLine(message); } else { IO.WriteLine(message, replyChannel); } }
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()); }
public void Run() { int UserSelect = SelectFeature(); switch (UserSelect) { case 1: if (!tradeStart) { tradeStart = true; thread = new Thread(new ThreadStart(Transaction)); thread.Start(); } else { tradeStart = false; } break; case 2: new UserView(phraseProvider, iOProvider) .PrinaAllUsers(usersService.GetAllUsers()); iOProvider.ReadKey(); break; case 3: usersService.AddNewUser(new UserView(phraseProvider, iOProvider) .CreateUser()); break; case 4: new ShareView(phraseProvider, iOProvider) .PrintAllShares(shareServices.GetAllShares()); iOProvider.WriteLine(phraseProvider.GetPhrase("BackToMain")); iOProvider.ReadKey(); break; case 5: ShareView share = new ShareView(phraseProvider, iOProvider); share.PrintAllShares(shareServices.GetAllShares()); try { shareServices.ChangeSharePrice(share.ShareId(), share.ShareNewPrice()); } catch (Exception ex) { iOProvider.WriteLine(ex.Message); } iOProvider.WriteLine(phraseProvider.GetPhrase("BackToMain")); iOProvider.ReadKey(); break; case 6: new UserView(phraseProvider, iOProvider) .PrintAllUsersInOrange(usersService.GetAllUsersWithZero()); iOProvider.ReadKey(); break; case 7: new UserView(phraseProvider, iOProvider) .PrintAllUsersInBlack(usersService.GetAllUsersWithNegativeBalance()); iOProvider.ReadKey(); break; } }
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()); }