コード例 #1
0
ファイル: HotelUpdate.cs プロジェクト: chzhxiang/hotel
        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(','));
        }
コード例 #2
0
ファイル: HotelUpdate.cs プロジェクト: chzhxiang/hotel
        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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #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);
        }
コード例 #6
0
ファイル: HotelDetail.cs プロジェクト: chzhxiang/hotel
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #9
0
 public ChangeInfoResEntity Query(ChangeInfoReqEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <ChangeInfoResEntity>(HotelApiAccess.Query <ChangeInfoReqEntity>(req, "ChangeInfo")));
 }
コード例 #10
0
ファイル: CreditCardService.cs プロジェクト: chzhxiang/hotel
 public CreditCardsResponseEntity GetAll()
 {
     return(HotelApiAccess.GetStatic <CreditCardsResponseEntity>(string.Format("{0}xml/v2.0/hotel/creditcards.xml", Configuraton.ApiGatewayConfig.URL_STATIC)));
 }
コード例 #11
0
ファイル: RoomDesInfo.cs プロジェクト: chzhxiang/hotel
 public string QueryStr(RoomDesInfoReqEntity req)
 {
     return(HotelApiAccess.Query(req, "RoomDesInfo"));
 }
コード例 #12
0
ファイル: RoomDesInfo.cs プロジェクト: chzhxiang/hotel
 public RoomDesInfoResEntity Query(RoomDesInfoReqEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <RoomDesInfoResEntity>(HotelApiAccess.Query(req, "RoomDesInfo")));
 }
コード例 #13
0
ファイル: HotelUpdate.cs プロジェクト: chzhxiang/hotel
        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");
        }
コード例 #14
0
ファイル: HotelDetail.cs プロジェクト: chzhxiang/hotel
 public string QueryStr(HotelDetailRequestEntity request)
 {
     return(HotelApiAccess.Query(request, "hotel.detail"));
 }
コード例 #15
0
 public LowPriceResEntity QueryObj(LowPriceReqEntity req)
 {
     return(HotelApiAccess.QueryObj <LowPriceReqEntity, LowPriceResEntity>(req));
 }
コード例 #16
0
ファイル: HotelUpdate.cs プロジェクト: chzhxiang/hotel
        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");
        }
コード例 #17
0
 public string QueryStr(LowPriceReqEntity req)
 {
     return(HotelApiAccess.QueryStr <LowPriceReqEntity>(req));
 }
コード例 #18
0
ファイル: HotelIdList.cs プロジェクト: chzhxiang/hotel
 public string QueryStr(HotelIdListRequestEntity req)
 {
     return(HotelApiAccess.Query(req, "HotelIdList"));
 }
コード例 #19
0
ファイル: HotelListService.cs プロジェクト: chzhxiang/hotel
 public string QueryStr(HotelListRequestEntity request)
 {
     return(HotelApiAccess.Query(request, "hotel.list"));
 }
コード例 #20
0
ファイル: HotelListService.cs プロジェクト: chzhxiang/hotel
 public HotelListResponseEntity Query(HotelListRequestEntity request)
 {
     return(HotelApiAccess.Query <HotelListRequestEntity, HotelListResponseEntity>(request, "hotel.list").Result);
 }
コード例 #21
0
ファイル: HotelDesInfo.cs プロジェクト: chzhxiang/hotel
 public string QueryStr(HotelDesInfoReqEntity req)
 {
     return(HotelApiAccess.QueryStr(req));
 }
コード例 #22
0
ファイル: HotelGeoService.cs プロジェクト: chzhxiang/hotel
 public HotelGeosResponseEntity GetAll()
 {
     return(HotelApiAccess.GetStatic <HotelGeosResponseEntity>(string.Format("{0}xml/v2.0/hotel/geo_cn.xml", Configuraton.ApiGatewayConfig.URL_STATIC)));
 }
コード例 #23
0
 public string QueryStr(ChangeInfoReqEntity req)
 {
     return(HotelApiAccess.Query(req, "ChangeInfo"));
 }
コード例 #24
0
ファイル: HotelIdList.cs プロジェクト: chzhxiang/hotel
 public HotelIdListResponseEntity Query(HotelIdListRequestEntity req)
 {
     return(JsonHelper.DeserializeJsonToObject <HotelIdListResponseEntity>(HotelApiAccess.Query <HotelIdListRequestEntity>(req, "HotelIdList")));
 }