Example #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);
            }
        }
Example #2
0
        private void BtnViewGuestDetails_Click(object sender, RoutedEventArgs e)
        {
            frmAddEditGuest guestDetail = new frmAddEditGuest(_guest);
            var             formResult  = guestDetail.ShowDialog();

            if (formResult == true)
            {
                // If the guest form was edited, refresh the guest.
                _guest = _guestManager.ReadGuestByGuestID(_guest.GuestID);
                populateGuestTextBoxes();
            }
        }
Example #3
0
 /// <summary>
 /// Alisa Roehr
 /// Created: 2019/03/01
 ///
 /// for activating and deactivating guests.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnActivateGuest_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgGuests.SelectedItem != null)
         {
             Guest guest = _guestManager.ReadGuestByGuestID(((Guest)dgGuests.SelectedItem).GuestID);
             if (guest.Active == true)
             {
                 _guestManager.DeactivateGuest(guest.GuestID);
             }
             else if (guest.Active == false)
             {
                 _guestManager.ReactivateGuest(guest.GuestID);
             }
             _guests = _guestManager.ReadAllGuests();
             dgGuests.ItemsSource = _guests;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Activating or Deactivating Guest Failed!");
     }
 }
        public void TestRetrieveGuest()
        {
            //Arrange
            int validGuestID = _guests[0].GuestID;
            //Act
            Guest guest = _guestManager.ReadGuestByGuestID(validGuestID);

            //Assert
            Assert.IsTrue(_guests[0].GuestID == guest.GuestID &&
                          _guests[0].MemberID == guest.MemberID &&
                          _guests[0].FirstName == guest.FirstName &&
                          _guests[0].LastName == guest.LastName &&
                          _guests[0].Email == guest.Email &&
                          _guests[0].PhoneNumber == guest.PhoneNumber &&
                          _guests[0].GuestTypeID == guest.GuestTypeID &&
                          _guests[0].Minor == guest.Minor &&
                          _guests[0].Active == guest.Active &&
                          _guests[0].ReceiveTexts == guest.ReceiveTexts &&
                          _guests[0].EmergencyFirstName == guest.EmergencyFirstName &&
                          _guests[0].EmergencyLastName == guest.EmergencyLastName &&
                          _guests[0].EmergencyPhoneNumber == guest.EmergencyPhoneNumber &&
                          _guests[0].EmergencyRelation == guest.EmergencyRelation);
        }