Пример #1
0
        /// <summary>
        /// Saves the section information for one visit
        /// </summary>
        /// <param name="p">parameters</param>
        public void SaveSection(VisitSaveSectionSP p)
        {
            if (string.IsNullOrEmpty(p.SectionValuesJson) == false)
            {
                if (FWUtils.EntityUtils.JsonIsValidThenDeserialize(p.SectionValuesJson) == null)
                {
                    throw new ImpossibleExecutionException("SaveSection p.SectionValuesJson is not a valid json:" + p.SectionValuesJson);
                }
            }

            vVisit obj = GetByIDV(p.VisitID);

            if (obj == null)
            {
                throw new UserException(StringMsgs.BusinessErrors.RecordIsNotAvailable);
            }
            else
            {
                if (p.SectionName == "SysReview")
                {
                    OwnerDoctorSecurity.Check("write a review for an appointment", obj, vVisit.ColumnNames.DoctorID);
                    obj.DoctorSystemReviewJson = p.SectionValuesJson;
                }
                else
                {
                    throw new ImpossibleExecutionException(p.SectionName);
                }
                Update(obj);
            }
        }
Пример #2
0
        public void SaveSectionSysReview()
        {
            TestUtils.Security.SetCurrentUser(TestEnums.User.constDoctorID);

            IVisitService      target = GetNewVisitService();
            Visit              visit  = InsertVisit(EntityEnums.VisitStatusEnum.Scheduled, EntityEnums.PaymentStatusEnum.NotStarted);
            VisitSaveSectionSP p      = new VisitSaveSectionSP();

            p.VisitID           = visit.VisitID;
            p.SectionName       = "SysReview";
            p.SectionValuesJson = "{ }";
            target.SaveSection(p);

            Visit visitAfter = target.GetByIDT(visit.VisitID, new GetByIDParameters());

            Assert.AreEqual(p.SectionValuesJson, visitAfter.DoctorSystemReviewJson);
        }