Exemple #1
0
        private AbandonUnicomRequestMessage InitRequest(AbandonUnicomMessage message)
        {
            AbandonUnicomRequestMessage request = new AbandonUnicomRequestMessage
            {
                Param = message
            };

            if (string.IsNullOrEmpty(request.AcctountID))
            {
                request.AcctountID = AppSettingHelper.UnicomAccountID;
            }
            if (string.IsNullOrEmpty(request.Password))
            {
                request.Password = AppSettingHelper.UnicomPassword;
            }
            if (string.IsNullOrEmpty(request.SeqNo))
            {
                request.SeqNo = BuildSeqNo();
            }
            if (string.IsNullOrEmpty(request.AgentKey))
            {
                request.AgentKey = AppSettingHelper.UnicomAgentKey;
            }
            request.ServerName = ABANDONSERVER;
            return(request);
        }
Exemple #2
0
        /// <summary>
        /// 获取指定SKU的商品信息(Quantity,Price,Description等)
        /// </summary>
        /// <param name="request">IngramRequest</param>
        /// <returns>IngramResponse</returns>
        public void HandleEvent(AbandonUnicomMessage eventMessage)
        {
            AbandonUnicomRequestMessage request = InitRequest(eventMessage);
            string strURL     = AppSettingHelper.UnicomURL;
            string reqXML     = BuildRequest(request);
            string rspXML     = null;
            string orderSysNo = eventMessage.OrderNumber;

            try
            {
                WriteLog(reqXML, orderSysNo);

                //访问Ingram服务获取批定SKU的Item信息
                rspXML = GetResponse(reqXML, strURL);

                UnicomResponseMessage response = BuildUnicomResponseMessage(rspXML);
                ValidataResponse(response);

                WriteLog(rspXML, orderSysNo);
            }
            catch (Exception ex)
            {
                WriteLog(ex.Message, orderSysNo);
            }
        }
Exemple #3
0
        private string BuildRequest(AbandonUnicomRequestMessage request)
        {
            XmlSerializer xs = new XmlSerializer(typeof(AbandonUnicomRequestMessage));

            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");

            System.IO.MemoryStream ms = new System.IO.MemoryStream();

            xs.Serialize(ms, request, ns);

            string xmlString = System.Text.UnicodeEncoding.UTF8.GetString(ms.ToArray());

            return(xmlString);
        }