Beispiel #1
0
        // This constructor initializes the window for a new booking assigned to the current customer, giving an unused booking reference number, and displaying information on the forms.
        public Booking(SingletonStorage data, int custRefNo)
        {
            InitializeComponent();

            _custID = custRefNo;

            foreach (KeyValuePair <int, Business.Customer> entry in data.CustDict.StoreCustomers)
            {
                foreach (KeyValuePair <int, Business.Booking> bookingEntry in entry.Value.DictBookings)
                {
                    _tempBookingDict.Add(bookingEntry.Key, bookingEntry.Value);
                }
            }

            if (_tempBookingDict.Count == 0)
            {
                _bookingID = 1;
            }
            else
            {
                _bookingID = GetFirstUnusedKey(_tempBookingDict);
            }

            tbxBookingRefNo.Text = _bookingID.ToString();
        }
Beispiel #2
0
        // This constructor initializes the window for editing an existing booking assigned to the current customer, and displaying information on the forms.
        public Booking(SingletonStorage data, int custRefNo, int bookingRefNo)
        {
            InitializeComponent();

            _custID                   = custRefNo;
            _bookingID                = bookingRefNo;
            tbxBookingRefNo.Text      = bookingRefNo.ToString();
            clrArrival.SelectedDate   = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ArrivalDate;
            clrDeparture.SelectedDate = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].DepartureDate;
            tbxChaletID.Text          = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ChaletID.ToString();
            _tempGuestDict.Clear();
            _tempGuestDict = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].GuestDict;
            populateGuestListBox(data, custRefNo, bookingRefNo);

            if (data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict.ContainsKey("Breakfast"))
            {
                ckbBreakfast.IsChecked = true;
            }

            if (data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict.ContainsKey("Evening Meal"))
            {
                ckbDinner.IsChecked = true;
            }

            if (data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict.ContainsKey("Car Hire"))
            {
                ckbCarHire.IsChecked      = true;
                clrStartHire.SelectedDate = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict["Car Hire"].StartHire;
                clrEndHire.SelectedDate   = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict["Car Hire"].EndHire;
                tbxDriver.Text            = data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].ExtraDict["Car Hire"].DriverName;
            }
        }
Beispiel #3
0
        // This method populates a guest list box with Guest passportNo values.
        public void populateGuestListBox(SingletonStorage data, int custRefNo, int bookingRefNo)
        {
            lbxGuests.Items.Clear();

            if (data.CustDict.StoreCustomers[custRefNo].DictBookings.ContainsKey(bookingRefNo) && data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].GuestDict.Count != 0)
            {
                foreach (string passportNo in data.CustDict.StoreCustomers[custRefNo].DictBookings[bookingRefNo].GuestDict.Keys)
                {
                    if (passportNo != null)
                    {
                        lbxGuests.Items.Add(passportNo);
                    }
                }
            }
            else if (_tempGuestDict.Count != 0)
            {
                foreach (string passportNo in _tempGuestDict.Keys)
                {
                    if (passportNo != null)
                    {
                        lbxGuests.Items.Add(passportNo);
                    }
                }
            }
        }
Beispiel #4
0
 // This constructor initializes the window for dysplaing/editing an existing customer's details and booking assigned to it.
 public Customer(SingletonStorage data, int custRefNo)
 {
     InitializeComponent();
     _custID             = custRefNo;
     txbCustName.Text    = data.CustDict.StoreCustomers[custRefNo].Name;
     txbCustAddress.Text = data.CustDict.StoreCustomers[custRefNo].Address;
     txbCustRefNo.Text   = custRefNo.ToString();
     populateListBox(data, custRefNo);
 }
Beispiel #5
0
        // This method populates a booking list box with Booking bookingRefNo values.
        public void populateListBox(SingletonStorage data, int custRefNo)
        {
            lbxBookingList.Items.Clear();

            foreach (int bookingRefNo in data.CustDict.StoreCustomers[custRefNo].DictBookings.Keys)
            {
                if (bookingRefNo != 0)
                {
                    lbxBookingList.Items.Add(bookingRefNo);
                }
            }
        }
Beispiel #6
0
        public object GetSingleton(Type type)
        {
            lock (SyncSingleton)
            {
                var singleton = SingletonStorage.Get(type);

                if (singleton == null)
                {
                    singleton = GetTypeInstance(type);
                    SingletonStorage.Add(singleton);
                }
                return(singleton);
            }
        }
Beispiel #7
0
        // This constructor initializes the window for a new customer, giving an unused customer reference number, and displaying information on the forms.
        public Customer(SingletonStorage data)
        {
            InitializeComponent();

            if (data.CustDict.StoreCustomers.Count == 0)
            {
                _custID = 1;
            }
            else
            {
                _custID = GetFirstUnusedKey(data.CustDict.StoreCustomers);
            }

            txbCustRefNo.Text = _custID.ToString();
        }