/// <summary> /// 酒店价格计划佣金缓存查询 /// </summary> /// <param name="hotelCode"></param> static void CreateRateplanCommCacheRQRequest(string hotelCode) { EyouSoft.HotelBI.AvailCache.MRateplanCommCacheRQInfo info = new EyouSoft.HotelBI.AvailCache.MRateplanCommCacheRQInfo(); info.HotelCode = hotelCode; 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); }
/// <summary> /// 载入酒店价格计划佣金信息 /// </summary> /// <param name="hotelId">酒店编号</param> /// <param name="hotelCode">酒店代码</param> private void LoadHotelRatePlanComm(string hotelId, string hotelCode) { Console.WriteLine("正在载入酒店" + hotelCode + "价格计划佣金信息"); EyouSoft.HotelBI.AvailCache.MRateplanCommCacheRQInfo info = new EyouSoft.HotelBI.AvailCache.MRateplanCommCacheRQInfo(); info.HotelCode = hotelCode; string xml = string.Empty; try { xml = EyouSoft.HotelBI.Utils.CreateRequest(info.RequestXML, true); } catch (Exception e) { CreateFile("HttpRequestRatePlanCommError.txt", e.Message + e.StackTrace + "\n" + info.RequestXML + "\n", true); return; } if (string.IsNullOrEmpty(xml)) { Console.WriteLine("酒店" + hotelCode + "价格计划佣金信息请求返回的XML数据为空"); CreateFile("HttpRequestRatePlanCommError.txt", "价格计划佣金信息请求返回的XML数据为空" + info.RequestXML + "\n", true); return; } SqlParameter parm = new SqlParameter("@HotelId", SqlDbType.Char); parm.Value = hotelId; Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, SQL_DELETE_HotelRateComm, parm); try { XElement xResponse = XElement.Parse(xml); XElement xRatePlanCommRS = Utils.GetXElement(xResponse, "RatePlanCommRS"); XElement xRatePlanCommsRoot = Utils.GetXElement(xRatePlanCommRS, "RatePlanComms"); var xRatePlanComms = Utils.GetXElements(xRatePlanCommsRoot, "RatePlanComm"); SqlParameter[] parms = { new SqlParameter("@HotelId", SqlDbType.Char), new SqlParameter("@RatePlanCode", SqlDbType.Char), new SqlParameter("@VendorCode", SqlDbType.Char), new SqlParameter("@StartDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime), new SqlParameter("@Percent", SqlDbType.Decimal), new SqlParameter("@Fix", SqlDbType.Money), new SqlParameter("@Commisiontype", SqlDbType.Char), new SqlParameter("@RoomTypeCode", SqlDbType.Char), }; parms[0].Value = hotelId; foreach (var xRatePlanComm in xRatePlanComms) { string roomTypeCode = Utils.GetXElement(xRatePlanComm, "RoomTypeCode").Value; string ratePlanCode = Utils.GetXElement(xRatePlanComm, "RatePlanCode").Value; string vendorCode = Utils.GetXElement(xRatePlanComm, "VendorCode").Value; DateTime startDate = Utils.GetDateTime(Utils.GetXElement(xRatePlanComm, "StartDate").Value); DateTime endDate = Utils.GetDateTime(Utils.GetXElement(xRatePlanComm, "EndDate").Value); decimal percent = Utils.GetDecimal(Utils.GetXElement(xRatePlanComm, "Percent").Value); decimal fix = Utils.GetDecimal(Utils.GetXElement(xRatePlanComm, "Fix").Value); string commisiontype = Utils.GetXElement(xRatePlanComm, "Commisiontype").Value; parms[1].Value = ratePlanCode; parms[2].Value = vendorCode; parms[3].Value = startDate; parms[4].Value = endDate; parms[5].Value = percent; parms[6].Value = fix; parms[7].Value = commisiontype; parms[8].Value = roomTypeCode; Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, SQL_INSERT_HotelRateComm, parms); } } catch (Exception e) { CreateFile("ParseRatePlanCommXMLError.txt", e.Message + e.StackTrace + "\n" + xml + "\n", true); return; } }