示例#1
0
 public TriggerOperation(MessageInfo msg)
     : base(msg, TriggerType.Operation)
 {
     OnlyOneUse = true;
     var cond = new Condition(MessageInfo.GetOperationFromNPU(msg.CorrelationNPU) , "npu", EnumCondition.LIKE);
     AddCondition(cond);
 }
示例#2
0
 public TriggerForm(MessageInfo msg, Trigger t)
 {
     InitializeComponent();
     _msg = msg;
     Trigger = t;
     LoadTrigger();
 }
示例#3
0
        public bool isTriggerOperation(MessageInfo msg)
        {
            var operation = msg.Operation;
            var operationCorr = MessageInfo.GetOperationFromNPU(this.Message.CorrelationNPU);

            if (operation == operationCorr)
                return true;

            return false;
        }
示例#4
0
 public void AddMessage(MessageInfo msg)
 {
     if (this.receivedMsgControl1.InvokeRequired)
     {
         var a = new OnAddMessage(AddMessage);
         this.Invoke(a, new object[] { msg });
     }
     else
     {
         this.receivedMsgControl1.AddMessage(msg);
     }
 }
示例#5
0
        internal static MessageSent ReplyGPError(MessageInfo msg)
        {
            var e0 = Utils.GetResourceTextFile("GR_E0.xml");

            var npu = createNpu("GENREPIRTO", "0025");
            e0 = string.Format(e0, npu, msg.NPU);

            var msgSent = new MessageSent();
            msgSent.Msg = msg;
            msgSent.NPU = npu;
            msgSent.Date = DateTime.Now;
            msgSent.Send = e0;

            CommunicationWS.SendMessage(msgSent, Configuration.UrlReturn, "http://telecom.pt/ptMsgInt/2009/12/16/in/pubMsgReport");

            return msgSent;
        }
示例#6
0
 public override bool RunTrigger(MessageInfo msg, List<MessageInfo> received, bool triggerFired)
 {
     return true;
 }
示例#7
0
 public TriggerNone(MessageInfo msg)
     : base(msg, TriggerType.None)
 {
     OnlyOneUse = true;
 }
示例#8
0
        internal static MessageSent SendMsg(MessageInfo msg, string url = null)
        {
            if(url == null){
                url = CommunicationWS.GetUrl(msg.InterfaceToInvoke);
            }

            var soapEnv = Utils.GetResourceTextFile("soapEnv.xml");
            var bodyMsg = string.Format(soapEnv, msg.Payload);

            var messageSent = new MessageSent();

            messageSent.Date = DateTime.Now;
            messageSent.Msg = msg;
            messageSent.Send = bodyMsg;

            CommunicationWS.SendMessage(messageSent, url, CommunicationWS.GetSoapAction(msg.InterfaceToInvoke, msg.Operation));

            return messageSent;
        }
示例#9
0
 public void AddMessage(MessageInfo msg)
 {
     _Queue.Enqueue(msg);
 }
示例#10
0
        private static XmlDocument ProcessXML(string str, MessageInfo msg)
        {
            try
            {
                var xml = new XmlDocument();
                xml.LoadXml(str);

                XmlNamespaceManager nsmgr = new XmlNamespaceManager(xml.NameTable);

                var npu = xml.SelectSingleNode(".//*[local-name()='npu']");
                var corr = xml.SelectSingleNode(".//*[local-name()='correlationNpu']");
                var processId = xml.SelectSingleNode(".//*[local-name()='processId']");
                var businessId = xml.SelectSingleNode(".//*[local-name()='processName']");

                if (npu == null)
                    npu = xml.SelectSingleNode(".//npu", nsmgr);

                if (corr == null)
                    corr = xml.SelectSingleNode(".//correlationNpu", nsmgr);

                if (processId == null)
                    processId = xml.SelectSingleNode(".//processId", nsmgr);

                if (businessId == null)
                    businessId = xml.SelectSingleNode(".//processName", nsmgr);

                if (npu != null)
                {
                    msg.NPU = npu.InnerXml;
                    msg.Operation = msg.NPU.Substring(4, 10);
                }

                if (corr != null)
                {
                    msg.CorrelationNPU = corr.InnerXml;
                }

                if (processId != null)
                {
                    msg.ProcessId = processId.InnerXml;
                }

                if (businessId != null)
                    msg.BusinessId = businessId.InnerXml;

                msg.xml = xml;

                return xml;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "ProcessXML: XML->" + str);

                msg.NPU = "empty";
                msg.Name = "Error";
                msg.Operation = "Error";
            }

            return null;
        }
示例#11
0
        public static MessageInfo LoadFromString(string str)
        {
            var msg = new MessageInfo();
            msg.Payload = str;

            str = CommunicationWS.cleanStream(str);

            msg.ReceivedDatetime = DateTime.Now;
            ProcessXML(str, msg);
            msg.Name = GetPrettyName(msg.Operation, msg.SoapAction);

            return msg;
        }
示例#12
0
        public static MessageInfo LoadFromDB(OracleDataReader reader)
        {
            var msg = new MessageInfo();

            //npu, correlationNpu, businessid, creationdate, processid, interfacetoinvoke, operation, payload

            msg.NPU = reader.GetString(0);
            msg.CorrelationNPU = reader.IsDBNull(1) ? null : reader.GetString(1);
            msg.BusinessId = reader.IsDBNull(2) ? null : reader.GetString(2);
            msg.ReceivedDatetime = reader.IsDBNull(3) ? DateTime.Now : reader.GetDateTime(3);
            msg.ProcessId = reader.IsDBNull(4) ? null : reader.GetString(4);
            msg.InterfaceToInvoke = reader.IsDBNull(5) ? null : reader.GetString(5);

            var oper = msg.NPU.Substring(4, 10);
            msg.Operation = oper;

            if (!string.IsNullOrEmpty(msg.CorrelationNPU))
                oper = msg.CorrelationNPU.Substring(4, 10);

            msg.Name = GetPrettyName(oper, null);

            var blob = reader.GetOracleBlob(7);

            var sb = new StringBuilder();

            var buffer = new byte[1000];

            while ((blob.Read(buffer, 0, buffer.Length)) > 0)
            {

                sb.Append(Encoding.UTF8.GetString(buffer));
                Array.Clear(buffer, 0, buffer.Length);

            }

            msg.Payload = sb.ToString().Trim('\0');

            return msg;
        }
示例#13
0
 public DetailsMsg(MessageInfo msg)
 {
     InitializeComponent();
     _message = msg;
     FillForm();
 }
示例#14
0
 public TriggerCustom(MessageInfo msg)
     : base(msg, TriggerType.Custom)
 {
     this.RunOnReceivedMsg = true;
 }