예제 #1
0
        /// <summary>
        /// James Heim
        /// Created 2019-04-29
        ///
        /// Populate the DataGrid with the TabLines.
        /// </summary>
        private void loadTabLines()
        {
            try
            {
                _vmTabLines = new List <VMTabLine>();

                // Build the TabLine View Models.
                foreach (var tab in _memberTab.MemberTabLines)
                {
                    var vmTab = new VMTabLine()
                    {
                        Date           = tab.DatePurchased,
                        FormattedPrice = tab.Price.ToString("C"),
                        Quantity       = tab.Quantity,

                        OfferingID = tab.OfferingID
                    };

                    // Get the specific Offering so we can save the Description and TypeID.
                    var offering = _offeringManager.RetrieveOfferingByID(tab.OfferingID);
                    vmTab.OfferingDescription = offering.Description;
                    vmTab.OfferingType        = offering.OfferingTypeID;

                    if (tab.GuestID != null)
                    {
                        vmTab.GuestID = tab.GuestID;
                        var guest = _guestManager.ReadGuestByGuestID((int)tab.GuestID);
                        vmTab.GuestName = guest.FirstName + " " + guest.LastName;
                    }
                    else
                    {
                        vmTab.GuestName = _member.FirstName + " " + _member.LastName;
                    }

                    if (tab.EmployeeID != null)
                    {
                        vmTab.EmployeeID = tab.EmployeeID;
                        var employee = _employeeManager.RetrieveEmployeeInfo((int)tab.EmployeeID);
                        vmTab.EmployeeName = employee.FirstName + " " + employee.LastName;
                    }
                    else
                    {
                        vmTab.EmployeeName = "";
                    }

                    _vmTabLines.Add(vmTab);
                }

                dgTabLines.ItemsSource = _vmTabLines;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database Error", ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// James Heim
        /// Created 2019-04-26
        ///
        /// If the ViewModel does not have an OfferingType with a valid detail
        /// (not Event, Item, or Room) disable the View Offering button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DgTabLines_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _selectedItem = (VMTabLine)dgTabLines.SelectedItem;

            if (_selectedItem != null)
            {
                // Offering Button.
                if (_selectedItem.OfferingType == "Event" ||
                    _selectedItem.OfferingType == "Item" ||
                    _selectedItem.OfferingType == "Room")
                {
                    btnViewOffering.IsEnabled = true;
                }
                else
                {
                    btnViewOffering.IsEnabled = false;
                }

                // Guest Button.
                if (_selectedItem.GuestID != null)
                {
                    btnViewGuest.IsEnabled = true;
                }
                else
                {
                    btnViewGuest.IsEnabled = false;
                }

                // Employee Button.
                if (_selectedItem.EmployeeID != null)
                {
                    btnViewEmployee.IsEnabled = true;
                }
                else
                {
                    btnViewEmployee.IsEnabled = false;
                }
            }
        }