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 LoadSchedule(List<Input> lstinp) { Movie m = null; Cineplex c = null; foreach (Input i in lstinp) { if (lstcineplex.Count == 0) { c = new Cineplex(i.Loc); lstcineplex.Add(c); } else { int k = 0; foreach (Cineplex Cpl in lstcineplex) { if (Cpl.GetCineplex().Equals(i.Loc)) { c = Cpl; k = 1; break; } } if (k == 0) { c = new Cineplex(i.Loc); lstcineplex.Add(c); } } int j = 0, found = 0; foreach (Movie mov in lstMovie) { if (mov.GetMovieName().Equals(i.movie)) { found = 1; // m = mov; c.AddSchedule(i.Day, new Schedule(i.Day, i.time, mov, i.price, i.Seats)); break; } } if (found == 0) { m = new Movie(i.movie); c.AddSchedule(i.Day, new Schedule(i.Day, i.time, m, i.price, i.Seats)); lstMovie.Add(m); } } }
public void PrintSchedule(Cineplex Cpl, List<Schedule> lstSch) { int i = 0; foreach (Schedule s in lstSch) { i++; Console.WriteLine(i + "." + Cpl.GetCineplex() + " " + s.GetSchedule()); } }
public Booking(Cineplex Cpl, Schedule Sch) { this.Sch = Sch; this.Cpl = Cpl; }