/// <summary> /// 地标信息 /// </summary> /// <param name="cityCode">城市代码</param> private void LoadLandMarkPOR(string cityCode) { Console.WriteLine("正在加载" + cityCode + "地标信息"); EyouSoft.HotelBI.AvailCache.MLandMarkSearchRQInfo info = new EyouSoft.HotelBI.AvailCache.MLandMarkSearchRQInfo(); info.CityCode = cityCode; info.LandMarkType = EyouSoft.HotelBI.LandMarkSearchType.POR; string xml = xml = EyouSoft.HotelBI.Utils.CreateRequest(info.RequestXML, true); if (string.IsNullOrEmpty(xml)) { Console.WriteLine(cityCode + "地标信息加载失败,请求返回的XML数据为空"); return; } XElement xResponse = XElement.Parse(xml); XElement xLandMarkSearchRS = xResponse.Element("LandMarkSearchRS"); XElement xLandMarks = EyouSoft.HotelBI.Utils.GetXElement(xLandMarkSearchRS, "LandMarks"); var xLandMarkInfos = EyouSoft.HotelBI.Utils.GetXElements(xLandMarks, "LandMarkInfo"); foreach (var xLandMarkInfo in xLandMarkInfos) { string landMarkName = EyouSoft.HotelBI.Utils.GetXElement(xLandMarkInfo, "LandMarkName").Value; string hotels = EyouSoft.HotelBI.Utils.GetXElement(xLandMarkInfo, "Hotels").Value; string[] hotelCodes = hotels.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (hotelCodes == null || hotelCodes.Length < 1) { continue; } SqlParameter[] parms = { new SqlParameter("@HotelCode", DbType.String), new SqlParameter("@LandMarkType", DbType.Byte), new SqlParameter("@CityCode", DbType.String), new SqlParameter("@LandMarkName", DbType.String) }; foreach (string hotelCode in hotelCodes) { parms[0].Value = hotelCode; parms[1].Value = EyouSoft.HotelBI.LandMarkSearchType.POR; parms[2].Value = cityCode; parms[3].Value = landMarkName; Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, SQL_INSERT_HotelLandMark, parms); } } }
/// <summary> /// 地标行政区查询缓存指令 /// </summary> /// <param name="cityCode"></param> /// <param name="type"></param> static void CreateLandMarkSearchRQRequest(string cityCode, EyouSoft.HotelBI.LandMarkSearchType type) { EyouSoft.HotelBI.AvailCache.MLandMarkSearchRQInfo info = new EyouSoft.HotelBI.AvailCache.MLandMarkSearchRQInfo(); info.CityCode = cityCode; info.LandMarkType = type; System.Diagnostics.Stopwatch stop = new System.Diagnostics.Stopwatch(); stop.Reset(); stop.Start(); Console.WriteLine(info.RequestXML); string s = EyouSoft.HotelBI.Utils.CreateRequest(info.RequestXML, true); Console.WriteLine(s); stop.Stop(); Console.WriteLine("执行时间:" + stop.ElapsedMilliseconds); }