public EditLuggage(LuggageManager manager, Luggage l)
        {
            InitializeComponent();
            luggageManager = manager;
            luggage        = l;
            List <LuggageStatus> status      = luggageManager.RetrieveAllLuggageStatus();
            List <string>        statusNames = new List <string>();

            foreach (var name in status)
            {
                statusNames.Add(name.LuggageStatusID);
            }
            cboStatus.ItemsSource = statusNames;
            if (l.Status.Equals("In Lobby"))
            {
                cboStatus.SelectedIndex = 0;
            }
            else if (l.Status.Equals("In Room"))
            {
                cboStatus.SelectedIndex = 1;
            }
            else
            {
                cboStatus.SelectedIndex = 2;
            }
        }
コード例 #2
0
        public AddLuggage(LuggageManager luggageManager, GuestManager guestManager)
        {
            InitializeComponent();
            this.luggageManager = luggageManager;
            this.guestManager   = guestManager;
            List <LuggageStatus> status = null;

            try
            {
                status = luggageManager.RetrieveAllLuggageStatus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            List <string> statusNames = new List <string>();

            if (status != null)
            {
                foreach (var s in status)
                {
                    statusNames.Add(s.LuggageStatusID);
                }
            }

            cboStatus.ItemsSource   = statusNames;
            cboStatus.SelectedIndex = 0;
            List <Guest> guests = null;

            try
            {
                guests = guestManager.ReadAllGuests();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            List <int> guestIDs = new List <int>();

            if (guests != null)
            {
                foreach (var g in guests)
                {
                    guestIDs.Add(g.GuestID);
                }
            }

            cboGuest.ItemsSource   = guestIDs;
            cboGuest.SelectedIndex = 0;
        }