public List<RoomInfo> getAllRoomInfos() { try { var hotelFacade = new HotelFacade(); List<Room> rooms = hotelFacade.getAllRooms(); if (rooms != null && rooms.Count > 0) { List<RoomInfo> roomInfos = new List<RoomInfo>(); foreach (Room room in rooms) { RoomInfo roomInfo = new RoomInfo(); roomInfo.roomNo = room.RoomNo; roomInfo.roomType = room.RoomType.Name; roomInfo.dailyCharge = room.RoomType.DailyCharge.ToString(); roomInfo.capacity = room.RoomType.Capacity; roomInfos.Add(roomInfo); } return roomInfos; } else { throw new Exception("No room Available"); } } catch (Exception e) { throw new FaultException<Exception>(e); } }
public Boolean checkRoomAvailability(string roomNo, string startDateStr, int duration) { try { HotelFacade hotelFacade = new HotelFacade(); DateTime startDate = DateTime.Parse(startDateStr); return hotelFacade.checkRoomAvailability(roomNo, startDate, duration); } catch (Exception e) { throw new FaultException<Exception>(e); } }
public ReservationResponse makeRoomReservation(ReservationRequest request) { try { HotelFacade hotelFacade = new HotelFacade(); DateTime startDate = DateTime.Parse(request.StartDate); Payment payment = new Payment(); payment.CardType = request.CardType; payment.GuestAccount = request.GuestAccount; payment.TotalCharge = request.TotalCharge; payment.CardType = request.CardType; String responseCode = hotelFacade.makeReservation(request.RoomNo,request.GuestName,request.GuestPassport,startDate,request.Duration,request.NumOfGuest, payment); ReservationResponse response = new ReservationResponse(); response.responseCode = responseCode; return response; } catch (Exception e) { throw new FaultException<Exception>(e); } }