Exemplo n.º 1
0
        /// <summary>
        /// 查询酒店时判断是否有错误
        /// </summary>
        /// <param name="errorInfo">错误实体</param>
        /// <param name="model">酒店实体</param>
        /// <returns></returns>
        protected string IsOk(EyouSoft.HotelBI.ErrorInfo errorInfo, EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            string mess = "";//错误消息

            //如果错误实体不为空
            if (errorInfo != null)
            {
                switch (errorInfo.ErrorType)//错误类别
                {
                case EyouSoft.HotelBI.ErrorType.业务级错误:
                    mess = string.Format("{0}至{1}房型已满", comeDate, leaveDate);
                    break;

                case EyouSoft.HotelBI.ErrorType.未知错误:
                    mess = "提交数据超时,请稍后在试";
                    break;

                case EyouSoft.HotelBI.ErrorType.None:
                    mess = "";
                    break;

                case EyouSoft.HotelBI.ErrorType.系统级错误:
                    mess = "查询数据时出错";
                    break;
                }
            }
            if (mess == "") //如果错误消息为空
            {               //判断酒店实体或酒店代码是否存在
                if (model == null || string.IsNullOrEmpty(model.HotelCode))
                {
                    mess = string.Format("{0}至{1}房型已满", comeDate, leaveDate);
                }
            }
            return(mess);//返回错误消息
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ImageServerPath = EyouSoft.Common.ImageManage.GetImagerServerUrl(1);

            #region 根据查询条件获取酒店信息实体
            hotelCode = Utils.GetQueryStringValue("hotelCode");
            comeDate  = Utils.GetQueryStringValue("comeDate");
            leaveDate = Utils.GetQueryStringValue("leaveDate");
            cityId    = Utils.GetInt(Utils.GetQueryStringValue("cityId"));
            comeDate  = comeDate == "" ? DateTime.Now.ToString("yyyy-MM-dd") : comeDate;
            leaveDate = leaveDate == "" ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : leaveDate;
            EyouSoft.HotelBI.SingleSeach search = new EyouSoft.HotelBI.SingleSeach();
            search.HotelCode    = hotelCode;
            search.CheckInDate  = comeDate;
            search.CheckOutDate = leaveDate;
            search.AvailReqType = EyouSoft.HotelBI.AvailReqTypeEnum.includeStatic;
            EyouSoft.HotelBI.ErrorInfo errorInfo;
            hotelModel = EyouSoft.BLL.HotelStructure.Hotel.CreateInstance().GetHotelModel(search, out errorInfo);
            #endregion

            #region 判断查询酒店时是否有错误
            string theMess = IsOk(errorInfo, hotelModel);
            if (theMess != "")
            {
                hotelModel = new EyouSoft.Model.HotelStructure.HotelInfo();
                hotelModel.HotelPosition = new EyouSoft.Model.HotelStructure.HotelPositionInfo();
                Response.Clear();
                Response.Write(theMess);
                Response.End();
                return;
            }
            #endregion

            BindRate();//绑定房型
        }
Exemplo n.º 3
0
        /// <summary>
        /// 解析XML获取酒店基本信息
        /// </summary>
        /// <param name="BasicProperty">酒店基本信息XML节点</param>
        /// <param name="model">酒店信息实体</param>
        private void GetHotelInfoByXML(XElement BasicProperty, ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (BasicProperty == null || model == null)
            {
                return;
            }

            model.HotelName = HotelBI.Utils.GetXAttributeValue(BasicProperty, "HotelName").Trim();
            model.HotelCode = HotelBI.Utils.GetXAttributeValue(BasicProperty, "HotelCode").Trim();
            model.District  = HotelBI.Utils.GetXElement(BasicProperty, "District").Value.Trim();
            string rank = HotelBI.Utils.GetXElement(BasicProperty, "Rank").Value.Trim();

            if (!string.IsNullOrEmpty(rank))
            {
                model.Rank = (HotelBI.HotelRankEnum)Enum.Parse(typeof(HotelBI.HotelRankEnum), "_" + rank);
            }
            model.Fitment      = HotelBI.Utils.GetXElement(BasicProperty, "Fitment").Value.Trim();
            model.Tel          = HotelBI.Utils.GetXElement(BasicProperty, "Tel").Value.Trim();
            model.Floor        = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(BasicProperty, "Floor").Value.Trim());
            model.Opendate     = HotelBI.Utils.GetXElement(BasicProperty, "Opendate").Value.Trim();
            model.RoomQuantity = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(BasicProperty, "RoomQuantity").Value.Trim());
            model.LongDesc     = HotelBI.Utils.GetXElement(BasicProperty, "LongDesc").Value.Trim();
            model.ShortDesc    = HotelBI.Utils.GetXElement(BasicProperty, "ShortDesc").Value.Trim();
            model.MinRate      = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXElement(BasicProperty, "MinRate").Value.Trim());
            model.CityCode     = HotelBI.Utils.GetXAttributeValue(BasicProperty, "CityCode").Trim();
            model.CountryCode  = HotelBI.Utils.GetXAttributeValue(BasicProperty, "CountryCode").Trim();
        }
Exemplo n.º 4
0
        protected void GetHotelModel()
        {
            #region 根据查询条件获取酒店信息实体

            cityId    = Utils.GetInt(Utils.GetQueryStringValue("cityId"));
            comeDate  = comeDate == "" ? DateTime.Now.ToString("yyyy-MM-dd") : comeDate;
            leaveDate = leaveDate == "" ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : leaveDate;
            EyouSoft.HotelBI.SingleSeach search = new EyouSoft.HotelBI.SingleSeach();
            search.HotelCode    = hotelCode;
            search.CheckInDate  = comeDate;
            search.CheckOutDate = leaveDate;
            search.AvailReqType = EyouSoft.HotelBI.AvailReqTypeEnum.includeStatic;
            EyouSoft.HotelBI.ErrorInfo errorInfo;
            hotelModel = EyouSoft.BLL.HotelStructure.Hotel.CreateInstance().GetHotelModel(search, out errorInfo);
            #endregion

            #region 判断查询酒店时是否有错误
            string theMess = IsOk(errorInfo, hotelModel);
            if (theMess != "")
            {
                hotelModel = new EyouSoft.Model.HotelStructure.HotelInfo();
                hotelModel.HotelPosition = new EyouSoft.Model.HotelStructure.HotelPositionInfo();
                Utils.ShowError(theMess, "hotel");
                return;
            }
            #endregion
            this.Title = hotelModel.HotelName + "_酒店预订_酒店信息_同业114酒店频道";
            this.AddMetaTag("description", "同业114酒店频道,提供" + hotelModel.HotelName + "的房型图片,环境介绍,返佣结算报价等明细信息,是旅游同业全面了解该酒店信息的资源网站");
            BindRate();//绑定房型
        }
Exemplo n.º 5
0
        /// <summary>
        /// 解析XML构造酒店实体
        /// </summary>
        /// <param name="HotelRoot">酒店XML</param>
        /// <param name="model">酒店实体</param>
        private void AnalysisXML(XElement HotelRoot, ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (HotelRoot == null || model == null)
            {
                return;
            }

            XElement BasicProperty = HotelBI.Utils.GetXElement(HotelRoot, "BasicProperty");

            GetHotelInfoByXML(BasicProperty, ref model);
            GetHotelPositionInfoByXML(BasicProperty, ref model);
            GetHotelImagesByXML(BasicProperty, ref model);
            GetRoomTypeByXML(HotelRoot, ref model);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 解析XML获取酒店地理位置信息
        /// </summary>
        /// <param name="BasicProperty">酒店基本信息XML节点</param>
        /// <param name="model">酒店信息实体</param>
        private void GetHotelPositionInfoByXML(XElement BasicProperty, ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (BasicProperty == null || model == null)
            {
                return;
            }

            if (model.HotelPosition == null)
            {
                model.HotelPosition = new EyouSoft.Model.HotelStructure.HotelPositionInfo();
            }

            model.HotelPosition.Address   = HotelBI.Utils.GetXElement(BasicProperty, "Address").Value.Trim();
            model.HotelPosition.Longitude = EyouSoft.Common.Utility.GetDouble(HotelBI.Utils.GetXAttributeValue(HotelBI.Utils.GetXElement(BasicProperty, "Position"), "Longitude"));
            model.HotelPosition.Latitude  = EyouSoft.Common.Utility.GetDouble(HotelBI.Utils.GetXAttributeValue(HotelBI.Utils.GetXElement(BasicProperty, "Position"), "Latitude"));
            model.HotelPosition.POR       = HotelBI.Utils.GetXElement(BasicProperty, "POR").Value.Trim();
        }
Exemplo n.º 7
0
        private void GetRoomTypeByXML(XElement HotelRoot, ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (HotelRoot == null || model == null)
            {
                return;
            }

            model.RoomTypeList = new List <EyouSoft.Model.HotelStructure.RoomTypeInfo>();
            //价格计划
            IEnumerable <XElement> RatePlans = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(HotelRoot, "RatePlans"), "RatePlan");
            //房型
            IEnumerable <XElement> RoomTypes = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(HotelRoot, "RoomTypes"), "RoomType");
            //房型价格
            IEnumerable <XElement> RoomRates = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(HotelRoot, "RoomRates"), "RoomRate");

            if (RatePlans.Count() > 0 && RoomTypes.Count() > 0 && RoomRates.Count() > 0)
            {
                GetRoomTypeByForXML(RatePlans, RoomTypes, RoomRates, ref model);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 将接口返回的XML转换为平台酒店实体
        /// </summary>
        /// <param name="InterfaceReturnXML">接口返回的XML</param>
        /// <returns>平台酒店实体</returns>
        private EyouSoft.Model.HotelStructure.HotelInfo GetHotelModelByXML(string InterfaceReturnXML)
        {
            EyouSoft.Model.HotelStructure.HotelInfo model = null;
            if (string.IsNullOrEmpty(InterfaceReturnXML))
            {
                return(model);
            }

            model = new EyouSoft.Model.HotelStructure.HotelInfo();
            model.InterfaceResponseXML = InterfaceReturnXML;
            XElement root         = XElement.Parse(InterfaceReturnXML);
            XElement HotelAvailRS = HotelBI.Utils.GetXElement(root, "HotelAvailRS");
            XElement RoomStays    = HotelBI.Utils.GetXElement(HotelAvailRS, "RoomStays");
            XElement HotelRoot    = HotelBI.Utils.GetXElement(RoomStays, "RoomStay");

            AnalysisXML(HotelRoot, ref model);
            HotelRoot = null;
            root      = null;

            return(model);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 循环XML节点,取得房型信息
        /// </summary>
        /// <param name="RatePlans">价格计划节点集合</param>
        /// <param name="RoomTypes">房型信息节点集合</param>
        /// <param name="RoomRates">房型价格信息节点集合</param>
        /// <param name="model">酒店实体</param>
        private void GetRoomTypeByForXML(IEnumerable <XElement> RatePlans, IEnumerable <XElement> RoomTypes, IEnumerable <XElement> RoomRates
                                         , ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (RatePlans == null || RatePlans.Count() <= 0 || RoomTypes == null || RoomTypes.Count() <= 0 || RoomRates == null || RoomRates.Count() <= 0 || model == null)
            {
                return;
            }

            model.RoomTypeList = new List <EyouSoft.Model.HotelStructure.RoomTypeInfo>();
            string strTmpRatePlan   = string.Empty; //价格计划代码
            string strTmpRoomType   = string.Empty; //房型代码
            string strTmpVendorCode = string.Empty; //供应商代码

            EyouSoft.Model.HotelStructure.RoomTypeInfo tmpRoomTypeInfo = null;
            foreach (XElement tmpRatePlan in RatePlans)
            {
                foreach (XElement tmpRoomType in RoomTypes)
                {
                    strTmpRatePlan   = HotelBI.Utils.GetXAttributeValue(tmpRatePlan, "RatePlanCode").Trim(); //价格计划代码
                    strTmpVendorCode = HotelBI.Utils.GetXAttributeValue(tmpRatePlan, "VendorCode").Trim();   //供应商代码
                    strTmpRoomType   = HotelBI.Utils.GetXAttributeValue(tmpRoomType, "RoomTypeCode").Trim(); //房型代码

                    foreach (XElement tmpRoomRate in RoomRates)
                    {
                        //根据价格计划代码、房型代码、供应商代码确定价格
                        if (strTmpRatePlan == HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "RatePlanCode").Trim() &&
                            strTmpVendorCode == HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "VendorCode").Trim() &&
                            strTmpRoomType == HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "RoomTypeCode").Trim()
                            )
                        {
                            tmpRoomTypeInfo = new EyouSoft.Model.HotelStructure.RoomTypeInfo();
                            GetGetRoomTypeInfoByXML(strTmpRatePlan, strTmpRoomType, strTmpVendorCode, tmpRoomType, tmpRoomRate, ref tmpRoomTypeInfo);

                            model.RoomTypeList.Add(tmpRoomTypeInfo);
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        protected string IsOk(EyouSoft.HotelBI.ErrorInfo errorInfo, EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            string mess = "";

            if (errorInfo != null)
            {
                switch (errorInfo.ErrorType)
                {
                case EyouSoft.HotelBI.ErrorType.业务级错误:
                    mess = "酒店或房型不存在";
                    break;

                case EyouSoft.HotelBI.ErrorType.未知错误:
                    mess = "查询数据超时,请稍后再试";
                    break;

                case EyouSoft.HotelBI.ErrorType.None:
                    mess = "";
                    break;

                case EyouSoft.HotelBI.ErrorType.系统级错误:
                    mess = "查询数据时出错";
                    break;
                }
            }
            else
            {
                mess = "查询数据时出错";
            }
            if (mess == "")
            {
                if (model == null || string.IsNullOrEmpty(model.HotelCode))
                {
                    mess = "酒店或房型不存在";
                }
            }
            return(mess);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 解析XML获取酒店图片信息
        /// </summary>
        /// <param name="BasicProperty">酒店基本信息XML节点</param>
        /// <param name="model">酒店信息实体</param>
        private void GetHotelImagesByXML(XElement BasicProperty, ref EyouSoft.Model.HotelStructure.HotelInfo model)
        {
            if (BasicProperty == null || model == null)
            {
                return;
            }

            if (model.HotelImages == null)
            {
                model.HotelImages = new List <EyouSoft.Model.HotelStructure.HotelImagesInfo>();
            }

            IEnumerable <XElement> Images = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(BasicProperty, "Images"), "Image");

            if (Images.Count() > 0)
            {
                EyouSoft.Model.HotelStructure.HotelImagesInfo imageModel = null;

                foreach (XElement eTMP in Images)
                {
                    if (eTMP == null)
                    {
                        continue;
                    }

                    imageModel          = new EyouSoft.Model.HotelStructure.HotelImagesInfo();
                    imageModel.Category = HotelBI.Utils.GetXAttributeValue(eTMP, "Category");
                    imageModel.ImageURL = HotelBI.Utils.GetXElement(eTMP, "URL").Value.Trim();

                    model.HotelImages.Add(imageModel);
                }

                imageModel = null;
            }
            Images = null;
        }
Exemplo n.º 12
0
        /// <summary>
        /// 将接口返回的XMl转换为平台酒店实体集合
        /// </summary>
        /// <param name="InterfaceReturnXML">接口返回的XMl</param>
        /// <param name="RespPageInfo">酒店查询返回的分页信息</param>
        /// <returns>平台酒店实体集合</returns>
        private IList <EyouSoft.Model.HotelStructure.HotelInfo> GetHotelListByXML(string InterfaceReturnXML
                                                                                  , ref EyouSoft.Model.HotelStructure.RespPageInfo RespPageInfo)
        {
            IList <EyouSoft.Model.HotelStructure.HotelInfo> list = null;

            if (string.IsNullOrEmpty(InterfaceReturnXML))
            {
                return(list);
            }

            list = new List <EyouSoft.Model.HotelStructure.HotelInfo>();
            XElement root         = XElement.Parse(InterfaceReturnXML);
            XElement HotelAvailRS = HotelBI.Utils.GetXElement(root, "HotelAvailRS");

            GetRespPageInfo(HotelAvailRS, ref RespPageInfo);

            XElement RoomStays = HotelBI.Utils.GetXElement(HotelAvailRS, "RoomStays");
            IEnumerable <XElement> HotelRoots = HotelBI.Utils.GetXElements(RoomStays, "RoomStay");

            if (HotelRoots == null || HotelRoots.Count() <= 0)
            {
                return(list);
            }

            EyouSoft.Model.HotelStructure.HotelInfo model = null;
            foreach (XElement tmpHotelRoot in HotelRoots)
            {
                model = new EyouSoft.Model.HotelStructure.HotelInfo();
                model.InterfaceResponseXML = InterfaceReturnXML;
                AnalysisXML(tmpHotelRoot, ref model);

                list.Add(model);
            }

            return(list);
        }
Exemplo n.º 13
0
        protected string bookPolicy;                                                  //预定规则和要求
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsLogin)
            {
                EyouSoft.Security.Membership.UserProvider.RedirectLogin(this.Request.Url.ToString(), "请登录后预定");
                return;
            }
            this.CityAndMenu1.HeadMenuIndex = 4;

            #region 获取酒店查询条件
            hotelCode = Utils.GetQueryStringValue("hotelCode"); //酒店编号
            comeDate  = Utils.GetQueryStringValue("comeDate");  //入住日期
            leaveDate = Utils.GetQueryStringValue("leaveDate"); //离店日期

            DateTime cDate = Utils.GetDateTime(comeDate);
            DateTime lDate = Utils.GetDateTime(leaveDate);
            inDays = (lDate - cDate).Days;                            //获取入住天数

            roomCode     = Utils.GetQueryStringValue("roomCode");     //房型代码
            vendorCode   = string.Empty;                              //Utils.GetQueryStringValue("vendorCode");//供应商代码
            ratePlanCode = Utils.GetQueryStringValue("ratePlanCode"); //价格计划代码
            #endregion

            HotelSearch1.CityId  = Utils.GetInt(Utils.GetQueryStringValue("CityID"));
            CommonUser1.CityId   = HotelSearch1.CityId;
            SpecialHotel1.CityId = HotelSearch1.CityId;
            HotHotel1.CityId     = HotelSearch1.CityId;
            string method = Utils.GetFormValue("method");//当前操作

            #region 查询酒店实体
            //设置查询条件
            EyouSoft.HotelBI.SingleSeach searchModel = new EyouSoft.HotelBI.SingleSeach();
            searchModel.HotelCode    = hotelCode;                                                             //酒店代码
            searchModel.CheckInDate  = comeDate;                                                              //入住时间
            searchModel.CheckOutDate = leaveDate;                                                             //离店时间
            searchModel.RoomTypeCode = roomCode;                                                              //房型代码
            searchModel.VendorCode   = vendorCode;                                                            //供应商代码
            searchModel.RatePlanCode = ratePlanCode;                                                          //价格计划代码
            searchModel.AvailReqType = EyouSoft.HotelBI.AvailReqTypeEnum.includeStatic;                       //查询完整酒店信息
            EyouSoft.HotelBI.ErrorInfo errorInfo = null;                                                      //错误信息实体
            EyouSoft.Model.HotelStructure.HotelInfo hotelModel =
                EyouSoft.BLL.HotelStructure.Hotel.CreateInstance().GetHotelModel(searchModel, out errorInfo); //酒店实体

            #endregion

            string themess = IsOk(errorInfo, hotelModel);//获取错误信息

            //如果没有错误信息则获取酒店各种信息
            if (themess == "")
            {
                #region 获取酒店实体中的信息
                hotelName       = hotelModel.HotelName;
                this.Page.Title = hotelName + "_酒店预订_同业114酒店频道";

                //根据房型代码获取酒店中的房型
                if (hotelModel.RoomTypeList != null && hotelModel.RoomTypeList.Count > 0)
                {
                    roomTypeModel = hotelModel.RoomTypeList.FirstOrDefault(r => r.RoomTypeCode == roomCode && /*r.VendorCode == vendorCode &&*/ r.RatePlanCode == ratePlanCode);//获取房型信息
                }

                visistList =
                    EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().GetHotelListByName("", SiteUserInfo.CompanyID);//获取酒店常旅客

                //获取房型明细中的第一条
                if (roomTypeModel != null && roomTypeModel.RoomRate.RateInfos.Count > 0)
                {
                    payType   = roomTypeModel.RoomRate.Payment == EyouSoft.HotelBI.HBEPaymentType.T ? "前台现付" : "";
                    backPrice = roomTypeModel.RoomRate.RateInfos.Sum(r => r.CommissionAmount); //取得总反佣价

                    rateModel = roomTypeModel.RoomRate.RateInfos[0];                           //获取第一条明细
                }//如果房型信息不存在则显示房型已满
                else
                {
                    Utils.ShowError(string.Format("{0}至{1}房型已满", comeDate, leaveDate), "hotel");
                    roomTypeModel = new EyouSoft.Model.HotelStructure.RoomTypeInfo();
                    EyouSoft.Model.HotelStructure.RoomRateInfo roomRateModel = new EyouSoft.Model.HotelStructure.RoomRateInfo();
                    roomRateModel.RateInfos = new List <EyouSoft.Model.HotelStructure.RateInfo>();
                    roomTypeModel.RoomRate  = roomRateModel;
                    rateModel = new EyouSoft.Model.HotelStructure.RateInfo();
                    return;
                }

                //获取预定规则和要求
                if (roomTypeModel.RoomRate.BookPolicy != null)
                {
                    bookPolicy = roomTypeModel.RoomRate.BookPolicy.LongDesc;
                }
                #endregion

                #region  单操作
                if (method == "save")               //下单操作
                {
                    if (hotelModel.HotelCode == "") //如果传入不存在的酒店则输出失败
                    {
                        Utils.ResponseMeg(false, string.Format("{0}至{1}房型已满", comeDate, leaveDate));
                        return;
                    }
                    string aEarlyTime  = Utils.GetFormValue("hb_selETime"); //最早到达时间
                    string aLateTime   = Utils.GetFormValue("hb_selLTime"); //最迟到达时间
                    int    intLateTime = Utils.GetInt(aLateTime);
                    if (intLateTime > 24)
                    {
                        aLateTime = (intLateTime - 24).ToString();
                    }
                    EyouSoft.Model.HotelStructure.OrderInfo orderModel = new EyouSoft.Model.HotelStructure.OrderInfo();
                    orderModel.ArriveEarlyTime    = (aEarlyTime.Length == 1 ? ("0" + aEarlyTime) : aEarlyTime) + "00";                                                                                                                                              //到店最早时间
                    orderModel.ArriveLateTime     = (aLateTime.Length == 1 ? ("0" + aLateTime) : aLateTime) + "00";                                                                                                                                                 //到店最晚时间
                    orderModel.BuyerCId           = SiteUserInfo.CompanyID;                                                                                                                                                                                         //采购公司编号
                    orderModel.BuyerCName         = SiteUserInfo.CompanyName;                                                                                                                                                                                       //采购公司名
                    orderModel.BuyerUFullName     = SiteUserInfo.ContactInfo.ContactName;                                                                                                                                                                           //采购用户姓名
                    orderModel.BuyerUId           = SiteUserInfo.ID;                                                                                                                                                                                                //采购用户编号
                    orderModel.BuyerUName         = SiteUserInfo.UserName;                                                                                                                                                                                          //采购用户名
                    orderModel.CheckInDate        = cDate;                                                                                                                                                                                                          //入住时间
                    orderModel.CheckOutDate       = lDate;                                                                                                                                                                                                          //离店时间
                    orderModel.CheckState         = EyouSoft.Model.HotelStructure.CheckStateList.待审结;
                    orderModel.CityCode           = hotelModel.CityCode;                                                                                                                                                                                            //城市代码
                    orderModel.CityName           = hotelModel.CityCode;                                                                                                                                                                                            //城市名称
                    orderModel.Comments           = bookPolicy;                                                                                                                                                                                                     //备注
                    orderModel.CommissionFix      = rateModel.Fix;                                                                                                                                                                                                  //固定反佣
                    orderModel.CommissionPercent  = rateModel.Percent;                                                                                                                                                                                              //反佣比例
                    orderModel.CommissionType     = EyouSoft.HotelBI.HBECommissionType.FIX;
                    orderModel.ContacterFullname  = Utils.GetFormValue("hb_txtContactName");                                                                                                                                                                        //联系人姓名
                    orderModel.ContacterMobile    = Utils.GetFormValue("hb_txtContactMoible");                                                                                                                                                                      //联系人手机
                    orderModel.ContacterTelephone = Utils.GetFormValue("hb_txtContactArea") + "-" + Utils.GetFormValue("hb_txtContactTel") + (!string.IsNullOrEmpty(Utils.GetFormValue("hb_txtContactFen")) ? ("-" + Utils.GetFormValue("hb_txtContactFen")) : ""); //联系人电话
                    if (!string.IsNullOrEmpty(hotelModel.CountryCode))
                    {
                        orderModel.CountryCode = hotelModel.CountryCode;//国家代码
                    }
                    orderModel.CreateDateTime  = DateTime.Now;
                    orderModel.HotelCode       = hotelModel.HotelCode;
                    orderModel.HotelName       = hotelModel.HotelName;
                    orderModel.IsMobileContact = Utils.GetFormValue("hb_chkIsMoible") == "1";//是否短信通知客人
                    orderModel.OrderType       = EyouSoft.Model.HotelStructure.OrderType.国内现付;
                    orderModel.PaymentType     = EyouSoft.HotelBI.HBEPaymentType.T;
                    orderModel.Quantity        = Utils.GetInt(Utils.GetFormValue("hb_selRoom"));
                    orderModel.RatePlanCode    = roomTypeModel.RatePlanCode ?? "RatePlanCode";
                    orderModel.RoomTypeCode    = roomTypeModel.RoomTypeCode ?? "RoomTypeCode";
                    orderModel.RoomTypeName    = roomTypeModel.RoomTypeName;
                    decimal ExcessiveFee = 0;//额外收费
                    IList <EyouSoft.Model.HotelStructure.RateInfo> riList = roomTypeModel.RoomRate.RateInfos;
                    if (riList != null && riList.Count >= 0)
                    {
                        foreach (EyouSoft.Model.HotelStructure.RateInfo rate in riList)
                        {
                            if (rate.ExcessiveFees != null)
                            {
                                ExcessiveFee += rate.ExcessiveFees.Sum(ef => ef.Amount);//计算额外收费
                            }
                        }
                    }

                    orderModel.TotalAmount     = roomTypeModel.RoomRate.AmountPrice * orderModel.Quantity + ExcessiveFee;            //总房价(总销售+额外收费)
                    orderModel.TotalCommission = roomTypeModel.RoomRate.RateInfos.Sum(r => r.CommissionPrice) * orderModel.Quantity; //总佣金
                    orderModel.VendorCode      = roomTypeModel.VendorCode;
                    orderModel.VendorName      = roomTypeModel.VendorName;
                    //特殊要求
                    orderModel.SpecialRequest = string.Format("无烟要求:{0},早餐:{1},{2},{3}", Utils.GetFormValue("hb_selIsSmoke"), Utils.GetFormValue("hb_selIsBreakfast"), Utils.GetFormValue("hb_chkFloor"), Utils.GetFormValue("hb_chkRoom"));
                    IList <EyouSoft.HotelBI.HBEResGuestInfo> guestList = new List <EyouSoft.HotelBI.HBEResGuestInfo>();
                    string[] guestName   = Utils.GetFormValues("hb_txtGuestName");  //获取客户姓名
                    string[] guestType   = Utils.GetFormValues("hb_selGuestType");  //获取客户类型
                    string   guestMoible = Utils.GetFormValue("hb_chkGuestMoible"); //获取通知手机
                    //添加酒店旅客
                    EyouSoft.IBLL.TicketStructure.ITicketVisitor visistorBll = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance();
                    for (int i = 0; i < orderModel.Quantity; i++)
                    {
                        //添加常旅客
                        if (i == 0)
                        {
                            string cName = "";
                            string eName = "";
                            if (IsLetter(guestName[i]))//判断中文或英文
                            {
                                eName = guestName[i];
                            }
                            else
                            {
                                cName = guestName[i];
                            }
                            //判断常旅客是否存在
                            if (!visistorBll.HotelVistorIsExist(cName, eName, guestMoible, SiteUserInfo.CompanyID, null))
                            {
                                EyouSoft.Model.TicketStructure.TicketVistorInfo vInfo = new EyouSoft.Model.TicketStructure.TicketVistorInfo();
                                vInfo.ChinaName   = cName;
                                vInfo.EnglishName = eName;
                                vInfo.CompanyId   = SiteUserInfo.CompanyID;
                                vInfo.Id          = Guid.NewGuid().ToString();
                                vInfo.ContactTel  = guestMoible;
                                vInfo.CardNo      = "";
                                vInfo.CardType    = EyouSoft.Model.TicketStructure.TicketCardType.None;
                                vInfo.ContactSex  = EyouSoft.Model.CompanyStructure.Sex.未知;
                                EyouSoft.Model.TicketStructure.TicketNationInfo nation = new EyouSoft.Model.TicketStructure.TicketNationInfo();
                                nation.CountryCode = "";
                                nation.CountryName = "";
                                vInfo.NationInfo   = nation;
                                vInfo.VistorType   = EyouSoft.Model.TicketStructure.TicketVistorType.成人;
                                vInfo.DataType     = EyouSoft.Model.TicketStructure.TicketDataType.酒店常旅客;
                                visistorBll.AddTicketVisitorInfo(vInfo);//执行添加
                            }
                        }
                        EyouSoft.HotelBI.HBEResGuestInfo guest = new EyouSoft.HotelBI.HBEResGuestInfo();
                        guest.GuestTypeIndicator = (EyouSoft.HotelBI.HBEGuestTypeIndicator)(int.Parse(guestType[i]));
                        guest.IsMobileContact    = orderModel.IsMobileContact;
                        guest.Mobile             = guestMoible;
                        guest.PersonName         = guestName[i];
                        guestList.Add(guest);
                    }
                    orderModel.ResGuests = guestList; //赋值旅客信息
                    string errorDesc = "";            //错误描述
                    if (EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().Add(orderModel, out errorDesc) > 0)
                    {
                        Utils.ResponseMeg(true, orderModel.ResOrderId);
                    }
                    else
                    {
                        Utils.ResponseMeg(false, errorDesc == "" ? "下单失败" : "下单失败:" + errorDesc);//下单失败
                    }
                }
                #endregion
                else
                {
                    #region 绑定酒店房费
                    HotelSearch1.ImageServerPath = ImageServerPath;
                    if (hotelModel.HotelCode == "")//如果出入不存在酒店则返回到查询列表
                    {
                        Utils.ShowError(string.Format("{0}至{1}房型已满", comeDate, leaveDate), "hotel");
                        return;
                    }
                    GetRateInfoList();//绑定酒店房费列表
                    #endregion
                }
            }
            else//如果错误信息不为空
            {
                //如果是保存操作则输出错误信息
                if (method == "save")
                {
                    Utils.ResponseMeg(false, themess);
                }
                else//如果是初始化页面时则跳转到错误页面
                {
                    Utils.ShowError(themess, "hotel");
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取酒店信息集合
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="searchInfo">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.HotelStructure.HotelInfo> GetHotels(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.HotelStructure.MLocalHotelSearchInfo searchInfo)
        {
            DateTime ratePlanStartDate = searchInfo != null ? searchInfo.RatePlanStartDate : DateTime.Today;
            IList <EyouSoft.Model.HotelStructure.HotelInfo> items = new List <EyouSoft.Model.HotelStructure.HotelInfo>();
            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "tbl_Hotel";
            string        primaryKey    = "HotelId";
            string        orderByString = "CreateTime DESC";
            StringBuilder fields        = new StringBuilder();

            #region fields
            fields.Append(" HotelId,HotelCode,AppCode,HotelName,HotelNameEn,CityCode,Latitude,Longitude,District,RankCode,LongDesc ");
            fields.Append(" ,(SELECT ImgCategory,FilePath FROM tbl_HotelImg AS A WHERE A.HotelId=tbl_Hotel.HotelId FOR XML RAW,ROOT('root')) AS HotelImgsXML ");

            /*,(SELECT A.VendorCode,A.RatePlanCode,A.Payment,A.AmountPrice,A.AmountBeforeTax,A.DisplayPrice
             * ,(SELECT B.[Percent],B.Fix,B.Commisiontype FROM tbl_HotelRatePlanComm AS B WHERE A.RoomTypeId=B.RoomTypeId AND A.VendorCode=B.VendorCode AND A.RatePlanCode=B.RatePlanCode {2:@RatePlanCommQuery} FOR XML RAW,ROOT('root')) AS RatePlanCommXML
             * ,C.RoomName,C.BedType,C.RoomTypeCode,C.RoomTypeId,C.IsInternet
             * FROM tbl_HotelRate AS A INNER JOIN tbl_HotelRoomType AS C ON A.RoomTypeId=C.RoomTypeId AND {1:@RoomTypeQuery}
             * WHERE A.HotelId=tbl_Hotel.HotelId AND {0:@RoomRateQuery} FOR XML RAW,ROOT('root')) AS HotelRoomsXML*/

            StringBuilder roomTypeQuery = new StringBuilder();
            if (searchInfo.IsInternet.HasValue ||
                !string.IsNullOrEmpty(searchInfo.SpecialRoomName) ||
                !string.IsNullOrEmpty(searchInfo.BedType))
            {
                if (searchInfo.IsInternet.HasValue)
                {
                    roomTypeQuery.AppendFormat(" AND  C.IsInternet='{0}'", searchInfo.IsInternet.Value ? "1" : "0");
                }
                if (!string.IsNullOrEmpty(searchInfo.SpecialRoomName))
                {
                    roomTypeQuery.AppendFormat(" AND C.RoomName LIKE '%{0}%' ", searchInfo.SpecialRoomName);
                }
                if (!string.IsNullOrEmpty(searchInfo.BedType))
                {
                    roomTypeQuery.AppendFormat(" AND C.BedType='{0}' ", searchInfo.BedType);
                }
            }

            StringBuilder roomRateQuery     = new StringBuilder();
            StringBuilder roomRatePlanQuery = new StringBuilder();

            roomRateQuery.AppendFormat(" AND '{0}' BETWEEN A.StartDate AND A.EndDate ", ratePlanStartDate);
            roomRatePlanQuery.AppendFormat(" AND '{0}' BETWEEN B.StartDate AND B.EndDate ", ratePlanStartDate);

            if (searchInfo != null)
            {
                if (searchInfo.PriceMaxRate.HasValue)
                {
                    roomRateQuery.AppendFormat(" AND A.AmountPrice<='{0}' ", searchInfo.PriceMaxRate.Value);
                }
                if (searchInfo.PriceMinRate.HasValue)
                {
                    roomRateQuery.AppendFormat(" AND A.AmountPrice>='{0}' ", searchInfo.PriceMinRate.Value);
                }
            }

            fields.AppendFormat(" ,(SELECT A.VendorCode,A.RatePlanCode,A.Payment,A.AmountPrice,A.AmountBeforeTax,A.DisplayPrice,A.FreeMeal ,(SELECT B.[Percent],B.Fix,B.Commisiontype FROM tbl_HotelRatePlanComm AS B WHERE A.RoomTypeId=B.RoomTypeId AND A.VendorCode=B.VendorCode AND A.RatePlanCode=B.RatePlanCode {2} FOR XML RAW,ROOT('root')) AS RatePlanCommXML ,C.RoomName,C.BedType,C.RoomTypeCode,C.RoomTypeId,C.IsInternet FROM tbl_HotelRate AS A INNER JOIN tbl_HotelRoomType AS C ON A.RoomTypeId=C.RoomTypeId AND C.IsDelete='0' {1} WHERE A.HotelId=tbl_Hotel.HotelId {0} FOR XML RAW,ROOT('root')) AS HotelRoomsXML ", roomRateQuery.ToString()
                                , roomTypeQuery.ToString()
                                , roomRatePlanQuery.ToString());
            #endregion

            #region 拼接查询条件
            cmdQuery.Append(" IsDelete='0' ");
            if (searchInfo != null)
            {
                if (!string.IsNullOrEmpty(searchInfo.CityCode))
                {
                    cmdQuery.AppendFormat(" AND CityCode='{0}' ", searchInfo.CityCode);
                }
                if (!string.IsNullOrEmpty(searchInfo.District))
                {
                    cmdQuery.AppendFormat(" AND District='{0}' ", searchInfo.District);
                }
                if (!string.IsNullOrEmpty(searchInfo.Fitment))
                {
                    cmdQuery.AppendFormat(" AND Fitment LIKE '{0}%' ", searchInfo.Fitment);
                }
                if (!string.IsNullOrEmpty(searchInfo.HotelName))
                {
                    cmdQuery.AppendFormat(" AND HotelName LIKE '%{0}%' ", searchInfo.HotelName);
                }
                if (!string.IsNullOrEmpty(searchInfo.HotelNameEn))
                {
                    cmdQuery.AppendFormat(" AND HotelNameEn LIKE '%{0}%' ", searchInfo.HotelNameEn);
                }
                if (!string.IsNullOrEmpty(searchInfo.Rank))
                {
                    cmdQuery.AppendFormat(" AND RankCode='{0}' ", searchInfo.Rank);
                }
                if (!string.IsNullOrEmpty(searchInfo.LandMarkName))
                {
                    cmdQuery.AppendFormat(" AND EXISTS (SELECT 1 FROM tbl_HotelLandMark AS A WHERE A.HotelId=tbl_Hotel.HotelId AND A.LandMarkName='{0}' ) ", searchInfo.LandMarkName);
                }
                if (searchInfo.IsInternet.HasValue ||
                    !string.IsNullOrEmpty(searchInfo.SpecialRoomName) ||
                    !string.IsNullOrEmpty(searchInfo.BedType))
                {
                    cmdQuery.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_HotelRoomType AS A WHERE A.HotelId=tbl_Hotel.HotelId AND A.IsDelete='0' ");

                    if (searchInfo.IsInternet.HasValue)
                    {
                        cmdQuery.AppendFormat(" AND  A.IsInternet='{0}'", searchInfo.IsInternet.Value ? "1" : "0");
                    }
                    if (!string.IsNullOrEmpty(searchInfo.SpecialRoomName))
                    {
                        cmdQuery.AppendFormat(" AND A.RoomName LIKE '%{0}%' ", searchInfo.SpecialRoomName);
                    }
                    if (!string.IsNullOrEmpty(searchInfo.BedType))
                    {
                        cmdQuery.AppendFormat(" AND A.BedType='{0}' ", searchInfo.BedType);
                    }
                    cmdQuery.Append(" ) ");
                }

                if (searchInfo.PriceMaxRate.HasValue ||
                    searchInfo.PriceMinRate.HasValue)
                {
                    cmdQuery.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_HotelRate AS A WHERE A.HotelId=tbl_Hotel.HotelId ");
                    if (searchInfo.PriceMaxRate.HasValue)
                    {
                        cmdQuery.AppendFormat(" AND A.AmountPrice<={0} ", searchInfo.PriceMaxRate.Value);
                    }
                    if (searchInfo.PriceMinRate.HasValue)
                    {
                        cmdQuery.AppendFormat(" AND A.AmountPrice>={0} ", searchInfo.PriceMinRate.Value);
                    }
                    cmdQuery.AppendFormat(" AND '{0}' BETWEEN A.StartDate AND A.EndDate ", ratePlanStartDate);
                    cmdQuery.AppendFormat(")");
                }
            }
            #endregion

            #region 排序
            if (searchInfo != null)
            {
                switch (searchInfo.OrderBy)
                {
                case EyouSoft.HotelBI.HotelOrderBy.Default: break;

                case EyouSoft.HotelBI.HotelOrderBy.PRICEHTL: orderByString = "SortPrice DESC"; break;

                case EyouSoft.HotelBI.HotelOrderBy.PRICELTH: orderByString = "SortPrice ASC"; break;

                case EyouSoft.HotelBI.HotelOrderBy.STARHTL: orderByString = "RankCode DESC"; break;

                case EyouSoft.HotelBI.HotelOrderBy.STARLTH: orderByString = "RankCode ASC"; break;
                }
            }
            #endregion

            using (IDataReader rdr = DbHelper.ExecuteReader(base.TourStore, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    EyouSoft.Model.HotelStructure.HotelInfo item = new EyouSoft.Model.HotelStructure.HotelInfo();

                    item.AppCode                 = (EyouSoft.Model.HotelStructure.AppCode)rdr.GetByte(rdr.GetOrdinal("AppCode"));
                    item.CityCode                = rdr["CityCode"].ToString().Trim();
                    item.District                = rdr["District"].ToString();
                    item.HotelCode               = rdr["HotelCode"].ToString().Trim();
                    item.HotelName               = rdr["HotelName"].ToString();
                    item.HotelId                 = rdr.GetString(rdr.GetOrdinal("HotelId"));
                    item.LongDesc                = rdr["LongDesc"].ToString();
                    item.ShortDesc               = rdr["LongDesc"].ToString();
                    item.Rank                    = ToHotelRanK(rdr["RankCode"].ToString());
                    item.HotelPosition           = new EyouSoft.Model.HotelStructure.HotelPositionInfo();
                    item.HotelPosition.Latitude  = Utility.GetDouble(rdr["Latitude"].ToString());
                    item.HotelPosition.Longitude = Utility.GetDouble(rdr["Longitude"].ToString());
                    item.RoomTypeList            = this.ParseHotelRoomByXml(rdr["HotelRoomsXML"].ToString());
                    item.HotelImages             = this.ParseHotelImgByXml(rdr["HotelImgsXML"].ToString());

                    items.Add(item);
                }
            }

            return(items);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 添加,删除操作
        /// </summary>
        /// <param name="mothedType">操作类型(add,delete)</param>
        private void OpearMothed(string mothedType)
        {
            string[] HotelCodesOrId = StringValidate.Split(Utils.GetFormValue("HotelCodes"), ",");  //接口酒店Code,或者本地酒店ID

            if (mothedType == "add")
            {
                int    HotelShowType = Utils.GetInt(Request.Form["HotelShowType"], 0);
                string Interjson     = Server.HtmlDecode(Utils.GetFormValue("InterList")); //获取接口列表数据
                if (string.IsNullOrEmpty(Interjson))
                {
                    Utils.ResponseMeg(false, "请重新查询数据,再进行添加!");
                    return;
                }
                EyouSoft.Model.HotelStructure.HotelLocalInfo         hotelLocal = null; //本地酒店实体
                IList <EyouSoft.Model.HotelStructure.HotelLocalInfo> list       = new List <EyouSoft.Model.HotelStructure.HotelLocalInfo>();
                string   topcodes    = Utils.GetFormValue("HotelTopCodes");
                string[] SetTopCodes = string.IsNullOrEmpty(topcodes) == true?null: StringValidate.Split(topcodes, ",");                                                 //置顶的酒店Code
                IList <EyouSoft.Model.HotelStructure.HotelInfo> interList = JsonConvert.DeserializeObject <IList <EyouSoft.Model.HotelStructure.HotelInfo> >(Interjson); //将json序列化为集合对象
                foreach (string item in HotelCodesOrId)
                {
                    EyouSoft.Model.HotelStructure.HotelInfo hodelinfo = null;
                    foreach (EyouSoft.Model.HotelStructure.HotelInfo interitem in interList)
                    {
                        if (interitem == null)
                        {
                            continue;
                        }
                        if (interitem.HotelCode == item)
                        {
                            hodelinfo = interitem;
                            break;
                        }
                    }
                    if (hodelinfo != null)  //将接口Hotel值赋给HotelLocal实体
                    {
                        hotelLocal                = new EyouSoft.Model.HotelStructure.HotelLocalInfo();
                        hotelLocal.HotelCode      = hodelinfo.HotelCode;
                        hotelLocal.HotelName      = hodelinfo.HotelName;
                        hotelLocal.IssueTime      = DateTime.Now;
                        hotelLocal.MarketingPrice = hodelinfo.MinRate; //暂定
                        if (hodelinfo.HotelImages != null && hodelinfo.HotelImages.Count > 0)
                        {
                            hotelLocal.HotelImg = hodelinfo.HotelImages[0].ImageURL;
                        }
                        hotelLocal.Rank      = hodelinfo.Rank;
                        hotelLocal.ShortDesc = hodelinfo.ShortDesc;
                        hotelLocal.ShowType  = (EyouSoft.Model.HotelStructure.HotelShowType)HotelShowType;
                        hotelLocal.CityCode  = hodelinfo.CityCode;
                        if (SetTopCodes != null && SetTopCodes.Length > 0)   //判断是否选中置顶
                        {
                            for (int i = 0; i < SetTopCodes.Length; i++)
                            {
                                if (item == SetTopCodes[i])
                                {
                                    hotelLocal.IsTop = true;
                                }
                            }
                        }
                        list.Add(hotelLocal);
                        hodelinfo = null;
                    }
                }

                int row = EyouSoft.BLL.HotelStructure.HotelLocalInfo.CreateInstance().Add(list); //添加操作结果
                if (row == 0)
                {
                    Utils.ResponseMeg(false, "该酒店数据已经存在");
                }
                else if (row < list.Count)
                {
                    Utils.ResponseMeg(false, "部分酒店已经存在,其它的添加成功");
                }
                else
                {
                    Utils.ResponseMeg(true, "操作成功");
                }

                list = null;
            }
            if (mothedType == "delete")   //删除本地数据
            {
                if (EyouSoft.BLL.HotelStructure.HotelLocalInfo.CreateInstance().Delete(HotelCodesOrId) > 0)
                {
                    Utils.ResponseMeg(true, "操作成功");
                }
                else
                {
                    Utils.ResponseMeg(true, "操作失败");
                }
            }
        }