public void ClientPart(ref Client.Client cl, ref Credit.Credit[] credits, ref Bank.Bank bank, ref Worker.Worker w) { Console.Clear(); Console.WriteLine("1) For look your credit(s)"); Console.WriteLine("2) For add new credit"); Console.WriteLine("3) For convert money to dollar"); bool IsInt = int.TryParse(Console.ReadLine(), out int choose); if (IsInt) { if (choose == 1) { Console.Clear(); foreach (var item in credits) { if (item.TheClient.Name == cl.Name) { item.Print(); } } Thread.Sleep(3000); Console.Clear(); } else if (choose == 2) { Console.Clear(); Console.Write("Enter amonut: "); decimal amount = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine("Enter month: "); int month = Convert.ToInt32(Console.ReadLine()); w.addOperation(new Operation.Operation(Guid.NewGuid(), $"New credit was added in {cl.Name} account", DateTime.Now)); Credit.Credit[] cre = new Credit.Credit[credits.Length + 1]; for (int i = 0; i < credits.Length; i++) { cre[i] = credits[i]; } cre[cre.Length - 1] = new Credit.Credit(Guid.NewGuid(), cl, amount, month); credits = cre; } else if (choose == 3) { Console.Clear(); Console.Write("Write amount: "); bool isD = decimal.TryParse(Console.ReadLine(), out decimal res); if (isD) { decimal dess = res * (17 / 10); cl.Salary += res; cl.Salary -= dess; bank.Budget += dess * (17 / 10) - dess * (171 / 10); bank.ProfitCalculating(); } } } else { throw new Exception("Invalid type!"); } }
public void BankPart(ref Bank.Bank bank) { Console.Clear(); Console.WriteLine("1) for Look clients' credits"); Console.WriteLine("2) for Look profit of bank"); bool IsInt = int.TryParse(Console.ReadLine(), out int choose); if (IsInt) { if (choose == 1) { Console.Clear(); if (bank.Credits != null) { bank.ShowAllCredits(); Thread.Sleep(3000); } } else if (choose == 2) { Console.Clear(); bank.ProfitCalculating(); Console.WriteLine($"Profit of bank: {bank.Profit} azn"); Thread.Sleep(3000); } } else { throw new Exception("Invalid type!"); } }