public bool makeReservation(DateTime startDate, DateTime endDate, Hotel hotel, Room room) { bool temp = true; foreach (Reservation i in ReservationList) { if (i.StartDate < endDate && startDate < i.EndDate && hotel == i.Hotel && room.No == i.Room.No) { temp = false; break; } } if (temp) { Reservation reservation = new Reservation(startDate, endDate, hotel, room); ReservationList.Add(reservation); } return(temp); }
/// <summary> /// コマンドを実行 /// </summary> public void Execute() { // 検索クラス作成 var finder = new ProcessFormat() { HotelID = new Hotel() { HotelID = SelectedHotel.HotelID, HotelName = SelectedHotel.HotelName, PrefCode = SelectedHotel.PrefCode }, CheckinDate = CheckinDate, Type = SelectedRoomType, CheckinValue = SelectedCheckinTime, EnableNoSmoking = ChkNoSmoking, EnableSmoking = ChkSmoking, SmokingFirst = IsSmokingFirst, EnableAutoRetry = ChkAutoRetry, EnableOverwrite = ChkOverwrite }; var item = new ReservationControlViewModel(finder); ReservationList.Add(item); }