예제 #1
0
        /// <summary>
        /// Save report template back to VistA
        /// </summary>
        /// <param name="templateObj">Template object containing the template to be stored</param>
        public void SaveReportTemplate(VixReportTemplateObject templateObj)
        {
            Log.Debug("Saving report template to VistA...");

            // input check
            if (templateObj == null)
            {
                throw new MagVixFailureException("Missing parameter: report template.");
            }

            if ((string.IsNullOrWhiteSpace(templateObj.TemplateSite)))
            {
                throw new MagVixFailureException("Missing parameter: site station number.");
            }

            if (string.IsNullOrWhiteSpace(templateObj.TemplateXML))
            {
                throw new MagVixFailureException("Missing parameter: template xml.");
            }

            PathologyTemplateInputType template = new PathologyTemplateInputType() { XmlTemplate = templateObj.TemplateXML };
            string URI = String.Format("pathology/template/{0}/{1}", templateObj.TemplateSite, templateObj.TemplateType);
            IRestResponse response;
            try
            {
                string body = ResponseParser.SerializeToXml<PathologyTemplateInputType>(template);
                response = ExecutePost(URI, VixServiceTypes.Pathology, body);
                ValidateRestResponse(response);
            }
            catch (MagResponseParsingFailureException rpf)
            {
                throw new MagVixFailureException("Failed to serialize report template.", rpf);
            }
            catch (MagVixFailureException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new MagVixFailureException("Could not complete request to save report template.", ex);
            }
        }
예제 #2
0
 /// <summary>
 /// Save report template back to VistA
 /// </summary>
 /// <param name="templateObj">Template object containing the template to be stored</param>
 public void SaveReportTemplate(VixReportTemplateObject templateObj)
 {
     if (vixClient != null)
     {
         vixClient.SaveReportTemplate(templateObj);
     }
     else
     {
         throw new MagVixFailureException("VIX client is null.");
     }
 }