internal int PowerController() { ErrorMsg += new PrintErrorMsg(myEvent.PowerErrorMsg); int input = 0; do { Console.Write("Power(hp): "); try { input = int.Parse(Console.ReadLine()); } catch (Exception) { OnError(); }; if (input >= 50 && input < 1500) { ErrorMsg -= new PrintErrorMsg(myEvent.PowerErrorMsg); return(input); } else { OnError(); } } while (true); }
internal int ModelYearController() { ErrorMsg += new PrintErrorMsg(myEvent.YearErrorMsg); int input = 0; do { Console.Write("Model year(yyyy): "); try { input = int.Parse(Console.ReadLine()); } catch (Exception) { OnError(); }; if (input >= 1885 && input < DateTime.Now.Year + 1) { ErrorMsg -= new PrintErrorMsg(myEvent.YearErrorMsg); return(input); } else { OnError(); } } while (true); }
internal int PriceController() { int input = 0; ErrorMsg += new PrintErrorMsg(myEvent.PriceErrorMsg); do { Console.Write("Price(SEK): "); try { input = int.Parse(Console.ReadLine()); } catch (Exception) { OnError(); }; if (input >= 10 && input < 10000000) { ErrorMsg -= new PrintErrorMsg(myEvent.PriceErrorMsg); return(input); } else { OnError(); } } while (true); }
private void CreateTicket(int index)//Här anropas event om den valda kund är under 18 år { if (ListManager.CustomerList[index].Age < 18) { ErrorMsg += new PrintErrorMsg(GUI.AgeError); ErrorMsg?.Invoke(); } else { VIPTicket newTicket = new VIPTicket(); newTicket.Buyer = ListManager.CustomerList[index]; newTicket.Price = InputControllers.PriceController(); GUI.ShowVIPlevels(); int choice = InputControllers.VIPChoice(); newTicket.VIPLevel = (VIPTicket.Level)choice; ListManager.TicketList.Add(newTicket); } }
internal string VariantController() { ErrorMsg += new PrintErrorMsg(myEvent.VariantErrorMsg); do { Console.Write("Variant: "); string input = Console.ReadLine(); if (input.Length >= 2) { ErrorMsg -= new PrintErrorMsg(myEvent.VariantErrorMsg); return(input); } else { OnError(); } } while (true); }