예제 #1
0
 static List <ApptAvailability> GetApptAvailability()
 {
     using (SlotsTableEntities db = new SlotsTableEntities())
     {
         return((from a in db.usp_GetAvailability()
                 select new ApptAvailability
         {
             AvailabilityStartDateTime = (DateTime)a.StartDateTime,
             AvailabilityEndDateTime = (DateTime)a.EndDateTime,
             AvailabilityId = a.AvailabilityId,
             DayOfWeek = (int)a.DayOfWeek
         }).ToList());
     }
 }
예제 #2
0
 static List <ApptException> GetApptExceptions()
 {
     using (SlotsTableEntities db = new SlotsTableEntities())
     {
         return((from a in db.usp_GetExceptionTimes()
                 select new ApptException
         {
             ExceptionEndDateTime = (DateTime)a.ExceptionEndDate,
             ExceptionStartDateTime = (DateTime)a.ExceptionStartDate,
             ExceptionId = a.ExceptionId,
             IsRecurring = (bool)a.IsRecurring
         }).ToList());
     }
 }
예제 #3
0
 static List <AppointmentType> GetApptTypes()
 {
     using (SlotsTableEntities db = new SlotsTableEntities())
     {
         return((from a in db.usp_GetApptTypes()
                 select new AppointmentType
         {
             ApptDesc = a.ApptDescription,
             ApptLength = (int)a.ApptLength,
             ApptType = a.ApptType,
             ApptTypeId = a.ApptTypeId
         }).ToList());
     }
 }
예제 #4
0
        static List <ApptModel> GetAppointments(DateTime apptDate)
        {
            using (SlotsTableEntities db = new SlotsTableEntities())
            {
                List <ApptModel> appts = new List <ApptModel>();
                appts = (from a in db.usp_GetAppointmentsByDay(apptDate)
                         select new ApptModel
                {
                    StartTime = (DateTime)a.StartTime,
                    EndTime = (DateTime)a.EndTime
                }).ToList();


                return(appts);
            }
        }
예제 #5
0
        static List <SlotModel> GetSlots(int duration)
        {
            using (SlotsTableEntities db = new SlotsTableEntities())
            {
                List <SlotModel> slots = new List <SlotModel>();
                slots = (from a in db.usp_GetAppointmentSlots(new TimeSpan(6, 0, 0),
                                                              new TimeSpan(20, 0, 0), duration, DateTime.Now)
                         select new SlotModel
                {
                    StartSlot = (DateTime)a.start,
                    EndSlot = (DateTime)a.end,
                }).ToList();

                slots = slots.Where(x => x.StartSlot.TimeOfDay >= DateTime.Now.TimeOfDay).ToList();
                return(slots);
            }
        }