// GET: Rooms public ActionResult Index(ReservationSearchModel model) { _types = _roomType.RetrieveAllRoomTypes(); roomManager = new RoomManager(); model.Rooms = roomManager.RetrieveRoomList(); int hour = DateTime.Now.Hour; ViewBag.Greeting = hour < 12 ? "Good Morning" : "Good Afternoon"; ViewBag.Types = _types; return(View(model)); }
public void TestSetup() { accessor = new MockRoomTypeAccessor(); roomTypeManager = new RoomTypeManager(accessor); roomTypes = new List <RoomType>(); roomTypes = roomTypeManager.RetrieveAllRoomTypes("all"); }
public void TestRetrieveAllRoomTypes() { // arrange List <RoomType> testroomTypes = null; // act testroomTypes = roomTypeManager.RetrieveAllRoomTypes("all"); // assert CollectionAssert.Equals(testroomTypes, roomTypes); }
/// <summary> /// Opens up the add window and updates the datagrid if guest type was created successfully /// </summary> private void btnAdd_Click(object sender, RoutedEventArgs e) { var addGuest = new AddRoom(); var result = addGuest.ShowDialog(); if (result == true) { try { _currentRoom = null; _room = roomManager.RetrieveAllRoomTypes("All"); if (_currentRoom == null) { _currentRoom = _room; } dgRooms.ItemsSource = _currentRoom; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Loads the datagrid with the guest type table /// </summary> public RoomTypes() { InitializeComponent(); roomManager = new RoomTypeManager(); try { _room = roomManager.RetrieveAllRoomTypes("All"); if (_currentRoom == null) { _currentRoom = _room; } dgRooms.ItemsSource = _currentRoom; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Loads the combo box of room types to choose from /// </summary> public DeleteRoom() { InitializeComponent(); roomManager = new RoomTypeManager(); try { if (cboRoom.Items.Count == 0) { var guestId = roomManager.RetrieveAllRoomTypes(); foreach (var item in guestId) { cboRoom.Items.Add(item); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }