Example #1
0
        public void Export(APPEVENTSDeff appEVENTSDeff, int appEventID, string appBASEMODULE, string[] appMESSAGES, out object returnValue)
        {
            returnValue = null;
            string __mqParams = ConfigurationManager.AppSettings.Get("SAFEXPORTEVENTS_MSMQPATH");

            if (__mqParams != null && (__mqParams ?? "").Length >= 1)
            {
                string[] _gatewayParams = __mqParams.Split(new char[]
                {
                    '|'
                });
                if (_gatewayParams.Length >= 2)
                {
                    string[] arrExport = (appMESSAGES != null) ? new string[appMESSAGES.Length + 2] : new string[0];
                    try
                    {
                        if (APPEVENTSDeff.GENERIC_EVENTS == appEVENTSDeff)
                        {
                            appMESSAGES.CopyTo(arrExport, 0);
                            arrExport.SetValue(appBASEMODULE, appMESSAGES.Length);
                            arrExport.SetValue(appEventID.ToString(), appMESSAGES.Length + 1);
                            MSMQHELPER.sendMQMessage(_gatewayParams[0], _gatewayParams[1], arrExport);
                        }
                    }
                    finally
                    {
                    }
                }
            }
        }
Example #2
0
        public static bool sendMQMessage(string msmqMachine, string msmqPath, string[] msmqSMSMSG)
        {
            MessageQueue _mq  = null;
            Message      mMSG = null;
            bool         result;

            try
            {
                _mq = MSMQHELPER.GetPrivateQueue(msmqMachine, msmqPath);
                if (null == _mq)
                {
                    result = false;
                }
                else
                {
                    mMSG            = new Message();
                    mMSG.BodyStream = MSMQHELPER.SerializeMessage(msmqSMSMSG);
                    _mq.Send(mMSG);
                    result = true;
                }
            }
            catch
            {
                result = false;
            }
            finally
            {
                if (_mq != null)
                {
                    _mq.Close();
                    _mq.Dispose();
                    _mq = null;
                }
                if (mMSG != null)
                {
                    mMSG.Dispose();
                    mMSG = null;
                }
            }
            return(result);
        }