Ejemplo n.º 1
0
        public NotifyOperationResult SendNotification(NotificationEvent notificationEvent, out int returnStatus)
        {
            returnStatus = 0;
            NotifyOperationResult result;

            try
            {
                string[] _gatewayParams = notificationEvent.NotificationChannelInfo.ChannelBaseParameters.Split(new char[]
                {
                    '|'
                });
                if (MSMQHELPER.sendMQMessage(_gatewayParams[0], _gatewayParams[1], new string[]
                {
                    notificationEvent.NotificationDestination,
                    notificationEvent.NotificationMessageSubject,
                    notificationEvent.NotificationMessageContent,
                    notificationEvent.NotificationFrom,
                    "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/"
                }))
                {
                    SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "EMAILCONNECTOR", new string[]
                    {
                        "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/",
                        "[OK] Message sended to destination:" + notificationEvent.NotificationDestination.Trim()
                    });
                    result = NotifyOperationResult.Success;
                }
                else
                {
                    SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.ERROR, "EMAILCONNECTOR", new string[]
                    {
                        "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/",
                        "[NOK] Error wile send message to destination:" + notificationEvent.NotificationDestination.Trim()
                    });
                    result = NotifyOperationResult.Error;
                }
            }
            catch (Exception ex)
            {
                SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.EXCEPTION, "EMAILCONNECTOR", new string[]
                {
                    "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/",
                    "[NOK] Error wile send message to destination:" + notificationEvent.NotificationDestination.Trim(),
                    ex.ToString()
                });
                result = NotifyOperationResult.Error;
            }
            return(result);
        }
Ejemplo n.º 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();
                }
                if (mMSG != null)
                {
                    mMSG.Dispose();
                }
                _mq  = null;
                mMSG = null;
            }
            return(result);
        }