Esempio n. 1
0
        /// <summary>
        /// poziva se kad stigne Result Repor poruka
        /// </summary>
        /// <param name="e"></param>
        protected void OnResultReportMessage(MessageReceiveEventArgs e)
        {
            log.Debug("Protocol:OnResultReportMessage");

            try
            {
                if (ResultReportMessage != null)
                    ResultReportMessage(this, e);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Message handler koji se poziva kad stigne result report poruka
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ResultReportMessageHandler(object sender, MessageReceiveEventArgs e)
        {
            try
            {
                log.Debug("Host:ResultReportMessageHandler");

                IEncoder encoder = new astm.protocol.encoder.Encoder();
                string poruka = encoder.EncodeMessage(e.Message);

                log.Info("[Poruka-start]");
                log.Info(String.Format(poruka.Replace("\r", "[CR]\r").Replace("\n", "[LF]\n")));
                log.Info("[Poruka-end]");

                _protocol.OutputResults.Add(e.Message);

            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                smtpLog.Error(ex.ToString());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// poziva se kad stigne Order Test Request poruka
        /// </summary>
        /// <param name="e"></param>
        protected void OnOrderTestRequestMessage(MessageReceiveEventArgs e)
        {
            log.Debug("Protocol:OnOrderTestRequestMessage");

            try
            {
                if (OrderTestRequestMessage != null)
                    OrderTestRequestMessage(this, e);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                throw;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// message handler koji se poziva kad stigne inquiry test request poruka
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InquiryTestRequestMessageHandler(object sender, MessageReceiveEventArgs e)
        {
            //TODO: check message termination code
            try
            {
                log.Debug("Host:InquiryTestRequestMessageHandler");

                if (_protocol_mode == Mode.RealTime)
                {
                    //TestOrder? order = ((FileDispatcher)_protocol.CommandDispatcher).GetOrderFromFile(e.Message.GetRequestInformation().StartingRange[2].GetValue().ToString(), Path.Combine(_file_dispatcher_path, DateTime.Now.ToString("ddMMyyyy") + "." + _file_dispatcher_out_extension));
                    TestOrder? order = ((FileDispatcher)_protocol.CommandDispatcher).GetOrderFromFiles(e.Message.GetRequestInformation().StartingRange[2].GetValue().ToString(), _file_dispatcher_path, 2);
                    if (order != null)
                    {
                        ICommand command = new TestRequestCommand((string)e.Message.GetRequestInformation().StartingRange[2].GetValue(),
                                                                e.Message.GetRequestInformation().Sequence,
                                                                (int)e.Message.GetRequestInformation().StartingRange[3].GetValue(),
                                                                (string)e.Message.GetRequestInformation().StartingRange[4].GetValue(),
                                                                (int)e.Message.GetRequestInformation().StartingRange[5].GetValue(),
                                                                order.Value.Tests, false);

                        _protocol.InputCommand.Add(command);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                smtpLog.Error(ex.ToString());
            }
        }