예제 #1
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);
        }
예제 #2
0
        private void UpdateCinemaPrice(object sender, EventArgs e)
        {
            if (listMovies.GetItemText(listMovies.SelectedItem).Length > 0) {
                int count = 0;
                List<Seat> seatList = new List<Seat>();
                for (int i = 0; i < checkBoxes.Length; i++) {
                    if (checkBoxes[i].CheckState == CheckState.Checked) {
                        seatList.Add(GetShow().Hall.Seats[i]);
                        count++;
                    }
                }

                // Always show the price of one ticket
                if (count == 0)
                    count = 1;

                Booking b = new Booking(userID, GetShow(), seatList);

                lblBorder.BackColor = Color.Empty;

                grpBoxPrice.Visible = true;
                lblPrice.Text = String.Format("${0:0.00}", b.CalculateBaseCost(false));
            }
        }