public SiteTO getSite(string sitecode) { SiteTO result = new SiteTO(); if (sitecode == "") { result.fault = new FaultTO("No sitecode!"); } else if (sitecode.Length != 3 || !StringUtils.isNumeric(sitecode)) { result.fault = new FaultTO("Invalid sitecode"); } if (result.fault != null) { return(result); } Site s = mySession.SiteTable.getSite(sitecode); if (s == null) { result.fault = new FaultTO("No such site!"); return(result); } return(new SiteTO(s)); }
public void testConnectAndLogin() { RegionArray siteTable = _dao.getSites(); SiteTO selectedSite = null; // placeholder // we already know our site code but, just for completeness, showing walking through the region array here // the VA organizes itself logically and geographically by regions and sites. "regions" is roughly what // we term internally as VISNs. There are 23 VISNs in VA - Ann Arbor is in VISN 11. Since MDWS uses this organization // for other things, we modified the terminology slightly // This first foreach loop goes through all the regions in the site table - in our test environment we only have one region foreach (RegionTO region in siteTable.regions) { if (region.sites != null && region.sites.sites != null && region.sites.sites.Length > 0) { foreach (SiteTO site in region.sites.sites) { if (site.sitecode == "100") // we chose a really difficult way of finding our site! { selectedSite = site; break; } } } if (selectedSite != null) { break; } } UserTO user = _dao.connectAndLogin(selectedSite.sitecode, _accessCode, _verifyCode); Assert.IsNull(user.fault); }
public SiteTO addDataSource(string sitecode, string siteName, string hostname, string brokerPort, string visn) { SiteTO result = _emrSvc.addDataSource(sitecode, siteName, hostname, brokerPort, "HIS", "VISTA", visn); if (result.fault != null) { throw new ApplicationException(result.fault.message); } return(result); }
public SiteTO patientVisit(string pwd, string sitecode, string mpiPid) { SiteTO result = new SiteTO(); if (mySession == null || mySession.SiteTable == null) { result.fault = new FaultTO("No session has been started"); } else if (sitecode == "") { result.fault = new FaultTO("No sitecode"); } else if (mySession.SiteTable.getSite(sitecode) == null) { result.fault = new FaultTO("No site " + sitecode + " in the site table"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.HasConnection(sitecode)) { result.fault = new FaultTO("Site " + sitecode + " already connected"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0) { result.fault = new FaultTO("This session has pre-existing connections and this method should be the base connection.", "Do a disconnect?"); } else if (mpiPid == "") { result.fault = new FaultTO("No MPI PID"); } if (result.fault != null) { return(result); } SiteArray sa = patientVisit(pwd, sitecode, mpiPid, false); if (sa.fault == null) { result.fault = sa.fault; } else if (sa.sites.Length == 0) { result.fault = new FaultTO("Unable to connect to site " + sitecode); } else { result = sa.sites[0]; } return(result); }
public SiteTO addSite(string id, string name, string datasource, string port, string modality, string protocol, string region) { SiteTO result = new SiteTO(); Site site = new Site(); DataSource source = new DataSource(); int iPort = 0; int iRegion = 0; if (!mySession.MdwsConfiguration.IsProduction) { result.fault = new FaultTO("You may not add data sources to non-production MDWS installations"); } else if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(name) || String.IsNullOrEmpty(datasource) || String.IsNullOrEmpty(port) || String.IsNullOrEmpty(modality) || String.IsNullOrEmpty(protocol) || String.IsNullOrEmpty(region)) { result.fault = new FaultTO("Must supply all parameters"); } else if (mySession.SiteTable.Sites.ContainsKey(id)) { result.fault = new FaultTO("That site id is in use", "Choose a different site id"); } else if (!Int32.TryParse(port, out iPort)) { result.fault = new FaultTO("Non-numeric port", "Provide a numeric value for the port"); } else if (!Int32.TryParse(region, out iRegion)) { result.fault = new FaultTO("Non-numeric region", "Provide a numeric value for the region"); } else if (modality != "HIS") { result.fault = new FaultTO("Only HIS modality currently supported", "Use 'HIS' as your modality"); } else if (protocol != "VISTA") { result.fault = new FaultTO("Only VISTA protocol currently supported", "Use 'VISTA' as your protocol"); } if (result.fault != null) { return(result); } source.Port = iPort; source.Modality = modality; source.Protocol = protocol; source.Provider = datasource; source.SiteId = new SiteId(id, name); site.Sources = new DataSource[1]; site.Sources[0] = source; site.RegionId = region; site.Name = name; site.Id = id; if (!mySession.SiteTable.Regions.ContainsKey(iRegion)) { Region r = new Region(); r.Id = iRegion; r.Name = "Region " + region; r.Sites = new ArrayList(); mySession.SiteTable.Regions.Add(iRegion, r); } ((Region)mySession.SiteTable.Regions[iRegion]).Sites.Add(site); mySession.SiteTable.Sites.Add(id, site); mySession.SiteTable.Sources.Add(site.Sources[0]); result = new SiteTO(site); return(result); }