public override void Exec() { Console.Clear(); EventAgency agency = EventAgency.Instance(); agency.SetClient(); if (agency.events.cost != 0) { agency.events.Print(); string answer; do { Console.Write("Pay for the {0} events {1}$ (y/n): ", agency.events.Count(), agency.events.cost); answer = Console.ReadLine(); } while (answer != "y" && answer != "n"); if (answer == "y") { if (agency.client.PayForEvents()) { agency.events.cost = 0; Console.WriteLine("Success!!"); } else { Console.WriteLine("Not enough money! Delete some events"); } } } else { Console.WriteLine("You already paid this events"); } MenuCommand.ReadKey(); }
public override void Exec() { Console.Clear(); EventAgency agency = EventAgency.Instance(); if (agency.events.Count() != 0) { agency.events.Print(); int id; string input; do { Console.Write("Deleted id (b for go back): "); if ((input = Console.ReadLine()) == "b") { break; } } while (!int.TryParse(input, out id) || !agency.events.DeleteById(id)); } else { Console.WriteLine("There're no available events."); MenuCommand.ReadKey(); } }
public override void Exec() { Console.Clear(); EventAgency agency = EventAgency.Instance(); if (agency.events.Count() != 0) { agency.events.Print(); int id; string input; do { Console.Write("Updated id (b for go back): "); if ((input = Console.ReadLine()) == "b") { return; } } while (!int.TryParse(input, out id) || !agency.events.IsEventById(id)); UpdateEventChain chain = new UpdateEventChain(agency.events.GetEventById(id)); Event e = chain.ClientCode(); agency.events.SetEventById(id, e); } else { Console.WriteLine("There're no available events"); MenuCommand.ReadKey(); } }
public static EventAgency Instance() { if (_instance == null) { _instance = new EventAgency(); } return(_instance); }
public bool PayForEvents() { EventAgency agency = EventAgency.Instance(); if (balance >= agency.events.cost) { return(TakeMoney(agency.events.cost)); } return(false); }
public bool PayForEvents() { EventAgency agency = EventAgency.Instance(); if (cash >= agency.events.cost) { cash -= agency.events.cost; return(true); } return(false); }
public override void Exec() { Console.Clear(); EventAgency agency = EventAgency.Instance(); agency.events.Print(); if (agency.events.Count() == 0) { Console.WriteLine("There're no available events"); } MenuCommand.ReadKey(); }
public override void Exec() { Console.Clear(); Console.Write("Enter name of event: "); string name = Console.ReadLine(); int gNum = ReadUInt("Enter number of guests: "); DateTime date = CreateDate(); EventConstructor ec = new EventConstructor(); Event ev = ec.GenerateEvent(chooseEvent(name, gNum, date)); EventAgency agency = EventAgency.Instance(); agency.events.Add(ev); }