예제 #1
0
 /// <summary>
 /// Gets all reserved objects by date range and user id.
 /// </summary>
 /// <param name="db">The db.</param>
 /// <param name="reservationId">The reservation id.</param>
 /// <returns></returns>
 public static IEnumerable<AppointmentObj> GetAllReservedObjectsByReservationId(ref UrbanDataContext db, int reservationId)
 {
     var rList = RoomReservationDatesUtilities.GetAppointmentObjByUserId(ref db, reservationId);
     return rList.Select(r => new AppointmentObj
     {
         Busy = true,
         Days = r.Days,
         End = r.End,
         Start = r.Start,
         Subject = r.Subject
     }).ToList();
 }
예제 #2
0
 /// <summary>
 ///     Gets all reserved objects by date range and user id.
 /// </summary>
 /// <param name = "db">The db.</param>
 /// <param name = "startDate">The start date.</param>
 /// <param name = "endDate">The end date.</param>
 /// <param name = "userId">The user id.</param>
 /// <returns></returns>
 public static IEnumerable<AppointmentObj> GetAllReservedObjectsByDateRangeAndUserId(ref UrbanDataContext db, DateTime startDate, DateTime endDate, int userId)
 {
     var rList = RoomReservationDatesUtilities.GetAppointmentObjByStartDateEndDateUserId(ref db, startDate, endDate, userId);
     return rList.Select(r => new AppointmentObj
                                  {
                                      Busy = true,
                                      Days = r.Days,
                                      End = r.End,
                                      Start = r.Start,
                                      Subject = r.Subject
                                  }).ToList();
 }
예제 #3
0
        /// <summary>
        ///     Gets the appointment objects by date range and room id.
        /// </summary>
        /// <param name = "db">The db.</param>
        /// <param name = "startDate">The start date.</param>
        /// <param name = "endDate">The end date.</param>
        /// <param name = "roomId">The room id.</param>
        /// <returns></returns>
        public static IEnumerable<AppointmentObj> GetAppointmentObjectsByDateRangeAndRoomId(ref UrbanDataContext db, DateTime startDate, DateTime endDate, int roomId)
        {
            var apptList = new List<AppointmentObj>();

            //Retrieve Reserved Dates For room and date range
            var rList = RoomReservationDatesUtilities.GetAppointmentObjByStartDateEndDateRoomId(ref db, startDate, endDate, roomId);
            //Retrieve Dates with recurring for start and end date with roomId
            var aList = RoomAvailabilityUtilities.GetAppointmentObjsWithRecurring(ref db, startDate, endDate, roomId);

            //Deal with date duplicates
            var processAvailList = ProcessAvailabilityDateOverLap(rList, aList);

            //Add Dates to list
            apptList.AddRange(rList);
            apptList.AddRange(processAvailList);

            //Order List by start date
            return apptList.OrderBy(t => t.Start).ToList();
        }