public static bool SendOrder(Presc presc) { string session = Guid.NewGuid().ToString(); SQL.DoLog("SendOrder", presc.Lpu.Oid, presc.Oid.ToString(), session, presc.ToString()); Logger.Trace("SendOrder: Presc=[{0}]", presc); try { Message message = HL7Methods.CreateMessage(presc); HostPort hp = GetHostPortForLpu(presc.Lpu.Oid); using (var client = new HL7Client()) { client.Connect(hp.Host, hp.Port); var ackMessage = client.SendMessage(message.ToString()); return(true); } } catch (Exception e) { Logger.ErrorSoap(e); SQL.DoLog("SendOrder", presc.Lpu.Oid, presc.Oid.ToString(), session, e.Message); } return(false); }
public static bool CheckConnect(string host = null, int port = 0) { if (string.IsNullOrEmpty(host) || (port <= 0)) { host = endpointHostDefault; port = endpointPortDefault; } string session = Guid.NewGuid().ToString(); try { using (var client = new HL7Client()) { client.Connect(host, port); client.Close(); return(true); } } catch (Exception e) { Logger.ErrorSoap(e); SQL.DoLog("CheckConnect", null, null, session, e.Message); } return(false); }