public HttpResponseMessage GetPatientExamDetail(int patientId, int orderId, int examId)
        {
            try
            {
                AccessControl.VerifyPatientDataAccess(patientId, orderId, examId);
                AccessControl.VerifyUserAccessToPatient(patientId);

                PatientExamDetail patientExamDetail = this.patientExamsIt2Manager.GetNewPatientExamDetail(patientId, this.companyId, examId, orderId);

                if (patientExamDetail != null)
                {
                    var data = new List <KeyValuePair <int, DateTime> > {
                        new KeyValuePair <int, DateTime>(patientExamDetail.ExamId, DateTime.UtcNow)
                    };
                    MessageTracking.SignalAlSupportTracking(data, "Viewed");
                }

                return(this.Request.CreateResponse(HttpStatusCode.OK, patientExamDetail));
            }
            catch (Exception ex)
            {
                var error = "GetPatientExamDetail(" + string.Format("{0}", patientId) + ")\n" + ex;
                return(HandleExceptions.LogExceptions(error, Logger, ex));
            }
        }
Beispiel #2
0
        /// <summary>The get eye glasses rx by id.</summary>
        /// <param name="officeNumber">The office number.</param>
        /// <param name="patientId">The patient Id.</param>
        /// <param name="examId">The exam Id.</param>
        /// <param name="isRecheck"></param>
        /// <returns>The <see cref="PatientEyeGlassesRx"/>.ObjectNotFoundException</returns>
        public HttpResponseMessage GetEyeGlassesRxById(string officeNumber, int patientId, int examId, bool isRecheck)
        {
            try
            {
                AccessControl.VerifyUserAccessToPatient(patientId);
                if (patientId <= 0)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.NotFound, "Patient not found."));
                }

                var result = this.eyeGlassesManager.GetEyeGlassesRxById(officeNumber, patientId, examId, isRecheck);

                if (result != null)
                {
                    var requestMessage = new List <KeyValuePair <int, DateTime> > {
                        new KeyValuePair <int, DateTime>(examId, DateTime.UtcNow)
                    };
                    MessageTracking.SignalAlSupportTracking(requestMessage, "Viewed");
                }

                return(result != null?this.Request.CreateResponse(HttpStatusCode.OK, result) : this.Request.CreateResponse(HttpStatusCode.NoContent));
            }
            catch (Exception ex)
            {
                var error = "GetEyeGlassesRxById(examId=" + examId + ", patientId=" + patientId + ")\n" + ex;
                return(HandleExceptions.LogExceptions(error, Logger, ex));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Sends a message according to the given criteria
        /// </summary>
        /// <returns>true on success</returns>
        public static bool SendMessage(string from, string to, string bcc, string subject, string body)
        {
            try
            {
                MessageGateway.SendMessage(from, to, bcc, subject, body);
            }
            catch
            {
                return(false); //False when message sending doesn't succeed
            }

            //Message is sent, record the event
            using (var ts = new TransactionScope())
            {
                var messageTracking = new MessageTracking
                {
                    To       = to,
                    From     = from,
                    Body     = body,
                    DateSent = DateTime.Now,
                    SentBy   = UserContext.Identity == null ? "N/A" : UserContext.Identity.Name
                };

                MessageTrackingBLL.EnsurePersistent(messageTracking);

                ts.CommitTransaction();
            }

            return(true); //Success
        }
        public HttpResponseMessage GetContactLensRxById(string officeNumber, int patientId, int examId, bool isRecheck)
        {
            try
            {
                AccessControl.VerifyUserAccessToPatient(patientId);
                PatientContactLensRxLite patientContactLensRx = this.it2Soft.GetContactLensRxById(
                    officeNumber,
                    patientId,
                    examId,
                    isRecheck);

                if (patientContactLensRx != null)
                {
                    var requestMessage = new List <KeyValuePair <int, DateTime> > {
                        new KeyValuePair <int, DateTime>(examId, DateTime.UtcNow)
                    };
                    MessageTracking.SignalAlSupportTracking(requestMessage, "Viewed");
                }

                return(patientContactLensRx != null?this.Request.CreateResponse(HttpStatusCode.OK, patientContactLensRx) : this.Request.CreateResponse(HttpStatusCode.NoContent));
            }
            catch (Exception ex)
            {
                var error = "GetContactLensRxById(examId=" + examId + ", patientId=" + patientId + ")\n" + ex;
                return(HandleExceptions.LogExceptions(error, Logger, ex));
            }
        }
Beispiel #5
0
        public void CanSaveMessageTrackingEntry()
        {
            var tracking = new MessageTracking
            {
                From     = StaticProperties.TestString,
                To       = StaticProperties.TestString,
                SentBy   = StaticProperties.TestString,
                Body     = StaticProperties.TestString,
                DateSent = DateTime.Now
            };

            using (var ts = new TransactionScope())
            {
                GenericBLL <MessageTracking, int> .EnsurePersistent(tracking);

                ts.CommitTransaction();
            }
        }
        public void CanSaveMessageTrackingEntry()
        {
            var tracking = new MessageTracking
                               {
                                   From = StaticProperties.TestString,
                                   To = StaticProperties.TestString,
                                   SentBy = StaticProperties.TestString,
                                   Body = StaticProperties.TestString,
                                   DateSent = DateTime.Now
                               };

            using (var ts = new TransactionScope())
            {
                GenericBLL<MessageTracking, int>.EnsurePersistent(tracking);

                ts.CommitTransaction();
            }
        }
        public HttpResponseMessage GetPatientExams(int patientId)
        {
            try
            {
                AccessControl.VerifyUserAccessToPatient(patientId);
                var patientExamVm = this.patientExamsIt2Manager.GetUnusedPatientEhrExams(patientId);

                if (patientExamVm != null && patientExamVm.PendingExams != null && patientExamVm.PendingExams.Count > 0)
                {
                    var data = patientExamVm.PendingExams.Select(x => new KeyValuePair <int, DateTime>(x.ExamId, DateTime.UtcNow)).ToList();
                    MessageTracking.SignalAlSupportTracking(data, "Listed");
                }

                return(this.Request.CreateResponse(HttpStatusCode.OK, patientExamVm));
            }
            catch (Exception ex)
            {
                var error = "GetPatientExams(" + string.Format("{0}", patientId) + ")\n" + ex;
                return(HandleExceptions.LogExceptions(error, Logger, ex));
            }
        }