Beispiel #1
0
        private bool CheckQuantity()
        {
            bool isAtLeastOneSeat = (VipQuantity.GetQuantity() > 0);

            isAtLeastOneSeat |= (NormalQuantity.GetQuantity() > 0);
            isAtLeastOneSeat |= (EcoQuantity.GetQuantity() > 0);

            return(isAtLeastOneSeat);
        }
Beispiel #2
0
        public void MakeSum()
        {
            Int32 VipPrice    = 50 * VipQuantity.GetQuantity();
            Int32 NormalPrice = 30 * NormalQuantity.GetQuantity();
            Int32 EcoPrice    = 15 * EcoQuantity.GetQuantity();

            Int32 TotalPrice = VipPrice + NormalPrice + EcoPrice;

            Total_Textblock.Text = TotalPrice.ToString();
        }
Beispiel #3
0
        private void BuyButton_Click(object sender, RoutedEventArgs e)
        {
            if (!UserSingleton.GetInstance.IsAuthenticated)
            {
                SelectUser.RegisterUser();
            }

            if (UserSingleton.GetInstance.IsAuthenticated && CheckQuantity())
            {
                List <Seat> seatsVIP    = SeatsFactory.CreateSeats("VIP", VipQuantity.GetQuantity());
                List <Seat> seatsNormal = SeatsFactory.CreateSeats("Normal", NormalQuantity.GetQuantity());
                List <Seat> seatsECO    = SeatsFactory.CreateSeats("Eco", EcoQuantity.GetQuantity());

                List <Seat> seats = seatsVIP;
                seats.AddRange(seatsNormal);
                seats.AddRange(seatsECO);

                Reservation reservation = ReservationFactory.Create(_performance, seats);
                reservation.Save();

                ValidationOrder validationOrder = new ValidationOrder();
                this.Content = validationOrder;
            }
        }