Beispiel #1
0
 //public string VisitType { get; set; }
 //public override IList<Appointment> GetAppointments()
 //{
 //    IList<PatientVisit> patientVisitAppointment = new List<PatientVisit>();
 //    if (IsRecurrence == true)
 //    {
 //    }
 //    return null;
 //}
 public override Appointment Clone()
 {
     Type type = GetType();
     PatientVisit deepCopyData = new PatientVisit();
     foreach (System.Reflection.PropertyInfo objProp in type.GetProperties())
     {
         if (objProp.CanWrite)
         {
             objProp.SetValue(deepCopyData, type.GetProperty(objProp.Name).GetValue(this, null), null);
         }
     }
     return deepCopyData;
 }
Beispiel #2
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;
        }