コード例 #1
0
        public static void QueueDeliveryReport(DeliveryReport dlr)
        {
            MessageQueue _mq = null;

            _mq           = new MessageQueue(InboundQueueName);
            _mq.Formatter = new BinaryMessageFormatter();

            if (dlr.MessageId == null || dlr.MessageId == "")
            {
                throw new Exception("Empty MessageId in delivery report.\nMSIDN : " + dlr.MSISDN + "\nDlr Status : " + dlr.DlrStatus.ToString() + "\nResult Code : " + dlr.ResultCode + "\nResult Code Description : " + dlr.ResultDescription);
            }

            Message qmsg = new Message(dlr, new BinaryMessageFormatter());

            qmsg.Recoverable = true;
            qmsg.Priority    = MessagePriority.Low;
            qmsg.Label       = "DeliveryReport";
            _mq.Send(qmsg);
            qmsg.Dispose();
        }
コード例 #2
0
        public static string QueryStringFromMsg(DeliveryReport dr)
        {
            string qs = "";

            qs += "dlrstatus=" + HttpUtility.UrlEncode(dr.DlrStatus.ToString(), Encoding.UTF8) + "&";
            qs += "msgid=" + HttpUtility.UrlEncode(dr.MessageId, Encoding.UTF8) + "&";
            if (dr.MSISDN != null)
            {
                qs += "msisdn=" + HttpUtility.UrlEncode(dr.MSISDN, Encoding.UTF8) + "&";
            }
            if (dr.ResultCode != null)
            {
                qs += "rescode=" + HttpUtility.UrlEncode(dr.ResultCode, Encoding.UTF8) + "&";
            }
            if (dr.ResultDescription != null)
            {
                qs += "resdesc=" + HttpUtility.UrlEncode(dr.ResultDescription, Encoding.UTF8) + "&";
            }
            qs.TrimEnd(new char[] { '&' });
            return(qs);
        }