Пример #1
0
        public void TestBookingGuestPIN()
        {
            //Pulls a guest from the database and collects the guest information
            List <HotelGuest> guest1 = HotelGuestAccessor.HotelGuestGet(100);
            //Checks using a pin in the database, stores guest info from database into a guest object
            //Asserts that a record is found, that guest is not null by passing the guest1 guest pin
            HotelGuest guest = myBook.CheckValidPIN(guest1[guest1.Count - 1].GuestPIN);

            Assert.IsNotNull(guest);
        }
Пример #2
0
        /// <summary>
        /// Pat Banks
        /// Created 2015/04/11
        /// Handles submit functionality of a hotel guest adding an event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            lblOtherMessage.Text = "";
            string errors = "";

            //if something isn't selected - throw error
            if (gvListings.SelectedValue == null)
            {
                errors += "<li>Please select an event</li>";
            }
            //gets quantity from the quantity field
            if (!txtGuestTickets.Text.ValidateInt(1))
            {
                errors += "<li>You must enter a valid number of tickets.</li>";
                txtGuestTickets.Text = "";
            }
            else
            {
                if (Int32.Parse(txtGuestTickets.Text) > getSelectedItem().QuantityOffered)
                {
                    errors += "<li>You cannot request more tickets than available</li>";
                    txtGuestTickets.Text = "";
                }
            }
            if (!txtGuestPin.Text.ValidateAlphaNumeric())
            {
                errors += "<li>You must enter a valid pin.</li>";
                txtGuestTickets.Text = "";
            }
            if (errors.Length > 0)
            {
                showError("Please fix the following errors: <ul>" + errors + "</ul>");
                return;
            }
            try
            {
                string inPin = txtGuestPin.Text;

                //see if pin was found = if not there will be an exception
                foundGuest = myManager.CheckValidPIN(inPin);
            }
            catch (Exception)
            {
                showError("You must enter a valid pin.");
            }

            gatherFormInformation();
        }
Пример #3
0
        /// <summary>
        /// Arik Chadima
        /// Created: 2015/4/24
        ///
        /// Checks the user's pin and if it is valid, shows what bookings they've selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            lblError.Visible = false;
            BookingManager hgm = new BookingManager();

            if (txtLogin.Text.ValidateAlphaNumeric(6, 6))
            {
                try
                {
                    var foundGuest = hgm.CheckValidPIN(txtLogin.Text);

                    InvoiceManager im       = new InvoiceManager();
                    var            bookings = im.RetrieveGuestBookingDetailsList((int)foundGuest.HotelGuestID);
                    repBookings.DataSource = bookings;
                    repBookings.DataBind();
                    var totalPrice = bookings.Sum(x => x.TotalCharge);
                    GuestFullName.Text = foundGuest.GetFullName;
                    Address1.Text      = foundGuest.Address1;
                    Address2.Text      = foundGuest.Address2;
                    var cityState = foundGuest.CityState;
                    CityStateZip.Text       = cityState.City + ", " + cityState.State + "  " + cityState.Zip;
                    EmailAddress.Text       = foundGuest.EmailAddress;
                    PhoneNumber.Text        = foundGuest.PhoneNumber;
                    TotalPrice.Text         = String.Format("{0:c}", totalPrice);
                    loginDiv.Visible        = false;
                    guestDetailsDiv.Visible = true;
                }
                catch (ApplicationException)
                {
                    showError("The pin entered is not active or does not exist.");
                    lblError.Visible = true;
                    txtLogin.Text    = "";
                }
                catch (Exception)
                {
                    showError("There was an error fetching data.");
                    lblError.Visible = true;
                    txtLogin.Text    = "";
                }
            }
            else
            {
                showError("The pin you enterred was not formatted correctly.<br>It must be 6 alphanumeric characters.");
                lblError.Visible = true;
            }
        }