Exemple #1
0
        public bool IsRoomAvailable(Guid eventId, Room room, DateTime start, DateTime end)
        {
            if (room.EndTime < room.StartTime)
            {
                if (room.EndTime < room.StartTime)
                {
                    if ((new TimeSpan(start.Hour, start.Minute, 0)).Ticks < (new TimeSpan(room.StartTime.Hours, room.StartTime.Minutes, room.StartTime.Seconds)).Ticks)
                        start = start.AddDays(1);
                    if ((new TimeSpan(end.Hour, end.Minute, 0)).Ticks < (new TimeSpan(room.StartTime.Hours, room.StartTime.Minutes, room.StartTime.Seconds)).Ticks)
                        end = end.AddDays(1);
                }
            }

            var isEventRoomBooked = BookedRooms.Where(x => !x.EventRoom.Event.IsDeleted && x.EventRoom.EventID != eventId && x.EventRoom.RoomID == room.ID).Any(x => IsDateBetweenAnotherTwo(start, end, x.StartTimeEx)
                || IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, start) || IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, end.Add(new TimeSpan(0, 0, -1, 0)))
                            || IsDateBetweenAnotherTwo(start, end, x.EndTimeEx.Add(new TimeSpan(0, 0, -1, 0))));

            var isEventCateringBooked = BookedCaterings.Where(x => !x.EventCatering.Event.IsDeleted && x.EventCatering.EventID != eventId && x.EventCatering.RoomID == room.ID).Any(x => IsDateBetweenAnotherTwo(start, end, x.StartTimeEx)
                || IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, start) || IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, end.Add(new TimeSpan(0, 0, -1, 0)))
                || IsDateBetweenAnotherTwo(start, end, x.EndTimeEx.Add(new TimeSpan(0, 0, -1, 0))));

            var isRoomBooked = isEventRoomBooked || isEventCateringBooked;

            return !isRoomBooked;
        }
Exemple #2
0
        public bool IsRoomAvailable(Room room, DateTime date)
        {
            var isEventRoomBooked = BookedRooms.Where(x => !x.EventRoom.Event.IsDeleted && x.Room == room).Any(x => IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, date));
            var isEventCateringBooked = BookedCaterings.Where(x => !x.EventCatering.Event.IsDeleted && x.Room == room).Any(x => IsDateBetweenAnotherTwo(x.StartTimeEx, x.EndTimeEx, date));

            var isRoomBooked = isEventRoomBooked || isEventCateringBooked;

            return !isRoomBooked;
        }
Exemple #3
0
        public EventCateringModel(EventCatering eventCatering)
        {
            _eventCatering = eventCatering;
            EventBookedProducts = new ObservableCollection<EventBookedProductModel>();

            _room = _eventCatering.Room;
        }
 /// <summary>
 /// Create a new Room object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="multipleBooking">Initial value of the MultipleBooking property.</param>
 /// <param name="height">Initial value of the Height property.</param>
 /// <param name="width">Initial value of the Width property.</param>
 /// <param name="length">Initial value of the Length property.</param>
 /// <param name="boardroomAllowed">Initial value of the BoardroomAllowed property.</param>
 /// <param name="theatreAllowed">Initial value of the TheatreAllowed property.</param>
 /// <param name="conferenceAllowed">Initial value of the ConferenceAllowed property.</param>
 /// <param name="freeFormAllowed">Initial value of the FreeFormAllowed property.</param>
 /// <param name="includeInForwardBook">Initial value of the IncludeInForwardBook property.</param>
 /// <param name="allowOnlineBooking">Initial value of the AllowOnlineBooking property.</param>
 /// <param name="adminAuthorisation">Initial value of the AdminAuthorisation property.</param>
 /// <param name="isEnabled">Initial value of the IsEnabled property.</param>
 /// <param name="color">Initial value of the Color property.</param>
 /// <param name="startTime">Initial value of the StartTime property.</param>
 /// <param name="endTime">Initial value of the EndTime property.</param>
 /// <param name="timeInterval">Initial value of the TimeInterval property.</param>
 public static Room CreateRoom(global::System.Guid id, global::System.String name, global::System.Boolean multipleBooking, global::System.Single height, global::System.Single width, global::System.Single length, global::System.Boolean boardroomAllowed, global::System.Boolean theatreAllowed, global::System.Boolean conferenceAllowed, global::System.Boolean freeFormAllowed, global::System.Boolean includeInForwardBook, global::System.Boolean allowOnlineBooking, global::System.Boolean adminAuthorisation, global::System.Boolean isEnabled, global::System.String color, global::System.TimeSpan startTime, global::System.TimeSpan endTime, global::System.TimeSpan timeInterval)
 {
     Room room = new Room();
     room.ID = id;
     room.Name = name;
     room.MultipleBooking = multipleBooking;
     room.Height = height;
     room.Width = width;
     room.Length = length;
     room.BoardroomAllowed = boardroomAllowed;
     room.TheatreAllowed = theatreAllowed;
     room.ConferenceAllowed = conferenceAllowed;
     room.FreeFormAllowed = freeFormAllowed;
     room.IncludeInForwardBook = includeInForwardBook;
     room.AllowOnlineBooking = allowOnlineBooking;
     room.AdminAuthorisation = adminAuthorisation;
     room.IsEnabled = isEnabled;
     room.Color = color;
     room.StartTime = startTime;
     room.EndTime = endTime;
     room.TimeInterval = timeInterval;
     return room;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Rooms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRooms(Room room)
 {
     base.AddObject("Rooms", room);
 }
Exemple #6
0
 public EventRoomModel(EventRoom eventRoom)
 {
     _eventRoom = eventRoom;
     EventBookedProducts = new ObservableCollection<EventBookedProductModel>();
     _room = eventRoom.Room;
 }
Exemple #7
0
        public RoomModel(Room room)
        {
            _room = room;
            RefreshRoomFacilities();
            CreateClockItems();

        }