/*
         * Constructor 2: opens a window diplaying the detail of element
         * at selected index in booking guests list.
         */
        public WindowGuestDetails(ModelFacade mFacade,
                                  bool isCustomer,
                                  int guestIndex)
        {
            this.mFacade    = mFacade;
            this.isCustomer = isCustomer;
            this.guestIndex = guestIndex;
            InitializeComponent();

            txtName.Text = mFacade.CurrentBook
                           .GetGuests()
                           .ElementAt(guestIndex)
                           .Name;
            txtPassportNb.Text = mFacade.CurrentBook
                                 .GetGuests()
                                 .ElementAt(guestIndex)
                                 .GetPassportNb();
            txtAge.Text = mFacade.CurrentBook
                          .GetGuests()
                          .ElementAt(guestIndex)
                          .GetAge()
                          .ToString();

            if (isCustomer)
            {
                hideNameFields();
            }
        }
        /*
         * Constructor 1: opens a window diplaying no value in any field.
         */
        public WindowGuestDetails(ModelFacade mFacade, bool isCustomer)
        {
            this.mFacade    = mFacade;
            this.isCustomer = isCustomer;
            InitializeComponent();

            if (isCustomer)
            {
                hideNameFields();
            }
        }
        // METHODS:

        /*
         * Constructor, the index passed must be the index in the current
         * booking's decoration stack as returned by
         * ModelFacade.GetCurrentExtras()) or -1 for a new extra.
         */
        public WindowBreakfastDetails(ModelFacade mFacade,
                                      BookingDecorator instance)
        {
            this.mFacade   = mFacade;
            this.breakfast = instance;
            InitializeComponent();

            if (this.breakfast != null)
            {
                txtDietRequirements.Text
                    = ((Breakfast)instance).GetDietRequirements();
            }
            else
            {
                txtDietRequirements.Text = String.Empty;
            }
        }
コード例 #4
0
        // METHODS:

        /*
         * Constructor, the index passed must be the index in the current
         * booking's decoration stack index as returned by
         * ModelFacade.GetCurrentExtras()) or -1 for a new extra.
         */
        public WindowEveningMealDetails(ModelFacade mFacade,
                                        BookingDecorator instance)
        {
            this.mFacade     = mFacade;
            this.eveningMeal = instance;
            InitializeComponent();

            if (this.eveningMeal != null)
            {
                txtDietRequirements.Text
                    = ((EveningMeal)instance).GetDietRequirements();
            }
            else
            {
                txtDietRequirements.Text = String.Empty;
            }
        }
        // METHODS:

        /*
         * The window constructor.
         */
        public WindowCreateEdit(ModelFacade modelFacade)
        {
            this.mFacade = modelFacade;

            InitializeComponent();
            lblBookingRef.Content = "Booking number\r\n";

            if (!mFacade.IsABookingLoaded())
            {
                clearDisplay();
            }
            else
            {
                lblBookingRef.Content += mFacade.GetCurrentBookNb()
                                         .ToString();
                refreshDisplay();
            }
        }
        // METHODS:

        /*
         * Constructor.
         */
        public WindowInvoice(ModelFacade mFacade)
        {
            InitializeComponent();
            this.mFacade = mFacade;

            // get all the amounts:
            int   nbNights         = mFacade.GetCurrentNbNights();
            float costPerNight     = mFacade.GetCurrentCostPerNight();
            float breakfastCost    = mFacade.GetCurrentBreakfastCost();
            float eveningMealsCost = mFacade.GetCurrentEveningMealsCost();
            float carHireCost      = mFacade.GetCurrentCarHireCost();

            printDetails();
            printBookingBreakdown(nbNights, costPerNight);
            printExtrasBreakdown(breakfastCost, eveningMealsCost, carHireCost);
            printTotal((nbNights * costPerNight)
                       + breakfastCost
                       + eveningMealsCost
                       + carHireCost);
        }
コード例 #7
0
        // METHODS:

        /*
         * Constructor, the index passed must be the index in the current
         * booking's decoration stack index as returned by
         * ModelFacade.GetCurrentExtras()) or -1 for a new extra.
         */
        public WindowCarHireDetails(ModelFacade mFacade,
                                    BookingDecorator instance)
        {
            this.mFacade = mFacade;
            this.carHire = instance;
            InitializeComponent();

            if (this.carHire != null)
            {
                DateTime start;
                DateTime end;
                ((CarHire)instance).GetHireDates(out start, out end);
                dtpStart.SelectedDate = start;
                dtpEnd.SelectedDate   = end;

                txtDriverName.Text = ((CarHire)instance).GetDriverName();
            }
            else
            {
                txtDriverName.Text = String.Empty;
            }
        }
        // METHODS:

        /*
         * The window constructor.
         */
        public WindowCustomerDetails(ModelFacade modelFacade)
        {
            this.mFacade = modelFacade;
            InitializeComponent();
            refreshDisplay();
        }
コード例 #9
0
        // METHODS:

        /*
         * Constructor.
         */
        public MainWindow()
        {
            this.mFacade = new ModelFacade();
            InitializeComponent();
            clearDisplay();
        }
        // METHODS:

        /*
         * Constructor.
         */
        public WindowLoadBooking(ModelFacade mFacade)
        {
            this.mFacade = mFacade;
            InitializeComponent();
            refreshDisplay();
        }