public string SendBatchMessages(Models.SendHL7ViewModel model) { var tcpSender = new HL7_TCP.TcpSender { DestinationServer = model.DestinationServer, DestinationPort = model.DestinationPort.Value }; if (tcpSender.DestinationTestConnect()) { TcpSendResults results = SendMessages(model, tcpSender); if (results.ExceptionDuringSend.IsNullOrEmpty()) { return "Successfully sent {0} message{2} to {1}.\r\nTotal time taken: {3}".FormatWith(model.NumMessages, model.DestinationDetails, (results.NumberMsgsSent > 1) ? "s" : "", results.TimeElapsed.ToReadableString()); } else { return "We had a problem sending message {0} to {1}. {2}".FormatWith(results.NumberMsgsSent + 1, model.DestinationDetails, results.ExceptionDuringSend); } } else { return "Couldn't make a connection to {0}.".FormatWith(model.DestinationDetails); } }
public string SendBatchMessages(Models.SendHL7ViewModel model) { var tcpSender = new HL7_TCP.TcpSender { DestinationServer = model.DestinationServer, DestinationPort = model.DestinationPort.Value }; if (tcpSender.DestinationTestConnect()) { TcpSendResults results = SendMessages(model, tcpSender); if (results.ExceptionDuringSend.IsNullOrEmpty()) { return("Successfully sent {0} message{2} to {1}.\r\nTotal time taken: {3}".FormatWith(model.NumMessages, model.DestinationDetails, (results.NumberMsgsSent > 1) ? "s" : "", results.TimeElapsed.ToReadableString())); } else { return("We had a problem sending message {0} to {1}. {2}".FormatWith(results.NumberMsgsSent + 1, model.DestinationDetails, results.ExceptionDuringSend)); } } else { return("Couldn't make a connection to {0}.".FormatWith(model.DestinationDetails)); } }