Esempio n. 1
0
        /// <summary>
        /// Process response for request details.
        /// </summary>
        /// <param name="strResponse">Response received from request for TOR detail.</param>
        /// <returns>Response object.</returns>
        private Response ProcessSwapShiftResponse(string strResponse)
        {
            XDocument xDoc      = XDocument.Parse(strResponse);
            var       xResponse = xDoc.Root.Descendants().FirstOrDefault(d => d.Name.LocalName.Equals(ApiConstants.Response, StringComparison.Ordinal));

            return(XmlConvertHelper.DeserializeObject <Response>(xResponse.ToString()));
        }
Esempio n. 2
0
        /// <summary>
        /// Read the xml response into Response object.
        /// </summary>
        /// <param name="strResponse">xml response string.</param>
        /// <returns>Response object.</returns>
        public Response.Response ProcessResponse(string strResponse)
        {
            XDocument xDoc      = XDocument.Parse(strResponse);
            var       xResponse = xDoc.Root.Descendants().FirstOrDefault(d => d.Name.LocalName.Equals(ApiConstants.Response));

            return(XmlConvertHelper.DeserializeObject <Response.Response>(xResponse.ToString()));
        }
Esempio n. 3
0
        public Models.ResponseEntities.PersonInformation.Response ProcessPIResponse(string strResponse)
        {
            XDocument xDoc      = XDocument.Parse(strResponse);
            var       xResponse = xDoc.Root.Descendants().FirstOrDefault(d => d.Name.LocalName.Equals(ApiConstants.Response));

            return(XmlConvertHelper.DeserializeObject <Models.ResponseEntities.PersonInformation.Response>(xResponse.ToString()));
        }
        private Models.ResponseEntities.OpenShiftRequest.ApproveDecline.Response ProcessOpenShiftsApprovedDeclinedResponse(string strResponse)
        {
            XDocument xDoc      = XDocument.Parse(strResponse);
            var       xResponse = xDoc.Root.Descendants().FirstOrDefault(d => d.Name.LocalName.Equals(ApiConstants.Response, StringComparison.Ordinal));

            return(XmlConvertHelper.DeserializeObject <Models.ResponseEntities.OpenShiftRequest.ApproveDecline.Response>(
                       xResponse.ToString()));
        }
Esempio n. 5
0
        public WXReqBaseMsg GetRequest(string postStr)
        {
            //XML文档处理对象
            XmlDocument postObj = new XmlDocument();

            //加载xml格式请求数据
            postObj.LoadXml(postStr);

            //获取xml结构根目录
            XmlElement postElement = postObj.DocumentElement;

            //获取请求消息类型
            string msgtype = postElement.SelectSingleNode("MsgType").InnerText;

            WXReqBaseMsg entitybase = null;

            //判断接收消息类型
            switch (msgtype)
            {
            //文本消息
            case WXReqMsgType.text:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqTextMsg>(postStr);
                break;

            //图片消息
            case WXReqMsgType.image:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqImageMsg>(postStr);
                break;

            //语音消息
            case WXReqMsgType.voice:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqVoiceMsg>(postStr);
                break;

            //视频消息
            case WXReqMsgType.video:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqVideoMsg>(postStr);
                break;

            //地理位置消息
            case WXReqMsgType.location:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqLocationMsg>(postStr);
                break;

            //链接消息
            case WXReqMsgType.url:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqLinkMsg>(postStr);
                break;

            //事件消息
            case WXReqMsgType.wxevent:
                entitybase = XmlConvertHelper.DeserializeObject <WXReqEventMsg>(postStr);
                break;
            }
            return(entitybase);
        }
Esempio n. 6
0
        /// <summary>
        /// Process response class.
        /// </summary>
        /// <param name="strResponse">String response.</param>
        /// <returns>Process response.</returns>
        private Response ProcessResponse(string strResponse)
        {
            var telemetryProps = new Dictionary <string, string>()
            {
                { "AssemblyName", Assembly.GetExecutingAssembly().FullName },
            };

            this.telemetryClient.TrackTrace(MethodBase.GetCurrentMethod().Name, telemetryProps);

            XDocument xDoc      = XDocument.Parse(strResponse);
            var       xResponse = xDoc.Root.Descendants().FirstOrDefault(d => d.Name.LocalName.Equals(ApiConstants.Response, StringComparison.Ordinal));

            return(XmlConvertHelper.DeserializeObject <Response>(xResponse.ToString()));
        }
Esempio n. 7
0
        /// <summary>
        /// 获取推送的调用凭据
        /// </summary>
        /// <returns></returns>
        public WXOpenCmptVerifyTicket GetCmptVerifyTicket()
        {
            using (ISession s = SessionFactory.Instance.CreateSession())
            {
                //当前凭据参数是否存在
                WXOpenAuth entity = s.Get <WXOpenAuth>("where auth_key = @0 ", WXOpenAuthKey.cmpt_verify_ticket.ToString());
                if (entity != null)
                {
                    return(XmlConvertHelper.DeserializeObject <WXOpenCmptVerifyTicket>(entity.val));
                }

                return(null);
            }
        }