/// <summary> /// Save new and update existing reading site. /// </summary> /// <param name="siteStationNumber">Site where the data will be stored at.</param> /// <param name="readingSite">Reading site data to be stored.</param> public void SaveReadingSite(string siteStationNumber, PathologyReadingSiteType readingSite) { Log.Debug("Saving reading site to VistA..."); if (string.IsNullOrWhiteSpace(siteStationNumber)) { throw new MagVixFailureException("Missing parameter: site station number."); } if (readingSite == null) { throw new MagVixFailureException("Missing parameter: reading site."); } string URI = String.Format("pathology/reading/{0}", siteStationNumber); IRestResponse response; try { string requestBody = ResponseParser.SerializeToXml<PathologyReadingSiteType>(readingSite); response = ExecutePost(URI, VixServiceTypes.Pathology, requestBody); ValidateRestResponse(response); } catch (MagResponseParsingFailureException rpf) { throw new MagVixFailureException("Could not serialize reading site object.", rpf); } catch (MagVixFailureException) { throw; } catch (Exception ex) { throw new MagVixFailureException("Could not complete request to save reading site.", ex); } }
/// <summary> /// Removing a reading site from the reading site list in VistA /// </summary> /// <param name="siteStationNumber">Site where the data will be removed from.</param> /// <param name="readingSite">Reading site data being removed.</param> public void RemoveReadingSite(string siteStationNumber, PathologyReadingSiteType readingSite) { if (vixClient != null) { vixClient.RemoveReadingSite(siteStationNumber, readingSite); } else { throw new MagVixFailureException("VIX client is null."); } }