public void Booking(Cineplex Cpl, string Day, Schedule Sch) { try { if (Sch.GetAvailSeats() == 0) { Console.WriteLine("Booking is full"); } else { int qty = SelectBooking(Sch); Booking b; int Seats = 0; if (Sch.CheckViewer(qty) && qty != -1) { b = new Booking(Cpl, Sch); b.Seats = qty; Cpl.Book(b); Seats = b.Seats; Sch.SetAvailSeats(Seats); Console.WriteLine(Seats + " Seats have been added"); da.SetSeats(Cpl.GetCineplex(), Day, Sch.GetTime(), Sch.GetMovie().GetMovieName(), Sch.GetAvailSeats()); } else if (!Sch.CheckViewer(qty)) if (qty > Sch.GetAvailSeats()) { Console.WriteLine("Seats are greater than available Seats"); } Console.WriteLine("availSeats" + Sch.GetAvailSeats()); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void AddSchedule(String Day, Schedule Schd) { try { if (Sch.Contains(Schd)) Console.WriteLine(Schd.GetSchedule() + "object exists"); this.Sch.Add(Schd); if (movSchedule == null) this.movSchedule.Add(Day, Sch); else if (movSchedule != null) movSchedule[Day] = Sch; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void PrintSchedule1(Schedule Sch) { // Sch.ToString(); Console.WriteLine(Sch.GetSchedule()); }
public int SelectBooking(Schedule Sch) { Console.WriteLine("how many tickets do you want to book (" + Sch.GetAvailSeats() + ") are available"); int Seats; string inp = Console.ReadLine(); while (!Int32.TryParse(inp.Trim(), out Seats)) { Console.WriteLine("select an integer from the list only"); inp = Console.ReadLine(); } Console.WriteLine("do you want to confirm " + Seats + "yes/no"); inp = Console.ReadLine(); while (!inp.ToLower().Equals("yes") && !inp.ToLower().Equals("no")) { Console.WriteLine("select yes or no only"); inp = Console.ReadLine().Trim(); } if (inp.Equals("yes")) { Console.WriteLine(Sch.GetSchedule()); } else { Console.WriteLine("selection dropped"); Seats = -1; } return Seats; }
public Booking(Cineplex Cpl, Schedule Sch) { this.Sch = Sch; this.Cpl = Cpl; }