Beispiel #1
0
 public Guest(string n, string p, Stay s, Membership m, bool i)
 {
     Name        = n;
     PpNumber    = p;
     HotelStay   = s;
     Membership  = m;
     IsCheckedIn = i;
 }
        public void InitData()
        {
            /* Initialising Rooms */
            HotelRoom s101 = new StandardRoom("101", "Single", 90.0, true, 1);
            HotelRoom s102 = new StandardRoom("102", "Single", 90.0, true, 1);
            HotelRoom s201 = new StandardRoom("201", "Twin", 110.0, true, 2);
            HotelRoom s202 = new StandardRoom("202", "Twin", 110.0, true, 2);
            HotelRoom s203 = new StandardRoom("203", "Twin", 110.0, true, 2);
            HotelRoom d204 = new DeluxeRoom("204", "Twin", 140.0, true, 2);
            HotelRoom d205 = new DeluxeRoom("205", "Twin", 140.0, true, 2);
            HotelRoom s301 = new StandardRoom("301", "Triple", 120.0, true, 3);
            HotelRoom s302 = new StandardRoom("302", "Triple", 120.0, true, 3);
            HotelRoom d303 = new DeluxeRoom("303", "Triple", 210.0, true, 3);
            HotelRoom d304 = new DeluxeRoom("304", "Triple", 210.0, true, 3);

            // Add rooms to hotelRoomList
            HotelRoom[] rooms = { s101, s102, s201, s202, s203, s301, s302, d204, d205, d303, d304 };
            hotelRoomList.AddRange(rooms);


            /* Initialising existing Guests */
            // Amelia
            Stay         st1   = new Stay(new DateTime(2019, 1, 26), new DateTime(2019, 02, 02));
            StandardRoom sr101 = (StandardRoom)s101;

            sr101.RequireBreakfast = true;
            sr101.RequireWifi      = true;
            s101.IsAvail           = false;
            st1.AddRoom(s101);
            Guest g1 = new Guest("Amelia", "S1234567A", st1, new Membership("Gold", 280), true);

            // Bob
            Stay         st2   = new Stay(new DateTime(2019, 1, 25), new DateTime(2019, 1, 31));
            StandardRoom sr302 = (StandardRoom)s302;

            sr302.RequireBreakfast = true;
            s302.IsAvail           = false;
            st2.AddRoom(s302);
            Guest g2 = new Guest("Bob", "G1234567A", st2, new Membership("Ordinary", 0), true);

            // Cody
            Stay         st3   = new Stay(new DateTime(2019, 2, 1), new DateTime(2019, 2, 6));
            StandardRoom sr202 = (StandardRoom)s202;

            sr202.RequireBreakfast = true;
            s202.IsAvail           = false;
            st3.AddRoom(s202);
            Guest g3 = new Guest("Cody", "G2345678A", st3, new Membership("Silver", 190), true);

            // Edda
            Stay       st4   = new Stay(new DateTime(2019, 1, 28), new DateTime(2019, 2, 10));
            DeluxeRoom dr303 = (DeluxeRoom)d303;

            dr303.AdditionalBed = true;
            d303.IsAvail        = false;
            st4.AddRoom(d303);
            Guest g4 = new Guest("Edda", "S3456789A", st4, new Membership("Gold", 10), true);

            // Add guests to guestList
            Guest[] guests = { g1, g2, g3, g4 };
            guestList.AddRange(guests);

            // Add available hotel rooms to availRms list
            foreach (HotelRoom r in hotelRoomList)
            {
                if (r.IsAvail)
                {
                    availRms.Add(r);
                }
            }

            /* UI Elements */
            // Front page
            frontPage.UIElements = new List <UIElement> {
                guestBlk, guestTxt, ppBlk, ppTxt, adultnoBlk, adultnoTxt, childrennoBlk, childrennoTxt, proceedBtn, searchBtn
            };

            // Check rooms available page (proceed button is clicked)
            chkRmAvailPage.UIElements = new List <UIElement> {
                checkInDateTxt, checkOutDateTxt, chkinBlk, chkoutBlk, chkrmBtn, backBtn1
            };

            // Current rooms page (search button is clicked)
            currentRmPage.UIElements = new List <UIElement> {
                guestBlk, guestTxt, ppBlk, ppTxt, currentrmBlk, currentrmLv, extendBtn, invoiceBlk, invoiceDetailBlk, invoiceDetailScroll, statuspointsBlk, pointsTxt, redeemBtn, proceedToPay, backBtn3, currentrmheaderBlk
            };

            // Available rooms and check in function (chkrm button is clicked)
            chkInPage.UIElements = new List <UIElement> {
                availrmBlk, availrmLv, selectrmBlk, selectrmLv, wifiCb, breakfastCb, bedCb, addrmBtn, removermBtn, chkinBtn, backBtn2, availrmheaderBlk, selectrmheaderBlk
            };

            // Available rooms and check in function (hidden elements until event happens)
            hiddenchkInPage.UIElements = new List <UIElement> {
                wifiCb, breakfastCb, bedCb, addrmBtn, removermBtn, chkinBtn
            };

            // Status messages (for error or informational messages)
            statusMsg.UIElements = new List <UIElement> {
                statusBlk, hideBtn
            };

            // Mode of payment page (check out button is clicked)
            paymentModePage.UIElements = new List <UIElement> {
                paymentModeBlk, payByCashBtn, payByCreditCardBtn, backBtn4
            };

            // Payment by credit card page (credit card button is clicked)
            payByCreditCardPage.UIElements = new List <UIElement> {
                ccnumberBlk, ccnumberTxt, ccExpiryDateBlk, ccExpiryDateTxt, cccvvBlk, cccvvTxt, creditcardBlk, creditcardLv, creditcardchkoutBtn, addcreditcardBtn, removecreditcardBtn, backBtn5
            };

            // Payment by credit card page (hidden elements until event happens)
            hiddenpayByCreditCardPage.UIElements = new List <UIElement> {
                addcreditcardBtn, removecreditcardBtn, creditcardchkoutBtn
            };
        }