Beispiel #1
0
        public async Task <bool> updateResult(PatientLabOrder patientLabOrder)
        {
            try
            {
                SoapEntityRepository entityRepository   = SoapEntityRepository.GetService();
                mzk_patientorder     patientOrderEntity = (mzk_patientorder)entityRepository.GetEntity("mzk_patientorder", new Guid(patientLabOrder.Id)
                {
                },
                                                                                                       new Microsoft.Xrm.Sdk.Query.ColumnSet("mzk_orderstatus", "mzk_axcasetransrefrecid"));


                if (patientLabOrder.ResultStatus != string.Empty && patientLabOrder.ResultStatus != null)
                {
                    mzk_resultstatus resultStatus = mzk_resultstatus.Final;

                    switch (patientLabOrder.ResultStatus)
                    {
                    case "P":
                        resultStatus = mzk_resultstatus.Preliminary;
                        break;

                    case "C":
                        resultStatus = mzk_resultstatus.Corrected;
                        break;

                    case "f":
                        resultStatus = mzk_resultstatus.Final;
                        break;
                    }

                    patientOrderEntity.mzk_ResultStatus = new OptionSetValue((int)resultStatus);
                }

                if (patientLabOrder.LISLink != string.Empty && patientLabOrder.LISLink != null)
                {
                    patientOrderEntity.mzk_ReportURL = HttpUtility.UrlEncode(patientLabOrder.LISLink);
                }

                if (patientLabOrder.ReportPath != string.Empty && patientLabOrder.ReportPath != null)
                {
                    patientOrderEntity.mzk_ReportPath = patientLabOrder.ReportPath;
                }

                if (patientOrderEntity.mzk_AXCaseTransRefRecId.HasValue)
                {
                    CaseRepository caseRepo = new CaseRepository();

                    caseRepo.updateReportUrl((long)Convert.ToDecimal(patientOrderEntity.mzk_AXCaseTransRefRecId.Value), patientLabOrder.LISLink, patientLabOrder.ReportPath);
                }

                entityRepository.UpdateEntity(patientOrderEntity);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }