static void Main(string[] args) { string Login = "******"; string Password = "******"; try { Client client = new Client(); Servise.createClient(ref client); client.Login = "******"; client.Password = "******"; while (!client.IsBlicked) { Console.Clear(); Console.WriteLine("Menu"); Console.WriteLine("Inter login"); Login = Console.ReadLine();; Console.WriteLine("Inter Password"); Password = Console.ReadLine(); if (Login != client.Login && Password != client.Password) { client.WrongField++; } else { break; } } if (Login == client.Login && Password == client.Password) { if (client.IsBlicked) { Console.WriteLine("You arr blocked"); } else { #region r Console.Clear(); Console.WriteLine(" 1 - Список счетов"); Console.WriteLine(" 2 - Создать счет"); Console.WriteLine(" 3 - Пополнить счет"); Console.WriteLine(" 6 - Выход"); int menu = 0; Int32.TryParse(Console.ReadLine(), out menu); if (menu > 6 || menu < 1) { throw new Exception("Invalid choice"); } else { switch (menu) { case 1: { Console.Clear(); client.PrintAccountInfo(); } break; case 2: { Console.Clear(); Account acc = Servise.createAccount(); client.ListAccount.Add(acc); Console.WriteLine("Счёт добавлен успешно!"); } break; case 3: { Console.WriteLine(" KZ "); string AccountNumber = Console.ReadLine(); Console.WriteLine("Введите сумму: "); string Summ = Console.ReadLine(); } break; case 4: { Console.WriteLine("Введите номер счёта: "); string accountNumber = Console.ReadLine(); Console.WriteLine("Веедите сумму "); string accountSum = Console.ReadLine(); try { foreach (var item in client.ListAccount) { if (item.AccountNumber == accountNumber) { if (double.Parse(accountSum) > item.Balance) { Console.WriteLine("Ошибка! Нет такой суммы на счету"); } else { item.Balance -= double.Parse(accountSum); Console.WriteLine("Сумма {0} успешна переведена на счёт {1}", accountSum, accountNumber); } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } int choice = 0; Console.WriteLine("Введите число для продолжения или 0 для выхода "); Int32.TryParse(Console.ReadLine(), out choice); if (choice == 0) { return; } else { break; } } case 6: return; } } #endregion } } else { Console.WriteLine("You arr blocked"); } } catch (Exception) { throw; } }
static void Main(string[] args) { string login = ""; string password = ""; try { Client client = new Client(); Servise.createClient(ref client); client.Login = "******"; client.Password = "******"; while (!client.IsBloked) { #region Console.Clear(); Console.Write("vvedite login:"******"vvedite parol:"); password = Console.ReadLine(); if (login != client.Login && password != client.Password) { client.WrongField++; } else { break; } #endregion } if (login == client.Login && password == client.Password) { #region if (client.IsBloked) { Console.WriteLine("zablokirivano"); } else { Console.Clear(); Console.WriteLine("(1) spisok schetov"); Console.WriteLine("(2) sozdat schet"); Console.WriteLine("(3) popolnit balance"); int choise = 0; Int32.TryParse(Console.ReadLine(), out choise); if (choise > 2 || choise < 1) { throw new Exception("tolko 1 ili 2"); } else { switch (choise) { case 1: client.printAccountInfo(); break; case 2: Account acc = new Account(); client.ListAccount.Add(acc); Console.WriteLine("schet dobavlen"); break; case 3: Console.WriteLine("vvedite nomer scheta: "); string accountNumber = Console.ReadLine(); Console.WriteLine("vvedite summu vvoda"); break; } } } #endregion } else { Console.WriteLine("vkluchena BLOKIROVKA akkaunta"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } List <Client> ListClient = new List <Client>(); Generator g = new Generator(); Client Cl = new Client(); Cl.DOB = DateTime.Now.AddYears(-60); Cl.FullName = g.GenerateDefault(Gender.man); Cl.IIN = "970131301448"; Cl.Login = "******"; Cl.Password = "******"; Cl.PhoneNum = "87778139374"; ListClient.Add(Cl); }