コード例 #1
0
ファイル: CtripBaseApiCall.cs プロジェクト: szwork2013/travel
        /// <summary>
        /// 获取接口请求结果
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <returns></returns>
        protected void GetHeaderResult(XmlDocument xmlDoc,CtripBaseAPIReturnEntity returnEntity)
        {
            
            try
            {
                XmlElement headerNode = (XmlElement)xmlDoc.SelectSingleNode("Response/Header");
                
                string ShouldRecordPerformanceTime = headerNode.GetAttribute("ShouldRecordPerformanceTime");
                string timestamp = headerNode.GetAttribute("Timestamp");
                string ReferenceID = headerNode.GetAttribute("ReferenceID");
                string RecentlyTime = headerNode.GetAttribute("RecentlyTime");
                string AccessCount = headerNode.GetAttribute("AccessCount");
                string CurrentCount = headerNode.GetAttribute("CurrentCount");
                string ResetTime = headerNode.GetAttribute("ResetTime");
                string ResultCode = headerNode.GetAttribute("ResultCode");
                string ResultMsg = string.IsNullOrEmpty(headerNode.GetAttribute("ResultMsg")) ? "" : headerNode.GetAttribute("ResultMsg").Trim();
                string ResultNo = string.IsNullOrEmpty(headerNode.GetAttribute("ResultCode")) ? "" : headerNode.GetAttribute("ResultCode").Trim();
                
                CtripApiReturnHeaderInfo headerInfo = new CtripApiReturnHeaderInfo(ReferenceID, ResultCode, ResultNo, ResultMsg, timestamp);
                headerInfo.ShouldRecordPerformanceTime = ShouldRecordPerformanceTime;
                headerInfo.AccessCount = !string.IsNullOrWhiteSpace(headerNode.GetAttribute("AccessCount"))?Convert.ToInt32(headerNode.GetAttribute("AccessCount").Trim()):0;
                headerInfo.CurrentCount = !string.IsNullOrWhiteSpace(headerNode.GetAttribute("CurrentCount")) ? Convert.ToInt32(headerNode.GetAttribute("CurrentCount").Trim()) : 0;
                headerInfo.ResetTime = !string.IsNullOrWhiteSpace(headerNode.GetAttribute("ResetTime")) ? headerNode.GetAttribute("ResetTime").Trim() : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");
                headerInfo.RecentlyTime = !string.IsNullOrWhiteSpace(headerNode.GetAttribute("RecentlyTime")) ? headerNode.GetAttribute("RecentlyTime").Trim() : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");

                returnEntity.GetReturnHeaderInfo(headerInfo);

            }
            catch
            {
                throw;
            }
            
        }
コード例 #2
0
 /// <summary>
 /// 赋值
 /// </summary>
 /// <param name="headerInfo"></param>
 public void GetReturnHeaderInfo(CtripApiReturnHeaderInfo headerInfo)
 {
     HeaderInfo = headerInfo;
 }
コード例 #3
0
 /// <summary>
 /// 赋值
 /// </summary>
 /// <param name="headerInfo"></param>
 public void GetReturnHeaderInfo(CtripApiReturnHeaderInfo headerInfo)
 {
     HeaderInfo = headerInfo;
 }
コード例 #4
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public CtripBaseAPIReturnEntity()
 {
     ValidateResult = true;
     HeaderInfo = new CtripApiReturnHeaderInfo();
 }
コード例 #5
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public CtripBaseAPIReturnEntity()
 {
     ValidateResult = true;
     HeaderInfo     = new CtripApiReturnHeaderInfo();
 }