예제 #1
0
        /// <summary>
        /// Get calendar list of event proxy  from appointments
        /// </summary>
        /// <param name="appointments"></param>
        /// <param name="calenderView"></param>
        /// <returns></returns>
        private IList<CalendarEventProxy> GetAppointmentsForCalendar(List<Appointment> appointments, string calenderView)
        {
            IList<CalendarEventProxy> calendarEvents = new List<CalendarEventProxy>();
            var appointmentsForEachDay = appointments.GroupBy(s => s.StartDateTime.Date);
            List<Appointment> appointmentsTemp = new List<Appointment>();
            if (calenderView == AppEnum.CalendarViewTypes.month.ToString())
            {
                foreach (var item in appointmentsForEachDay)
                {
                    if (item.Count() > 3)
                    {
                        appointmentsTemp.AddRange(item.OrderBy(f => f.StartDateTime).Take(3).ToList());
                        PatientVisit patientVisit = new PatientVisit { Type = AppCommon.ViewMore, StartDateTime = item.Key };
                        appointmentsTemp.Add(patientVisit);
                    }
                    else
                    {
                        appointmentsTemp.AddRange(item.ToList());
                    }
                }
            }
            else
            {
                appointmentsTemp = appointments;
            }
            foreach (var item in appointmentsTemp)
            {
                CalendarEventProxy calenderEvent = new CalendarEventProxy { allDay = false, editable = false };

                if (item.Type != AppCommon.ViewMore)
                {
                    calenderEvent.title = GetCalendarTitleForAppointmentType(item, calenderView);
                    calenderEvent.tooltip = GetCalendarTooltipForAppointmentType(item);
                    calenderEvent.AppointmentType = GetAppointmentType(item);
                    calenderEvent.className = GetCalendarClassForAppointmentType(item);
                    calenderEvent.start = item.StartDateTime.ToString();
                    calenderEvent.isRecurrence = CheckIfRecurrenceExists(item);
                    calenderEvent.end = item.EndDateTime.ToString();
                    calenderEvent.Url = item.Url;
                    calenderEvent.PatientName = AppCommon.GetPatientName(item.FirstName, item.LastName, item.MiddleInitial);
                    calenderEvent.visittype = item.Type;
                    calenderEvent.timeinterval = AppCommon.GetDateInGivenFormat(AppCommon.DateHMmTt, item.StartDateTime)
                                                             + AppCommon.HyphenSeperator
                                                             + AppCommon.GetDateInGivenFormat(AppCommon.DateHMmTt, item.EndDateTime);
                    calenderEvent.Status = item.Status;
                    calenderEvent.providername = _masterService.GetProviderName(item.ProviderId, AppCommon.NewLineSeperator);
                }
                else
                {
                    calenderEvent.title = item.Type;
                    calenderEvent.className = AppCommon.ViewMoreLink;
                    calenderEvent.start = new DateTime(item.StartDateTime.Year, item.StartDateTime.Month, item.StartDateTime.Day, 23, 59, 59).ToString();
                }
                calendarEvents.Add(calenderEvent);
            }
            return calendarEvents;
        }
예제 #2
0
 /// <summary>
 /// Get exam room view values for calendar
 /// </summary>
 /// <param name="calendarFilterObject"></param>
 /// <returns></returns>
 public IList<CalendarEventProxy> GetExamRoomViewFilter(CalendarFilterProxy calendarFilterObject)
 {
     IList<CalendarEventProxy> calendarEvents = new List<CalendarEventProxy>();
     calendarFilterObject.CalendarView = AppEnum.CalendarViewTypes.agendaDay.ToString();
     IList<Appointment> appointmentsList = _appointmentDocument.GetPatientVisitAppointments(calendarFilterObject, AppEnum.CalendarFilterTypes.None);
     foreach (var item in appointmentsList)
     {
         CalendarEventProxy calenderEvent = new CalendarEventProxy
                                                {
                                                    title = GetCalendarTitleForAppointmentType(item, AppEnum.CalendarViewTypes.resourceDay.ToString()),
                                                    tooltip = GetCalendarTooltipForAppointmentType(item),
                                                    className = GetCalendarClassForAppointmentType(item),
                                                    isRecurrence = CheckIfRecurrenceExists(item),
                                                    editable = false,
                                                    start = item.StartDateTime.ToString(),
                                                    end = item.EndDateTime.ToString(),
                                                    allDay = false,
                                                    Url = item.Url,
                                                    PatientName = AppCommon.GetPatientName(item.FirstName, item.LastName, item.MiddleInitial),
                                                    AppointmentType = GetAppointmentType(item),
                                                    resourceId = item.ExamRoomIdentifier,
                                                    IsViewMode=true
                                                };
         calendarEvents.Add(calenderEvent);
     }
     return calendarEvents;
 }