Exemplo n.º 1
0
        public string[] GetHotelIdList(int cityCode)
        {
            StringBuilder hotelIdList    = new StringBuilder();
            var           hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
            {
                City      = cityCode,
                PageIndex = 1,
                PageSize  = 4000
            });

            if (hotelIdlistRes.Total != 0)
            {
                hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs);
                var temp = hotelIdlistRes.Total / 4000;
                for (int i = 1; i <= temp; i++)
                {
                    hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
                    {
                        City      = 2,
                        PageIndex = (i + 1),
                        PageSize  = 4000
                    }).HotelIDs);
                }
            }
            return(hotelIdList.ToString().Split(','));
        }
Exemplo n.º 2
0
        public HotelStaticInfo GetHotelInfo(string hotelId)
        {
            var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity
            {
                SearchCandidate = new SearchCandidate {
                    HotelID = hotelId
                },
                Settings = new Settings
                {
                    PrimaryLangID = "zh-cn",
                    ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo",
                                                   "HotelStaticInfo.NearbyPOIs",
                                                   "HotelStaticInfo.TransportationInfos",
                                                   "HotelStaticInfo.Brand",
                                                   "HotelStaticInfo.Group",
                                                   "HotelStaticInfo.Ratings",
                                                   "HotelStaticInfo.Policies",
                                                   "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy",
                                                   "HotelStaticInfo.AcceptedCreditCards",
                                                   "HotelStaticInfo.ImportantNotices",
                                                   "HotelStaticInfo.Facilities",
                                                   "HotelStaticInfo.Pictures",
                                                   "HotelStaticInfo.Descriptions",
                                                   "HotelStaticInfo.Themes",
                                                   "HotelStaticInfo.ContactInfo",
                                                   "HotelStaticInfo.ArrivalTimeLimitInfo",
                                                   "HotelStaticInfo.DepartureTimeLimitInfo",
                                                   "HotelStaticInfo.HotelTags.IsBookable" }
                }
            });

            return(hotelDesInfoResEntity.HotelStaticInfo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 是否为即时确认订单-即时确认订单是艺龙提高订单快速确认所提供的一项服务,当此订单为即时确认订单时,即是订单状态未变成“已确认“状态,也可以先给客人进行订单确认;
        /// </summary>
        /// <param name="orderId">三方订单Id</param>
        /// <returns></returns>
        public bool IsInstantConfirmOrder(long orderId)
        {
            InstantOrderResponse response = new InstantOrderResponse();

            try
            {
                OrderDetailCondition condition = new OrderDetailCondition()
                {
                    OrderId = orderId
                };
                var result = HotelApiAccess.Query <OrderDetailCondition, InstantOrderResponse>(condition, "hotel.order.instant");

                if (result.Code == "0")
                {
                    response = result.Result;
                }
                else
                {
                    throw new Exception("接口请求失败:" + result.Code);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response.InstantStatus == EnumInstantStatus.Instant);
        }
Exemplo n.º 4
0
        public void AddHotels(string hotelId)
        {
            var hotelDesReq = new HotelDesInfoReqEntity
            {
                SearchCandidate = new EntityModel.Proxy.CTripHotel.SearchCandidate {
                    HotelID = hotelId
                },
                Settings = new Settings
                {
                    PrimaryLangID = "zh-cn",
                    ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo",
                                                   "HotelStaticInfo.NearbyPOIs",
                                                   "HotelStaticInfo.TransportationInfos",
                                                   "HotelStaticInfo.Brand",
                                                   "HotelStaticInfo.Group",
                                                   "HotelStaticInfo.Ratings",
                                                   "HotelStaticInfo.Policies",
                                                   "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy",
                                                   "HotelStaticInfo.AcceptedCreditCards",
                                                   "HotelStaticInfo.ImportantNotices",
                                                   "HotelStaticInfo.Facilities",
                                                   "HotelStaticInfo.Pictures",
                                                   "HotelStaticInfo.Descriptions",
                                                   "HotelStaticInfo.Themes",
                                                   "HotelStaticInfo.ContactInfo",
                                                   "HotelStaticInfo.ArrivalTimeLimitInfo",
                                                   "HotelStaticInfo.DepartureTimeLimitInfo",
                                                   "HotelStaticInfo.HotelTags.IsBookable" }
                }
            };

            var resultObj = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(hotelDesReq);
            //_cTripHotelDesDal.AddHotelDesToSolr();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 订单实时状态查询
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public HotelOrderStatus GetOrderStatus(OrderDetailCondition condition)
        {
            HotelOrderStatus response = HotelOrderStatus.B3;

            try
            {
                if (!IsInstantConfirmOrder(condition.OrderId))
                {
                    var result = HotelApiAccess.Query <OrderDetailCondition, OrderDetailResponse>(condition, "hotel.order.detail");

                    if (result.Code == "0")
                    {
                        response = (HotelOrderStatus)Enum.Parse(typeof(HotelOrderStatus), result.Result.Status);
                    }
                    else
                    {
                        throw new Exception("接口请求失败:" + result.Code);
                    }
                }
                else
                {
                    response = HotelOrderStatus.A;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Exemplo n.º 6
0
        public HotelListResponseEntity Query(HotelDetailRequestEntity request)
        {
            var result = HotelApiAccess.Query <HotelDetailRequestEntity, HotelListResponseEntity>(request, "hotel.detail").Result;

            //#region 担保过滤
            //if (result.Hotels == null || (!result.Hotels.Any()))
            //{
            //    return result;
            //}
            //if (result.Hotels[0].Rooms == null || (!result.Hotels[0].Rooms.Any()))
            //{
            //    return result;
            //}
            //foreach (var room in result.Hotels[0].Rooms)
            //{
            //    if (room.RatePlans != null && room.RatePlans.Any())
            //    {
            //        room.RatePlans = room.RatePlans.Where(a => string.IsNullOrWhiteSpace(a.GuaranteeRuleIds)).ToArray();
            //    }
            //}
            //#endregion
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public bool OrderCancel(OrderCancelCondition condition)
        {
            bool response = false;

            try
            {
                var result = HotelApiAccess.Query <OrderCancelCondition, OrderCancelResponse>(condition, "hotel.order.cancel");

                if (result.Code == "0")
                {
                    response = result.Result.Successs;
                }
                else
                {
                    throw new Exception("接口请求失败:" + result.Code);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public OrderDetailResponse GetOrderDetail(OrderDetailCondition condition)
        {
            OrderDetailResponse response = new OrderDetailResponse();

            try
            {
                var result = HotelApiAccess.Query <OrderDetailCondition, OrderDetailResponse>(condition, "hotel.order.detail");

                if (result.Code == "0")
                {
                    response = result.Result;
                }
                else
                {
                    throw new Exception("接口请求失败:" + result.Code);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Exemplo n.º 9
0
 public ChangeInfoResEntity Query(ChangeInfoReqEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <ChangeInfoResEntity>(HotelApiAccess.Query <ChangeInfoReqEntity>(req, "ChangeInfo")));
 }
Exemplo n.º 10
0
 public CreditCardsResponseEntity GetAll()
 {
     return(HotelApiAccess.GetStatic <CreditCardsResponseEntity>(string.Format("{0}xml/v2.0/hotel/creditcards.xml", Configuraton.ApiGatewayConfig.URL_STATIC)));
 }
Exemplo n.º 11
0
 public string QueryStr(RoomDesInfoReqEntity req)
 {
     return(HotelApiAccess.Query(req, "RoomDesInfo"));
 }
Exemplo n.º 12
0
 public RoomDesInfoResEntity Query(RoomDesInfoReqEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <RoomDesInfoResEntity>(HotelApiAccess.Query(req, "RoomDesInfo")));
 }
Exemplo n.º 13
0
        public void UpLoadHotelListToSolr(int cityCode)
        {
            StringBuilder hotelIdList    = new StringBuilder();
            var           hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
            {
                City      = cityCode,
                PageIndex = 1,
                PageSize  = 4000
            });

            if (hotelIdlistRes.Total != 0)
            {
                hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs);
                var temp = hotelIdlistRes.Total / 4000;
                for (int i = 1; i <= temp; i++)
                {
                    hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
                    {
                        City      = 2,
                        PageIndex = (i + 1),
                        PageSize  = 4000
                    }).HotelIDs);
                }
            }
            var    hotelIdArr = hotelIdList.ToString().Split(',');
            var    hotels     = new List <HotelSimpleInfoSolrModel>();
            Random rd         = new Random();

            for (int i = 0; i < hotelIdArr.Length; i++)
            {
                var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity
                {
                    SearchCandidate = new SearchCandidate {
                        HotelID = hotelIdArr[i]
                    },
                    Settings = new Settings
                    {
                        PrimaryLangID = "zh-cn",
                        ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo",
                                                       "HotelStaticInfo.NearbyPOIs",
                                                       "HotelStaticInfo.TransportationInfos",
                                                       "HotelStaticInfo.Brand",
                                                       "HotelStaticInfo.Group",
                                                       "HotelStaticInfo.Ratings",
                                                       "HotelStaticInfo.Policies",
                                                       "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy",
                                                       "HotelStaticInfo.AcceptedCreditCards",
                                                       "HotelStaticInfo.ImportantNotices",
                                                       "HotelStaticInfo.Facilities",
                                                       "HotelStaticInfo.Pictures",
                                                       "HotelStaticInfo.Descriptions",
                                                       "HotelStaticInfo.Themes",
                                                       "HotelStaticInfo.ContactInfo",
                                                       "HotelStaticInfo.ArrivalTimeLimitInfo",
                                                       "HotelStaticInfo.DepartureTimeLimitInfo",
                                                       "HotelStaticInfo.HotelTags.IsBookable" }
                    }
                });
                var hotelStaticInfo = hotelDesInfoResEntity.HotelStaticInfo;
                if (hotelStaticInfo != null)
                {
                    hotels.Add(new HotelSimpleInfoSolrModel
                    {
                        HotelId              = hotelStaticInfo.HotelId,
                        HotelName            = hotelStaticInfo.HotelName,
                        HotelNameEN          = hotelStaticInfo.HotelNameEN,
                        StarRating           = hotelStaticInfo.StarRating,
                        Price                = rd.Next(100, 1000),
                        CityCode             = hotelStaticInfo.GeoInfo.City?.Code,
                        CityName             = hotelStaticInfo.GeoInfo.City?.Name,
                        AreaCode             = hotelStaticInfo.GeoInfo.Area?.Code,
                        AreaName             = hotelStaticInfo.GeoInfo.Area?.Name,
                        PostalCode           = string.IsNullOrWhiteSpace(hotelStaticInfo.GeoInfo.PostalCode) ? null : hotelStaticInfo.GeoInfo.PostalCode,
                        Address              = hotelStaticInfo.GeoInfo?.Address,
                        AdjacentIntersection = hotelStaticInfo.GeoInfo?.AdjacentIntersection,
                        GetInfo              = JsonHelper.SerializeObject(hotelStaticInfo.GeoInfo),
                        Ratings              = JsonHelper.SerializeObject(hotelStaticInfo.Ratings),
                        Pictures             = JsonHelper.SerializeObject(hotelStaticInfo.Pictures),
                        ImportantNotices     = JsonHelper.SerializeObject(hotelStaticInfo.ImportantNotices),
                        TransportationInfos  = JsonHelper.SerializeObject(hotelStaticInfo.TransportationInfos)
                    });
                }
            }
            SolrApi.Adds <HotelSimpleInfoSolrModel>(hotels, "simplehotel");
        }
Exemplo n.º 14
0
 public string QueryStr(HotelDetailRequestEntity request)
 {
     return(HotelApiAccess.Query(request, "hotel.detail"));
 }
Exemplo n.º 15
0
 public LowPriceResEntity QueryObj(LowPriceReqEntity req)
 {
     return(HotelApiAccess.QueryObj <LowPriceReqEntity, LowPriceResEntity>(req));
 }
Exemplo n.º 16
0
        public void GetHotelsByCityCode(int cityCode)
        {
            StringBuilder hotelIdList    = new StringBuilder();
            var           hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
            {
                City      = cityCode,
                PageIndex = 1,
                PageSize  = 4000
            });

            if (hotelIdlistRes.Total != 0)
            {
                hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs);
                var temp = hotelIdlistRes.Total / 4000;
                for (int i = 1; i <= temp; i++)
                {
                    hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity
                    {
                        City      = 2,
                        PageIndex = (i + 1),
                        PageSize  = 4000
                    }).HotelIDs);
                }
            }
            var hotelIdArr = hotelIdList.ToString().Split(',');
            var hotels     = new List <KeyWordHotel>();

            for (int i = 0; i < 1000; i++)
            {
                var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity
                {
                    SearchCandidate = new SearchCandidate {
                        HotelID = hotelIdArr[i]
                    },
                    Settings = new Settings
                    {
                        PrimaryLangID = "zh-cn",
                        ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo",
                                                       "HotelStaticInfo.NearbyPOIs",
                                                       "HotelStaticInfo.TransportationInfos",
                                                       "HotelStaticInfo.Brand",
                                                       "HotelStaticInfo.Group",
                                                       "HotelStaticInfo.Ratings",
                                                       "HotelStaticInfo.Policies",
                                                       "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy",
                                                       "HotelStaticInfo.AcceptedCreditCards",
                                                       "HotelStaticInfo.ImportantNotices",
                                                       "HotelStaticInfo.Facilities",
                                                       "HotelStaticInfo.Pictures",
                                                       "HotelStaticInfo.Descriptions",
                                                       "HotelStaticInfo.Themes",
                                                       "HotelStaticInfo.ContactInfo",
                                                       "HotelStaticInfo.ArrivalTimeLimitInfo",
                                                       "HotelStaticInfo.DepartureTimeLimitInfo",
                                                       "HotelStaticInfo.HotelTags.IsBookable" }
                    }
                });
                var hotelStaticInfo = hotelDesInfoResEntity.HotelStaticInfo;
                if (hotelStaticInfo != null)
                {
                    hotels.Add(new KeyWordHotel
                    {
                        HotelId          = hotelStaticInfo.HotelId,
                        HotelName        = hotelStaticInfo.HotelName,
                        CityName         = hotelStaticInfo.GeoInfo.City?.Name,
                        CityCode         = hotelStaticInfo.GeoInfo.City?.Code,
                        AreaName         = hotelStaticInfo.GeoInfo.Area?.Name,
                        AreaCode         = hotelStaticInfo.GeoInfo.Area?.Code,
                        BusinessDistrict = string.Join(";", hotelStaticInfo.GeoInfo.BusinessDistrict.Select(a => a.Code + "," + a.Name).ToArray()),//!string.IsNullOrEmpty(businessDistrictNames) ? businessDistrictNames : null,
                        HotelBrandName   = hotelStaticInfo.Brand?.Name,
                        HotelBrandCode   = hotelStaticInfo.Brand?.Code
                    });
                }
            }
            SolrApi.Adds <KeyWordHotel>(hotels, "testsolr2");
        }
Exemplo n.º 17
0
 public string QueryStr(LowPriceReqEntity req)
 {
     return(HotelApiAccess.QueryStr <LowPriceReqEntity>(req));
 }
Exemplo n.º 18
0
 public string QueryStr(HotelIdListRequestEntity req)
 {
     return(HotelApiAccess.Query(req, "HotelIdList"));
 }
Exemplo n.º 19
0
 public string QueryStr(HotelListRequestEntity request)
 {
     return(HotelApiAccess.Query(request, "hotel.list"));
 }
Exemplo n.º 20
0
 public HotelListResponseEntity Query(HotelListRequestEntity request)
 {
     return(HotelApiAccess.Query <HotelListRequestEntity, HotelListResponseEntity>(request, "hotel.list").Result);
 }
Exemplo n.º 21
0
 public string QueryStr(HotelDesInfoReqEntity req)
 {
     return(HotelApiAccess.QueryStr(req));
 }
Exemplo n.º 22
0
 public HotelGeosResponseEntity GetAll()
 {
     return(HotelApiAccess.GetStatic <HotelGeosResponseEntity>(string.Format("{0}xml/v2.0/hotel/geo_cn.xml", Configuraton.ApiGatewayConfig.URL_STATIC)));
 }
Exemplo n.º 23
0
 public string QueryStr(ChangeInfoReqEntity req)
 {
     return(HotelApiAccess.Query(req, "ChangeInfo"));
 }
Exemplo n.º 24
0
 public HotelIdListResponseEntity Query(HotelIdListRequestEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <HotelIdListResponseEntity>(HotelApiAccess.Query <HotelIdListRequestEntity>(req, "HotelIdList")));
 }