public void TestCreateGuestValidInput()
        {
            //Arrange
            Guest guest = new Guest()
            {
                GuestID = 100010, MemberID = 100002, GuestTypeID = "Student", FirstName = "Johnny", LastName = "Johnson", PhoneNumber = "3192968018", Minor = true, Active = true, Email = "*****@*****.**", ReceiveTexts = true, EmergencyFirstName = "Albion", EmergencyLastName = "Bumblebee", EmergencyPhoneNumber = "3192885567", EmergencyRelation = "Brother-in-law"
            };

            //Act
            _guestManager.CreateGuest(guest);
            //Assert
            _guests = _guestManager.ReadAllGuests();

            Assert.IsNotNull(_guests.Find(x => x.GuestID == guest.GuestID &&
                                          x.MemberID == guest.MemberID &&
                                          x.FirstName == guest.FirstName &&
                                          x.LastName == guest.LastName &&
                                          x.Email == guest.Email &&
                                          x.PhoneNumber == guest.PhoneNumber &&
                                          x.GuestTypeID == guest.GuestTypeID &&
                                          x.Minor == guest.Minor &&
                                          x.Active == guest.Active &&
                                          x.ReceiveTexts == guest.ReceiveTexts &&
                                          x.EmergencyFirstName == guest.EmergencyFirstName &&
                                          x.EmergencyLastName == guest.EmergencyLastName &&
                                          x.EmergencyPhoneNumber == guest.EmergencyPhoneNumber &&
                                          x.EmergencyRelation == guest.EmergencyRelation));
        }
 public void TestSetup()
 {
     _gues         = new GuestAccessorMock();
     _guestManager = new GuestManager(_gues);
     _guests       = new List <Guest>();
     _guests       = _guestManager.ReadAllGuests();
 }
        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;
        }
Esempio n. 4
0
 /// <summary>
 ///  Alisa Roehr
 /// Created: 2019/01/25
 ///
 /// The constructor for the browse window.
 /// </summary>
 public BrowseGuests()
 {
     InitializeComponent();
     _guestManager = new GuestManager();
     try
     {
         _guests = _guestManager.ReadAllGuests();
         if (dgGuests.ItemsSource == null)
         {
             dgGuests.ItemsSource = _guests;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Alisa Roehr
 /// Created: 2019/02/01
 ///
 /// for loading the guest details
 /// </summary>
 /// <remarks>
 ///
 /// </remarks>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgGuests_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (dgGuests.SelectedItem != null && ((Guest)dgGuests.SelectedItem).Active != false)
         {
             var selectedGuest = (Guest)dgGuests.SelectedItem;
             var detail        = new frmAddEditGuest(selectedGuest);
             var result        = detail.ShowDialog();
             _guests = _guestManager.ReadAllGuests();
             dgGuests.ItemsSource = _guests;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Viewing Guest Failed!");
     }
 }