Beispiel #1
0
        public AppointmentDto(AppointmentDto app)
            : this()
        {
            this.IsLocked              = app.IsLocked;
            this.IsLockedBy            = app.IsLockedBy;
            this.IsJustCreated         = app.IsJustCreated;
            this.AppointmentID         = app.AppointmentID;
            this.Number                = app.Number;
            this.Name                  = app.Name;
            this.Description           = app.Description;
            this.StatusID              = app.StatusID;
            this.AccountID             = app.AccountID;
            this.PatientVisitId        = app.PatientVisitId;
            this.LocationId            = app.LocationId;
            this.DefaultOrderPriority  = app.DefaultOrderPriority;
            this.PendingReasonCode     = app.PendingReasonCode;
            this.PendingReasonText     = app.PendingReasonText;
            this.Visit                 = app.Visit == null ? new VisitDto() : app.Visit.Clone() as VisitDto;
            this.CreateBy              = app.CreateBy;
            this.CreatedOn             = app.CreatedOn;
            this.LastModifiedBy        = app.LastModifiedBy;
            this.LastModifiedOn        = app.LastModifiedOn;
            this.Comment               = app.Comment;
            this.RescheduleFromHistory = app.RescheduleFromHistory;
            this.RescheduleFromPending = app.RescheduleFromPending;
            this.ScheduleFromPending   = app.ScheduleFromPending;
            this.IsOverheadApplied     = app.IsOverheadApplied;
            this.IsAuthorizationAlert  = app.IsAuthorizationAlert;
            this.AffectedVirtualRooms.AddRange(app.AffectedVirtualRooms);
            this.AppointmentProcedureWithLocationAlerts.AddRange(app.AppointmentProcedureWithLocationAlerts);
            this.PaymentFees        = app.PaymentFees;
            this.GroupId            = app.GroupId;
            this.RequestedTimeRange = app.RequestedTimeRange;

            foreach (AppointmentResourceDto resource in app.Resources)
            {
                this.Resources.Add(resource.Clone() as AppointmentResourceDto);
            }

            if (app.Comments != null)
            {
                if (this.Comments == null)
                {
                    this.Comments = new List <PatientCommentDto>();
                }
                else
                {
                    this.Comments.Clear();
                }
                foreach (PatientCommentDto comment in app.Comments)
                {
                    this.Comments.Add(new PatientCommentDto(comment));
                }
            }
        }
Beispiel #2
0
        public bool ContainsAppointment(AppointmentDto app)
        {
            if (this.Appointments == null)
            {
                return(false);
            }

            foreach (AppointmentDto a in this.Appointments)
            {
                if (a.AppointmentID == app.AppointmentID)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #3
0
        public static List <PatientCommentDto> GetCommentsPerAppointment(List <PatientCommentDto> comments,
                                                                         AppointmentDto appt)
        {
            List <PatientCommentDto> r = new List <PatientCommentDto>();

            List <PatientCommentDto> commentsToProcess = GetWithoutDublicates(comments, appt);

            foreach (PatientCommentDto dto in commentsToProcess)
            {
                if (dto.CommentedEntityId == appt.AppointmentID)
                {
                    r.Add(dto);
                }
            }

            return(r);
        }
Beispiel #4
0
        public static List <PatientCommentDto> GetWithoutCancelledDublicates(List <PatientCommentDto> updatedComments, AppointmentDto appt)
        {
            List <PatientCommentDto> comments = new List <PatientCommentDto>();
            List <PatientCommentDto> apptComments;

            //            if (appt != null)
            //                apptComments = updatedComments.Where(a => a.CommentedEntityType == CommentedEntityTypes.Appointment &&
            //                    a.CommentedEntityId == appt.AppointmentID).Distinct(new DistinctComment()).ToList();
            //            else
            apptComments = updatedComments.Where(a => a.CommentedEntityType == CommentedEntityTypes.Appointment).
                           Distinct(new DistinctComment()).
                           ToList();

            if (appt != null)
            {
                updatedComments.ForEach(a =>
                                        a.IsAttachedToCurrentAppointment = (a.CommentedEntityType == CommentedEntityTypes.Appointment &&
                                                                            a.CommentedEntityId == appt.AppointmentID)
                                        );
            }

            comments.AddRange(apptComments);
            var nonApptComments = updatedComments.Where(a => a.CommentedEntityType != CommentedEntityTypes.Appointment).ToList();

            comments.AddRange(nonApptComments);
            return(comments.OrderByDescending(a => a.Time).ToList());
        }