Ejemplo n.º 1
0
        private void lbShowBkShows_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {

                Movie m = movieInfo.Values.ElementAt(lbShowBkMovies.SelectedIndex);
                Show sfind = m.FindShows(lbShowBkShowDays.SelectedIndex)[lbShowBkShows.SelectedIndex];

                tbBookings.Text = "";
                List<Seat> seats;
                Seat seat = new Seat();
                String seats_str = "", info_str = "";
                String distinctUserStr = "distinctUser";
                List<Booking> bookingFile = new List<Booking>();
                bookingsByShow();
                //foreach (Show sfinds in m.FindShows(lbShowBkShowDays.SelectedIndex)) {
                //    tbShowBookings.AppendText(sfinds.ToString() + "\r\n");
                //}
                //foreach (KeyValuePair<String, List<Booking>> kvp in bkGroupByShow) {
                //    foreach (Booking bfinds in kvp.Value) {
                //        tbShowBookings.AppendText(bfinds.Show.ToString() + "\r\n");
                //    }
                //}
                tbShowBookings.Clear();
                bkGroupByShow.TryGetValue(sfind.ToString(), out bookingFile);
                if (bookingFile == null || bookingFile.Count == 0) {
                    tbShowBookings.Text = "No bookings found\r\n";
                } else {
                    //tbShowBookings.AppendText("User " + bookingInfo.Keys.ToArray<String>()[lbBookings.SelectedIndex] + "\r\n");
                    foreach (Booking b in bkGroupByShow[sfind.ToString()]) {
                        Show s = b.Show;
                        seats = b.Seats;
                        seats_str = "";
                        info_str = "";
                        for (int h = 0 ; h < seats.Count ; h++) {
                            seat = b.Seats[h];
                            seats_str += seat.Name + " ";
                        }

                        if (!b.User.Equals(distinctUserStr)) {
                            if (!distinctUserStr.Equals("distinctUser")) {
                                info_str += "\r\n";
                            }
                            info_str += "User " + b.User + "\r\n";
                            distinctUserStr = b.User;
                        }

                        info_str += "(" + b.BookingTime + ") :: " + seats_str;

                        tbShowBookings.AppendText(info_str + "\r\n");
                    }
                }
            } catch (Exception ex) {
                tbShowBookings.AppendText(ex.ToString() + "\r\n");
            }
        }
Ejemplo n.º 2
0
        public void History()
        {
            Booking b = new Booking(); Show s = new Show();
            List<Seat> seats; Seat seat = new Seat();
            List<Booking> bookingList = new List<Booking>();
            bookingInfo.TryGetValue(user, out bookingList);

            String info_str = "";

            if (bookingList == null) {
            // No History

                info_str = "You have no booking records. Please make a booking!";

            } else {
            // Fetch History

                // Building String..
                // e.g. [7/31/2015 10:40:33 AM]  [The Dark Knight] 1 January 2015 > 0800 - 1000 : Seats A1
                String seats_str = "";
                for (int i = 0; i < bookingList.Count; i++) {
                    b = bookingList[i];
                    s = b.Show;
                    seats = b.Seats;
                    seats_str = "";
                    for (int h = 0; h < seats.Count; h++) {
                        seat = b.Seats[h];
                        seats_str += seat.Name + " ";
                    }
                    info_str += "[" + s.Movie.Title + " : " + String.Format("${0:0.00}", b.CalculateBaseCost(false)) + "] (Generated @ " + b.BookingTime + ")\n" +
                                "[" + s.Date + "] " + s.TimeStart + " - " + s.TimeEnd + "\n" +
                                "[" + b.Show.Hall.Name + "] " + seats_str;
                    info_str += ENDOFF;
                }
            }

            SendString(info_str);
        }
Ejemplo n.º 3
0
        private void lbBookings_SelectedIndexChanged(object sender, EventArgs e)
        {
            tbBookings.Text = "";
            int count = 1;
            List<Seat> seats;
            Seat seat = new Seat();
            String seats_str = "", info_str = "";
            List<Booking> bookingFile = bookingInfo[lbBookings.SelectedItem.ToString()];
            tbBookings.AppendText("User " + bookingInfo.Keys.ToArray<String>()[lbBookings.SelectedIndex] + "\r\n");
            foreach (Booking b in bookingFile) {
                Show s = b.Show;
                seats = b.Seats;
                seats_str = "";
                info_str = "";
                for (int h = 0 ; h < seats.Count ; h++) {
                    seat = b.Seats[h];
                    seats_str += seat.Name + " ";
                }
                info_str += "[" + s.Movie.Title + "] (" + b.BookingTime + ")\r\n" +
                            "[" + s.Date + "] [" + s.TimeStart + " - " + s.TimeEnd + "] " + seats_str;

                tbBookings.AppendText("[#" + count + "] " + info_str + "\r\n\r\n");
                count++;
            }
        }