Exemple #1
0
 private void SetUserValuesToCookie(SendHL7ViewModel model)
 {
     Cookies.SetCookie("NumMsgs", model.NumMessages);
     Cookies.SetCookie("HL7Message-", model.HL7MessageToSend.Replace(Environment.NewLine, NewLineToken));
     Cookies.SetCookie("Port", model.DestinationPort);
     Cookies.SetCookie("Server", model.DestinationServer);
 }
Exemple #2
0
        public ActionResult SendHL7Message(SendHL7ViewModel model)
        {
            if (TryValidateModel(model))
            {
                SetUserValuesToCookie(model);

                HL7Send hl7Service = new HL7Send();
                ViewBag.Message = hl7Service.SendBatchMessages(model);
            }
            return(View("Index", model));
        }
Exemple #3
0
        public TcpSendResults SendMessages(SendHL7ViewModel model, TcpSender tcpSender)
        {
            int       sendMsgCounter = 0;
            Stopwatch s = new Stopwatch();

            try
            {
                s.Start();
                for (sendMsgCounter = 0; sendMsgCounter < model.NumMessages; sendMsgCounter++)
                {
                    tcpSender.SendHL7(model.HL7MessageToSend);
                }
                s.Stop();
                return(new TcpSendResults {
                    TimeElapsed = s.Elapsed, NumberMsgsSent = sendMsgCounter
                });
            }
            catch (Exception e)
            {
                return(new TcpSendResults {
                    TimeElapsed = s.Elapsed, NumberMsgsSent = sendMsgCounter, ExceptionDuringSend = e.Message
                });
            }
        }