/// <summary author="Wes Richardson" created="2019/01/24"> /// Inserts a new Room into the database /// <param name="room">A room object</param> /// /// <returns>A bool if the room was created</returns> /// </summary> public bool CreateRoom(Room room, int employeeID) { int rows = 0; bool roomCreated = false; try { RoomVerifier.VerifyRoom(room, _roomAccessor); rows = _roomAccessor.InsertNewRoom(room, employeeID); } catch (Exception ex) { ExceptionLogManager.getInstance().LogException(ex); if (ex.Message.Contains("UNIQUE")) { throw new ApplicationException("Room already exists.", ex); } throw; } if (rows > 0) { roomCreated = true; } return(roomCreated); }
/// <summary author="Wes Richardson" created="2019/01/30"> /// Updates a room /// </summary> /// <param name="room">A room to update</param> /// <returns>A bool teling if the room was updated</returns> /// /// <updates> /// <update author="Dani Russo" date="2019/04/15"> /// Updated to take in newRoom /// </update> /// </updates> public bool UpdateRoom(Room selectedRoom, Room newRoom) { bool results = false; int rows = 0; try { RoomVerifier.VerifyRoom(newRoom, _roomAccessor); rows = _roomAccessor.UpdateRoom(selectedRoom, newRoom); } catch (Exception ex) { ExceptionLogManager.getInstance().LogException(ex); throw ex; } if (rows > 0) { results = true; } return(results); }