public async Task <IActionResult> PutAirCompany([FromRoute] int id, [FromBody] AirCompany airCompany) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != airCompany.Id) { return(BadRequest()); } _context.Entry(airCompany).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AirCompanyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static decimal GetDiscSumm(AirCompany aircomp, decimal monthSumm) { if (aircomp.DiscountType == null) { return(0); } decimal res = 0; foreach (var r in aircomp.DiscountType.Ranges.OrderBy(a => a.Start)) { if (r.Start > monthSumm) { break; } if (r.End == null) { res += (monthSumm - r.Start) * r.DiscountPercent / 100; } else { res += (Math.Min((decimal)r.End, monthSumm) - r.Start) * r.DiscountPercent / 100; } } return(res); }
public static long CreateAirCompany(AirCompany cmp) { var Client = GetClient(); if (Client == null) { return(-1); } var cmpInfo = new AirCompany(); OperationResult res = Client.CreateAirCompany(cmpInfo); if (!res.Success) { DBError(res.ErrorMessage); return(-1); } var res2 = Client.GetAirCompany(res.CreatedObjectId); if (!res2.Success) { DBError(res.ErrorMessage); return(-1); } cmp.Id = res.CreatedObjectId; return(res.CreatedObjectId); }
public static void CloseChecksByAirCompAsk(AirCompany air, List <OrderFlight> orders) { if (air == null) { return; } if (air.PaymentType == null) { UI.UIModify.ShowAlert($"Для закрытия чеков авиакомпания {air.Name} должна содержать вид оплаты"); return; } string promtStr = $"Закрыть все чеки по компании {Environment.NewLine} {air.Name} {Environment.NewLine} " + $"с видом оплаты {air.PaymentType.Name} {Environment.NewLine} " + $"на общую сумму {orders.Sum(a => a.OrderTotalSumm).ToString("C")}?"; UI.UIModify.ShowConfirm(promtStr, (_) => { if (_) { foreach (var o in orders.Where(a => a.OrderStatus == OrderStatus.Sent)) { CloseCheck(o); } } }); }
public async Task <ActionResult <AirCompany> > AddAviokompanija(AirCompany aviokompanija) { _context.AvioKompanije.Add(aviokompanija); await _context.SaveChangesAsync(); var result = _context.Entry(aviokompanija).Entity; return(Ok(result)); // return CreatedAtAction("GetAviokompanija", new { id = aviokompanija.Id }, aviokompanija); }
public async Task <IActionResult> PostAirCompany([FromBody] AirCompany airCompany) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AirCompanies.Add(airCompany); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAirCompany", new { id = airCompany.Id }, airCompany)); }
public bool DaLiMozeDaSeOdobri(int idAirCompany) { bool temp = true; AirCompany servis = _context.AvioKompanije.Find(idAirCompany); if (servis.cenaPrviDan == 0 || servis.cenaSledeciDan == 0) { temp = false; } return(temp); }
public async Task <ActionResult <BrzaRezervacijaDestinacija> > AddBrzaRezervacijaDestinacije(BrzaRezervacijaDestinacija rezervacija) { AirCompany rentservis = _context.AvioKompanije.Find(rezervacija.IdAirCompany); //rezervacija.PocetnaCena = servis.ukupnaCena(rezervacija); //rezervacija.NovaCena = rezervacija.PocetnaCena - rezervacija.PocetnaCena * rezervacija.Popust / 100; _context.BrzeRezervacijeDestinacije.Add(rezervacija); // servis.dodajDatumeDestinaciji(rezervacija); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBrzaRezervacijaVozila", new { id = rezervacija.Id }, rezervacija)); }
public static void Main(string[] args) { //Creating collection of planes List <IPlane> planes = new List <IPlane>() { new Airbus("Airbus01", 900, 6000, 130000, 12000), new Boeing("Boeing01", 1000, 5000, 120000, 400), new ANSportsPlane("AN01", 300, 300, 600, 2) }; //Get info about every plane in list foreach (IPlane p in planes) { Console.WriteLine(p.GetInfo()); } //Creating new company AirCompany airCompany = new AirCompany("Airlines", planes); //Show all planes sorted by fly distance Console.WriteLine("--------------------"); Console.WriteLine("Sorted planes"); List <IPlane> sortedPlanes = airCompany.SortPlanesByFlyDistance().ToList(); foreach (IPlane p in sortedPlanes) { Console.WriteLine("Plane: {0}, distance:{1}", p.Name, p.GetFlyDistance()); } Console.WriteLine("--------------------"); //Show total capacity of the company and total carrying weight Console.WriteLine("Info about company"); Console.WriteLine("{0} total capacity: {1}, total carrying weight: {2}", airCompany.Name, airCompany.GetTotalCapacity(), airCompany.GetTotalCarryingWeight()); Console.WriteLine("--------------------"); //Find all planes with fuel consumption between 0 and 1000 l/h Console.WriteLine("Founded planes by fuel consumption between 0 and 1000"); List <IPlane> planes2 = airCompany.FindPlaneByFuelConsumption(0, 1000).ToList(); foreach (IPlane p in planes2) { Console.WriteLine(p.GetInfo()); } Console.ReadLine(); }
public static bool UpdateAirCompany(AirCompany cmp) { var Client = GetClient(); if (Client == null) { return(false); } OperationResult res = Client.UpdateAirCompany(cmp); if (!res.Success) { DBError(res.ErrorMessage); return(false); } return(true); }
public async Task <IActionResult> UpdateAviokompanija(AirCompany aviokompanija) { _context.Entry(aviokompanija).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AirCompanyExists(aviokompanija.Id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private static bool AddAirCompany(AirCompany airc, out string ErrMesssage) { try { logger.Debug($"AddAirCompany Order {airc.Name}"); ErrMesssage = ""; var shExpCats = sh.ExpCtgs(out int errCode, out string errMess); if (!shExpCats.ListExpCtgs.Select(a => a.Name).Contains(airc.Name.Trim())) { bool res = sh.AddExpCtgs(airc.Name.Trim(), out errCode, out errMess); if (!res) { ErrMesssage = "Не могу добавить авиакомпанию" + Environment.NewLine + errMess + Environment.NewLine; return(false); } shExpCats = sh.ExpCtgs(out errCode, out errMess); } if (shExpCats.ListExpCtgs.Any(a => a.Name == airc.Name.Trim())) { airc.SHId = shExpCats.ListExpCtgs.FirstOrDefault(a => a.Name == airc.Name.Trim()).Rid; DBProvider.Client.UpdateAirCompany(airc); logger.Debug($"AddAirCompany ok {airc.Name}"); return(true); } else { ErrMesssage = "Не могу добавить авиакомпанию" + Environment.NewLine; return(false); } } catch (Exception e) { logger.Error($"AddAirCompany error {airc.Name} " + e.Message); ErrMesssage = "Ошибка при добавлении авиакомпании" + Environment.NewLine + e.Message + Environment.NewLine; return(false); } }
static void Main(string[] args) { Club RomansClub = new Club("Roman's Club"); string[] TourTypes = new string[] { "Країни, якi цiкавi для туризму", "Тематичнi тури", "Тури по видатних мiсцях" }; InterestingCountry Ukraine = new InterestingCountry() { TourType = TourTypes[0], Name = "Україна", PricePerDay = 354, Path = "Ukraine" }; InterestingCountry Poland = new InterestingCountry() { TourType = TourTypes[0], Name = "Польща", PricePerDay = 451, Path = "Poland" }; InterestingCountry France = new InterestingCountry() { TourType = TourTypes[0], Name = "Францiя", PricePerDay = 543, Path = "France" }; InterestingCountry Germany = new InterestingCountry() { TourType = TourTypes[0], Name = "Нiмеччина", PricePerDay = 578, Path = "Germany" }; InterestingCountry Italy = new InterestingCountry() { TourType = TourTypes[0], Name = "Iталiя", PricePerDay = 605, Path = "Italy" }; RomansClub.InterestingCountryTours.AddRange(new InterestingCountry[] { Ukraine, Poland, France, Germany, Italy }); TematicTours WineTour = new TematicTours { TourType = TourTypes[1], Name = "Винний тур", PricePerDay = 345, Path = "Italy" }; TematicTours HistoryTour = new TematicTours { TourType = TourTypes[1], Name = "Iсторичний тур", PricePerDay = 243, Path = "Ukraine" }; TematicTours RocksTour = new TematicTours { TourType = TourTypes[1], Name = "Гiрнолижний тур", PricePerDay = 565, Path = "Iceland" }; TematicTours RomanticTour = new TematicTours { TourType = TourTypes[1], Name = "Романтичний тур", PricePerDay = 670, Path = "France" }; TematicTours BullfightingTour = new TematicTours { TourType = TourTypes[1], Name = "Корида тур", PricePerDay = 445, Path = "Spain" }; RomansClub.TematicToursTours.AddRange(new TematicTours[] { WineTour, HistoryTour, RocksTour, RomanticTour, BullfightingTour }); SightseeingTours Akureiri = new SightseeingTours() { TourType = TourTypes[2], Name = "Акюрейрi", PricePerDay = 459, Path = "Iceland" }; SightseeingTours Azores = new SightseeingTours() { TourType = TourTypes[2], Name = "Азорськi острови", PricePerDay = 567, Path = "Portugal" }; SightseeingTours Malaga = new SightseeingTours() { TourType = TourTypes[2], Name = "Малага", PricePerDay = 673, Path = "Spain" }; SightseeingTours Piedmont = new SightseeingTours() { TourType = TourTypes[2], Name = "П'ємонт", PricePerDay = 689, Path = "Italy" }; SightseeingTours Tromse = new SightseeingTours() { TourType = TourTypes[2], Name = "Тромсе", PricePerDay = 708, Path = "Norway" }; RomansClub.SightseeingToursTours.AddRange(new SightseeingTours[] { Akureiri, Azores, Malaga, Piedmont, Tromse }); int[] EvenDays = new int[0];//масив парних днів for (int i = 0; i <= 31; i++) { if (i % 2 == 0) { Array.Resize(ref EvenDays, EvenDays.Length + 1); EvenDays[EvenDays.Length - 1] = i; } } int[] OddDays = new int[0];//масив непарних днів for (int i = 0; i <= 31; i++) { if (i % 2 != 0) { Array.Resize(ref OddDays, OddDays.Length + 1); OddDays[OddDays.Length - 1] = i; } } AirCompany MAU = new AirCompany("MAU", new string[] { "Ukraine", "Poland", "Iceland" }, EvenDays); AirCompany MotorSich = new AirCompany("Мотор Сiч", new string[] { "Ukraine", "Italy", "Iceland" }, OddDays); AirCompany Belavia = new AirCompany("Belavia", new string[] { "Italy", "Germany ", "Portugal" }, EvenDays); AirCompany AirFrance = new AirCompany("Air France", new string[] { "France", "Portugal", "Norway" }, OddDays); AirCompany KLM = new AirCompany("KLM", new string[] { "Germany", "Poland", " Norway" }, EvenDays); AirCompany DniproAvia = new AirCompany("Днiпро Авiа", new string[] { "Ukraine", "Germany", "Norway" }, OddDays); AirCompany YanAir = new AirCompany("Yan Air", new string[] { "Italy", "Poland", "Spain", "Germany" }, OddDays); AirCompany Pegasus = new AirCompany("Pegasus Airlines", new string[] { "France", "Italy", "Spain" }, EvenDays); AirCompany[] AllAirCompanies = new AirCompany[] { MAU, MotorSich, Belavia, AirFrance, KLM, DniproAvia, YanAir, Pegasus }; Agency JoinUp = new Agency("Join Up", new AirCompany[] { MAU, MotorSich, KLM, DniproAvia, YanAir, Pegasus }, new Tour[] { Ukraine, Poland, Akureiri, Piedmont, HistoryTour, RocksTour }); Agency ComeWithUs = new Agency("Поїхали з нами", new AirCompany[] { AirFrance, YanAir, Pegasus, MotorSich, MAU, Belavia, KLM }, new Tour[] { France, Italy, Akureiri, Azores, Tromse, WineTour, RocksTour, RomanticTour }); Agency HotTour = new Agency("Гарячий Тур", new AirCompany[] { Belavia, KLM, YanAir, AirFrance, Pegasus, MotorSich }, new Tour[] { Germany, Azores, Malaga, Piedmont, Tromse, BullfightingTour }); Agency KingsTour = new Agency("Королiвський Тур", new AirCompany[] { MAU, MotorSich, KLM, DniproAvia, YanAir, Pegasus }, new Tour[] { Ukraine, Poland, Akureiri, Piedmont, HistoryTour, RocksTour }); Agency AsterraTravel = new Agency("Asterra Travel", new AirCompany[] { AirFrance, YanAir, Pegasus, MotorSich, MAU, Belavia, KLM }, new Tour[] { France, Italy, Akureiri, Azores, Tromse, WineTour, RocksTour, RomanticTour }); Agency DreamJourney = new Agency("Подорож мрiї", new AirCompany[] { Belavia, KLM, YanAir, AirFrance, Pegasus, MotorSich }, new Tour[] { Germany, Azores, Malaga, Piedmont, Tromse, BullfightingTour }); RomansClub.PartnerAgencies.AddRange(new Agency[] { JoinUp, ComeWithUs, HotTour, KingsTour, AsterraTravel, DreamJourney }); Account[] RealAccounts = new Account[] { new Account(100, "Roman") }; RomansClub.RealAccounts.AddRange(RealAccounts); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\t\t\t\tДоброго дня, Вас вiтає клуб туризму 'Roman's Club'"); Console.WriteLine("Введiть будь ласка iм'я свого акаунтy"); string NameOfAccount = Console.ReadLine(); Account ClientNewAccount = new Account(); for (int i = 0; i < RomansClub.RealAccounts.Count; i++) { if (NameOfAccount == RomansClub.RealAccounts[i].Name) { ClientNewAccount = RomansClub.RealAccounts[i]; } } if (ClientNewAccount.Name != null) { ClientNewAccount.Notify += Account.DisplayMessage; Console.WriteLine($"Ваш аккаунт :{ClientNewAccount.Name}\nБаланс акаунтy:{ClientNewAccount.Bill} грн"); Console.ReadKey(); } else { Console.WriteLine($"Ваш акаунт не знайдено\nДля створення акаунтy введiть Ваше прiзвище:"); ClientNewAccount = new Account(0, Console.ReadLine()); RomansClub.RealAccounts.Add(ClientNewAccount); ClientNewAccount.Notify += Account.DisplayMessage; Console.WriteLine("Якщо хочете поповнити рахунок натиснiть будь-яку цифру\nНатиснiть будь-яку клавiшу для продовження"); switch (int.TryParse(Console.ReadLine(), out int result)) { case true: { string choicepay = "1"; while (choicepay == "1") { try { Console.WriteLine("Введiть суму для поповнення: "); int Sum = int.Parse(Console.ReadLine()); if (Sum < 0) { throw new NegativeAmountException("The amount to replenish the account cannot be negative"); } ClientNewAccount.Put(Sum); Console.ReadKey(); choicepay = "0"; } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; Console.WriteLine("Натиснiть 1 , щоб повтории спробу\nНатиснiть будь-яку клавiшу для продовження"); choicepay = Console.ReadLine(); } } break; } default: break; } } bool key = true; while (key) { Console.Clear(); Console.WriteLine("\t\t\t\tДоброго дня, Вас вiтає клуб туризму 'Roman's Club'"); Console.WriteLine("Виберiть, що саме Вас цiкавить в нашому клубi:"); Console.WriteLine(String.Format("1.{0}\n" + "2.{1}\n" + "3.{2}\n8-Показати мої тури\n9-Ваш рахунок\n0-Вихiд", TourTypes[0], TourTypes[1], TourTypes[2])); int TourVariant = 4; while (TourVariant != 1 && TourVariant != 2 && TourVariant != 3 && TourVariant != 0 && TourVariant != 9 && TourVariant != 8) { try { Console.WriteLine("Введiть сюди цифру :"); TourVariant = int.Parse(Console.ReadLine()); if (TourVariant != 1 && TourVariant != 2 && TourVariant != 3 && TourVariant != 0 && TourVariant != 9 && TourVariant != 8) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Оберiть цифру з запропонованих варiантiв !"); Console.ForegroundColor = color; } } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; } } PersonalTour LikeTour = new PersonalTour(); if (TourVariant == 1 || TourVariant == 2 || TourVariant == 3) { LikeTour.TourType = TourTypes[TourVariant - 1]; Console.WriteLine("Введiть будь ласка, як Ви хочете назвати свiй тур:"); LikeTour.Name = Console.ReadLine();//Creating a new tour with the name specified by the user } switch (TourVariant) { case 1: { Console.Clear(); for (int j = 0; j < RomansClub.InterestingCountryTours.Count; j++) { Console.WriteLine(String.Format("{0}. Країна : {1}, Цiна за 1 день : {2} гривень", j + 1, RomansClub.InterestingCountryTours[j].Name, RomansClub.InterestingCountryTours[j].PricePerDay)); } Console.WriteLine(); int choice = 0; while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { try { Console.WriteLine("Виберiть, який тур Ви хочете обрати:"); choice = int.Parse(Console.ReadLine()); if (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Оберiть цифру з запропонованих варiантiв !"); Console.ForegroundColor = color; } } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; } } RomansClub.InterestingCountryTours[choice - 1].UpPriceInterestingCountry += InterestingCountry.DisplayMessage; ChoiseMethod(RomansClub.InterestingCountryTours.ToArray(), LikeTour, ClientNewAccount, RomansClub.PartnerAgencies, choice, RomansClub); break; } case 2: { Console.Clear(); for (int j = 0; j < RomansClub.TematicToursTours.Count; j++) { Console.WriteLine(String.Format("{0}. Тур : {1}, Цiна за 1 день : {2} гривень", j + 1, RomansClub.TematicToursTours[j].Name, RomansClub.TematicToursTours[j].PricePerDay)); } Console.WriteLine(); int choice = 0; while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { try { Console.WriteLine("Виберiть, який тур Ви хочете обрати:"); choice = int.Parse(Console.ReadLine()); if (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Оберiть цифру з запропонованих варiантiв !"); Console.ForegroundColor = color; } } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; } } RomansClub.TematicToursTours[choice - 1].UpPriceTematicTours += TematicTours.DisplayMessage; ChoiseMethod(RomansClub.TematicToursTours.ToArray(), LikeTour, ClientNewAccount, RomansClub.PartnerAgencies, choice, RomansClub); break; } case 3: { Console.Clear(); for (int j = 0; j < RomansClub.SightseeingToursTours.Count; j++) { Console.WriteLine(String.Format("{0}. Тур : {1}, Цiна за 1 день : {2} гривень", j + 1, RomansClub.SightseeingToursTours[j].Name, RomansClub.SightseeingToursTours[j].PricePerDay)); } Console.WriteLine(); int choice = 0; while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { try { Console.WriteLine("Виберiть, який тур Ви хочете обрати:"); choice = int.Parse(Console.ReadLine()); if (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Оберiть цифру з запропонованих варiантiв !"); Console.ForegroundColor = color; } } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; } } RomansClub.SightseeingToursTours[choice - 1].UpPriceSightseeingTours += SightseeingTours.DisplayMessage; ChoiseMethod(RomansClub.SightseeingToursTours.ToArray(), LikeTour, ClientNewAccount, RomansClub.PartnerAgencies, choice, RomansClub); break; } case 0: { key = false; break; } case 9: { Console.Clear(); Console.WriteLine(ClientNewAccount.ShowBill() + "\nНатиснiть 1 для поповнення рахунку\nНатиснiть будь-яку клавiшу для повернення в головне меню"); switch (Console.ReadLine()) { case "1": { string choicepay = "1"; while (choicepay == "1") { try { Console.WriteLine("Введiть суму для поповнення: "); int Sum = int.Parse(Console.ReadLine()); if (Sum < 0) { throw new NegativeAmountException("The amount to replenish the account cannot be negative"); } ClientNewAccount.Put(Sum); Console.ReadKey(); choicepay = "0"; } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; Console.WriteLine("Натиснiть 1 , щоб повтории спробу\nНатиснiть будь-яку клавiшу для продовження"); choicepay = Console.ReadLine(); } } break; } default: { break; } } break; } case 8: { Console.Clear(); Console.WriteLine("Вашi тури :"); if (ClientNewAccount.AllClientsTour.Count == 0) { Console.WriteLine("Список турiв порожнiй("); Console.ReadKey(); } else { for (int i = 0; i < ClientNewAccount.AllClientsTour.Count; i++) { Console.WriteLine($"{i + 1}.Тур: '{ClientNewAccount.AllClientsTour[i].Name}' ; Дата: {ClientNewAccount.AllClientsTour[i].DateOfTour.Day}.{ClientNewAccount.AllClientsTour[i].DateOfTour.Month}.{ClientNewAccount.AllClientsTour[i].DateOfTour.Year}; Cтатус оплати туру:{ClientNewAccount.AllClientsTour[i].Status}"); } Console.WriteLine("Натиснiть 1 для оплати туру\nНатиснiть будь-яку клавiшу для продовження"); string choice = Console.ReadLine(); switch (choice) { case "1": { Console.WriteLine("Введiть номер туру , який бажаєте оплатити :"); int NumPayTour = int.Parse(Console.ReadLine()); if (ClientNewAccount.AllClientsTour[NumPayTour - 1].Status == PayStatus.Paid) { Console.WriteLine("Цей тур вже оплачений !"); Console.ReadKey(); break; } try { ClientNewAccount.PayFor(ClientNewAccount.AllClientsTour[NumPayTour - 1].Price); Console.ReadKey(); ClientNewAccount.AllClientsTour[NumPayTour - 1].Status = PayStatus.Paid; } catch (LowMoneyException) { Console.WriteLine("\nНатиснiть 1 для поповнення рахунку\nНатиснiть будь-яку клавiшу для повернення в головне меню"); switch (Console.ReadLine()) { case "1": { string choicepay = "1"; while (choicepay == "1") { try { Console.WriteLine("Введiть суму для поповнення: "); int Sum = int.Parse(Console.ReadLine()); if (Sum < 0) { throw new NegativeAmountException("The amount to replenish the account cannot be negative"); } ClientNewAccount.Put(Sum); Console.ReadKey(); choicepay = "0"; } catch (FormatException) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Ви ввели невiрно!"); Console.ForegroundColor = color; Console.WriteLine("Натиснiть 1 , щоб повтории спробу\nНатиснiть будь-яку клавiшу для продовження"); choicepay = Console.ReadLine(); } } break; } default: { break; } } } break; } default: { break; } } } break; } } } }