private void GetESignatureStatus()
        {
            if (this.CurrentSiteType == ReadingSiteType.consultation)
            {
                this.EsigStatus = new PathologyElectronicSignatureNeedType() { Status = ESigNeedType.not_authorized, Message = "Consulting site cannot verify main report." };
                return;
            }

            // first check to see if the user has already got the status for this type of report yet
            AccessionNumber acNum = new AccessionNumber(this.AccessionNumber);
            string eSigKey = this.SiteCode + "^" + acNum.Type;

            if (UserContext.UserCredentials.UserHasESignatureStatus(eSigKey))
                this.EsigStatus = UserContext.UserCredentials.GetESignatureStatusAtSite(eSigKey);
            else
            {
                // retrieve the Esignature status from database
                this.EsigStatus = DataSource.GetESignatureStatus(this.SiteCode, this.AccessionNumber);

                // update to the list
                UserContext.UserCredentials.ESignatureStatuses.Add(eSigKey, this.EsigStatus);
            }

            // if the interpretation site is remote then it also need local esignature status
            if (UserContext.LocalSite.PrimarySiteStationNUmber != this.SiteCode)
            {
                string localESigKey = UserContext.LocalSite.PrimarySiteStationNUmber + "^" + acNum.Type;
                if (UserContext.UserCredentials.UserHasESignatureStatus(localESigKey))
                    this.LocalEsigStatus = UserContext.UserCredentials.GetESignatureStatusAtSite(localESigKey);
                else
                {
                    // retrieve the Esignature status from database
                    this.LocalEsigStatus = DataSource.GetESignatureStatus(UserContext.LocalSite.PrimarySiteStationNUmber, this.AccessionNumber);

                    // update to the list
                    UserContext.UserCredentials.ESignatureStatuses.Add(localESigKey, this.LocalEsigStatus);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Check if e-signature is required
        /// </summary>
        /// <param name="siteID">Site need to check</param>
        /// <param name="reportType">Report type</param>
        /// <returns>status of e-signature requirement</returns>
        public PathologyElectronicSignatureNeedType GetESignatureStatus(string siteID, string reportType)
        {
            Log.Debug("Checking e-signature status...");

            PathologyElectronicSignatureNeedType result = new PathologyElectronicSignatureNeedType() { Status = ESigNeedType.error, Message = "Could not retrieve E-signature status." };

            if (string.IsNullOrWhiteSpace(siteID))
            {
                Log.Error("Missing parameter: siteID.");
                return result;
            }

            if (string.IsNullOrWhiteSpace(reportType))
            {
                Log.Error("Missing parameter: reportType.");
                return result;
            }

            string URI = String.Format("pathology/esigneeded/{0}/{1}", siteID, reportType);
            IRestResponse response;
            try
            {
                response = ExecuteGet(URI, VixServiceTypes.Pathology);
                ValidateRestResponse(response);
                result = ResponseParser.ParseGetESignatureStatus(response.Content);
            }
            catch (MagVixFailureException vfe)
            {
                Log.Error("Unexpected result.", vfe);
            }
            catch (Exception ex)
            {
                Log.Error("Could not complete request to check e-signature status.", ex);
            }

            return result;
        }