Exemplo n.º 1
0
        /// <summary>
        /// parse hotel room by xml
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        private IList <EyouSoft.Model.HotelStructure.RoomTypeInfo> ParseHotelRoomByXml(string xml)
        {
            if (string.IsNullOrEmpty(xml))
            {
                return(null);
            }
            IList <EyouSoft.Model.HotelStructure.RoomTypeInfo> items = new List <EyouSoft.Model.HotelStructure.RoomTypeInfo>();

            XElement xRoot = XElement.Parse(xml);
            var      xRows = Utility.GetXElements(xRoot, "row");

            foreach (var xRow in xRows)
            {
                EyouSoft.Model.HotelStructure.RoomTypeInfo item = new EyouSoft.Model.HotelStructure.RoomTypeInfo();
                item.RoomTypeName = Utility.GetXAttributeValue(xRow, "RoomName");
                item.BedType      = Utility.GetXAttributeValue(xRow, "BedType");
                item.RoomTypeCode = Utility.GetXAttributeValue(xRow, "RoomTypeCode").Trim();
                item.RoomTypeId   = Utility.GetXAttributeValue(xRow, "RoomTypeId");
                item.IsInternet   = Utility.GetXAttributeValue(xRow, "IsInternet") == "1" ? true : false;
                item.VendorCode   = Utility.GetXAttributeValue(xRow, "VendorCode").Trim();
                item.RatePlanCode = Utility.GetXAttributeValue(xRow, "RatePlanCode").Trim();

                item.RoomRate = new EyouSoft.Model.HotelStructure.RoomRateInfo();

                item.RoomRate.Internet  = item.IsInternet;
                item.RoomRate.RateInfos = new List <EyouSoft.Model.HotelStructure.RateInfo>();
                EyouSoft.Model.HotelStructure.RateInfo rateItem = new EyouSoft.Model.HotelStructure.RateInfo();
                rateItem.AmountBeforeTax = Utility.GetDecimal(Utility.GetXAttributeValue(xRow, "AmountBeforeTax"));
                rateItem.AmountPrice     = Utility.GetDecimal(Utility.GetXAttributeValue(xRow, "AmountPrice"));
                rateItem.DisplayPrice    = Utility.GetDecimal(Utility.GetXAttributeValue(xRow, "DisplayPrice"));
                rateItem.FreeMeal        = Utility.GetInt(Utility.GetXAttributeValue(xRow, "FreeMeal"));

                string ratePlanCommXML = Utility.GetXAttributeValue(xRow, "RatePlanCommXML");

                if (!string.IsNullOrEmpty(ratePlanCommXML))
                {
                    XElement xRatePlanCommRoot = XElement.Parse(ratePlanCommXML);
                    XElement xRatePlanCommRow  = Utility.GetXElement(xRatePlanCommRoot, "row");

                    rateItem.CommissionType = (EyouSoft.HotelBI.HBECommissionType)Enum.Parse(typeof(EyouSoft.HotelBI.HBECommissionType), Utility.GetXAttributeValue(xRatePlanCommRow, "Commisiontype"));
                    rateItem.Percent        = Utility.GetDecimal(Utility.GetXAttributeValue(xRatePlanCommRow, "Percent"));
                    rateItem.Fix            = Utility.GetDecimal(Utility.GetXAttributeValue(xRatePlanCommRow, "Fix"));
                }

                item.RoomRate.RateInfos.Add(rateItem);

                items.Add(item);
            }

            return(items);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 解析XML获取房型价格详细信息集合
        /// </summary>
        /// <param name="strTmpRatePlan">当前价格计划代码</param>
        /// <param name="strTmpRoomType">当前房型代码</param>
        /// <param name="strTmpVendorCode">当前供应商代码</param>
        /// <param name="tmpRoomRate">当前房型价格信息节点</param>
        /// <param name="tmpRoomTypeInfo">当前房型实体</param>
        private void GetRoomRateListByXML(string strTmpRatePlan, string strTmpRoomType, string strTmpVendorCode,
                                          XElement tmpRoomRate, ref EyouSoft.Model.HotelStructure.RoomTypeInfo tmpRoomTypeInfo)
        {
            tmpRoomTypeInfo.RoomRate.RateInfos = new List <EyouSoft.Model.HotelStructure.RateInfo>();
            EyouSoft.Model.HotelStructure.RateInfo tmpRateInfo = null;
            //价格详细信息集合
            IEnumerable <XElement> Rates = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(tmpRoomRate, "Rates"), "Rate");

            foreach (XElement tmpRate in Rates)
            {
                string strTmpRateStartDate = HotelBI.Utils.GetXAttributeValue(tmpRate, "StartDate").Trim();
                string strTmpRateEndDate   = HotelBI.Utils.GetXAttributeValue(tmpRate, "EndDate").Trim();
                if (string.IsNullOrEmpty(strTmpRateStartDate) || string.IsNullOrEmpty(strTmpRateEndDate))
                {
                    continue;
                }

                DateTime DateRateS = DateTime.Parse(strTmpRateStartDate);
                DateTime DateRateE = DateTime.Parse(strTmpRateEndDate);

                tmpRateInfo              = new EyouSoft.Model.HotelStructure.RateInfo();
                tmpRateInfo.AmountPrice  = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(tmpRate, "AmountPrice").Trim());
                tmpRateInfo.DisplayPrice = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(tmpRate, "DisplayPrice").Trim());
                tmpRateInfo.FeeFix       = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(tmpRate, "FeeFix").Trim());
                tmpRateInfo.FeePercent   = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(tmpRate, "FeePercent").Trim());
                tmpRateInfo.Fee          = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(tmpRate, "Fee").Trim());
                tmpRateInfo.FreeMeal     = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(tmpRate, "FreeMeal").Value.Trim());

                GetExcessiveFeeByXML(strTmpRatePlan, strTmpRoomType, strTmpVendorCode, tmpRoomRate, DateRateS, DateRateE, ref tmpRateInfo);
                GetCommissionByXML(strTmpRatePlan, strTmpRoomType, strTmpVendorCode, tmpRoomRate, DateRateS, DateRateE, ref tmpRateInfo);

                EyouSoft.Model.HotelStructure.RateInfo tmpRateInfo1 = null;
                TimeSpan TSSE = DateRateE - DateRateS;
                for (int i = 0; i <= TSSE.Days; i++)
                {
                    tmpRateInfo1                = new EyouSoft.Model.HotelStructure.RateInfo();
                    tmpRateInfo1.AmountPrice    = tmpRateInfo.AmountPrice;
                    tmpRateInfo1.DisplayPrice   = tmpRateInfo.DisplayPrice;
                    tmpRateInfo1.FeeFix         = tmpRateInfo.FeeFix;
                    tmpRateInfo1.FeePercent     = tmpRateInfo.FeePercent;
                    tmpRateInfo1.Fee            = tmpRateInfo.Fee;
                    tmpRateInfo1.FreeMeal       = tmpRateInfo.FreeMeal;
                    tmpRateInfo1.CommissionType = tmpRateInfo.CommissionType;
                    tmpRateInfo1.Fix            = tmpRateInfo.Fix;
                    tmpRateInfo1.Percent        = tmpRateInfo.Percent;
                    tmpRateInfo1.Tax            = tmpRateInfo.Tax;
                    tmpRateInfo1.CurrData       = DateRateS.AddDays(i);
                    tmpRoomTypeInfo.RoomRate.RateInfos.Add(tmpRateInfo1);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 解析XML获取房型基本信息
        /// </summary>
        /// <param name="strTmpRatePlan">当前价格计划代码</param>
        /// <param name="strTmpRoomType">当前房型代码</param>
        /// <param name="strTmpVendorCode">当前供应商代码</param>
        /// <param name="tmpRoomType">当前房型节点</param>
        /// <param name="tmpRoomRate">当前房型价格信息节点</param>
        /// <param name="tmpRoomTypeInfo">当前房型实体</param>
        private void GetGetRoomTypeInfoByXML(string strTmpRatePlan, string strTmpRoomType, string strTmpVendorCode, XElement tmpRoomType
                                             , XElement tmpRoomRate, ref EyouSoft.Model.HotelStructure.RoomTypeInfo tmpRoomTypeInfo)
        {
            tmpRoomTypeInfo = new EyouSoft.Model.HotelStructure.RoomTypeInfo();
            tmpRoomTypeInfo.RatePlanCode    = strTmpRatePlan;
            tmpRoomTypeInfo.RoomTypeCode    = strTmpRoomType;
            tmpRoomTypeInfo.RoomTypeName    = HotelBI.Utils.GetXAttributeValue(tmpRoomType, "RoomTypeName").Trim();
            tmpRoomTypeInfo.Category        = HotelBI.Utils.GetXAttributeValue(tmpRoomType, "Category").Trim();
            tmpRoomTypeInfo.BedType         = HotelBI.Utils.GetXAttributeValue(tmpRoomType, "BedType").Trim();
            tmpRoomTypeInfo.NoSmoking       = HotelBI.Utils.GetXAttributeValue(tmpRoomType, "NoSmoking").Trim().ToLower() == "y" ? true : false;
            tmpRoomTypeInfo.RoomDescription = HotelBI.Utils.GetXElement(tmpRoomType, "RoomDescription").Value.Trim();
            tmpRoomTypeInfo.VendorCode      = strTmpVendorCode;
            tmpRoomTypeInfo.VendorName      = HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "VendorName").Trim();

            GetRoomRateInfoByXML(tmpRoomRate, ref tmpRoomTypeInfo);
            GetRoomRateListByXML(strTmpRatePlan, strTmpRoomType, strTmpVendorCode, tmpRoomRate, ref tmpRoomTypeInfo);
        }
Exemplo n.º 4
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.º 5
0
        /// <summary>
        /// 解析XML获取房型价格基本信息
        /// </summary>
        /// <param name="tmpRoomRate">当前房型价格信息节点</param>
        /// <param name="tmpRoomTypeInfo">当前房型实体</param>
        private void GetRoomRateInfoByXML(XElement tmpRoomRate, ref EyouSoft.Model.HotelStructure.RoomTypeInfo tmpRoomTypeInfo)
        {
            EyouSoft.Model.HotelStructure.RoomRateInfo tmpRoomRateInfo = new EyouSoft.Model.HotelStructure.RoomRateInfo();
            string strTmpStartDate = HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "StartDate").Trim();

            if (!string.IsNullOrEmpty(strTmpStartDate))
            {
                tmpRoomRateInfo.StartDate = DateTime.Parse(strTmpStartDate);
            }
            string strTmpEndDate = HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "EndDate").Trim();

            if (!string.IsNullOrEmpty(strTmpEndDate))
            {
                tmpRoomRateInfo.EndDate = DateTime.Parse(strTmpEndDate);
            }
            string strTmpPayment = HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "Payment").Trim();

            if (!string.IsNullOrEmpty(strTmpPayment))
            {
                tmpRoomRateInfo.Payment = (EyouSoft.HotelBI.HBEPaymentType)Enum.Parse(typeof(EyouSoft.HotelBI.HBEPaymentType), strTmpPayment);
            }
            tmpRoomRateInfo.Internet    = HotelBI.Utils.GetXElement(tmpRoomRate, "Internet").Value.Trim().ToLower() == "y" ? true : false;
            tmpRoomRateInfo.Quantity    = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(tmpRoomRate, "Quantity").Value.Trim());
            tmpRoomRateInfo.MaxGuestNum = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(tmpRoomRate, "MaxGuestNum").Value.Trim());
            tmpRoomRateInfo.AmountPrice = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXAttributeValue(HotelBI.Utils.GetXElement(tmpRoomRate, "Total"), "AmountPrice").Trim());
            string strAvailabilityStatus = HotelBI.Utils.GetXAttributeValue(tmpRoomRate, "AvailabilityStatus").Trim();

            if (!string.IsNullOrEmpty(strAvailabilityStatus))
            {
                tmpRoomRateInfo.AvailabilityStatus = (EyouSoft.Model.HotelStructure.RoomState)Enum.Parse(typeof(EyouSoft.Model.HotelStructure.RoomState), strAvailabilityStatus);
            }

            GetBookPolicyByXML(tmpRoomRate, ref tmpRoomRateInfo);

            tmpRoomTypeInfo.RoomRate = tmpRoomRateInfo;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 绑定房型
        /// </summary>
        protected void BindRate()
        {   //酒店实体不为空
            bool   IsLogin = Utils.GetQueryStringValue("IsLogin") == "True";
            string login   = "";

            if (!IsLogin)
            {
                login = "******"" + EyouSoft.Security.Membership.UserProvider.BuildLoginAndReturnUrl(Request.UrlReferrer.ToString(), "登录") + "\"><font class=\"C_red\" style=\"font-weight:normal\">登录查看</font></a>";
            }
            if (hotelModel != null)
            {
                IList <EyouSoft.Model.HotelStructure.RoomTypeInfo> typeList = hotelModel.RoomTypeList;
                if (typeList != null && typeList.Count > 0)
                {
                    StringBuilder strBuilder = new StringBuilder();
                    EyouSoft.Model.HotelStructure.RoomTypeInfo typeInfo1 = typeList[0];
                    Dictionary <string, decimal> efs = new Dictionary <string, decimal>();
                    foreach (EyouSoft.Model.HotelStructure.RateInfo rInfo in typeInfo1.RoomRate.RateInfos)
                    {
                        if (rInfo.ExcessiveFees != null)
                        {
                            foreach (EyouSoft.Model.HotelStructure.ExcessiveFee ef in rInfo.ExcessiveFees)
                            {
                                if (efs.ContainsKey(ef.FeeName))
                                {
                                    efs[ef.FeeName] += ef.Amount;
                                }
                                else
                                {
                                    efs.Add(ef.FeeName, ef.Amount);
                                }
                            }
                        }
                    }
                    StringBuilder efBuilder = new StringBuilder();
                    foreach (KeyValuePair <string, decimal> ef in efs)
                    {
                        efBuilder.AppendFormat("{0}:{1}({2}至{3})<br/>", ef.Key, ef.Value, comeDate, leaveDate);
                    }
                    efPriceHTML = efBuilder.ToString();
                    foreach (EyouSoft.Model.HotelStructure.RoomTypeInfo typeInfo in typeList)
                    {
                        if (typeInfo.RoomRate != null && typeInfo.RoomRate.RateInfos != null && typeInfo.RoomRate.RateInfos.Count > 0)
                        {
                            EyouSoft.Model.HotelStructure.RateInfo rateInfo = typeInfo.RoomRate.RateInfos[0];
                            strBuilder.AppendFormat("<tr><td height=\"25\" align=\"center\" nowrap=\"nowrap\" bgcolor=\"#FFFFFF\"><font class=\"C_Grb\">{0}</font></td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">¥<del>{1}</del></td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">¥{2}</td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">¥{3}</td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\"><font class=\"frb\">{4}</font></td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\"><font class=\"C_Grb\"><strong>{5}</strong></font></td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">{6}</td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">{7}</td>" +
                                                    "<td align=\"center\" bgcolor=\"#FFFFFF\">{8}</td>" +
                                                    "<td rowspan=\"2\" align=\"center\" valign=\"middle\" bgcolor=\"#FFFFFF\"><a href=\"HotelBook.aspx?hotelCode={11}&comeDate={12}&leaveDate={13}&roomCode={14}&vendorCode={15}&ratePlanCode={16}&cityId={17}\"><img src=\"{9}/images/hotel/yuding.gif\" /></a></td></tr>" +
                                                    "<tr><td height=\"25\" colspan=\"9\" align=\"left\" nowrap=\"nowrap\" bgcolor=\"#FFFFFF\"><font class=\"fbb\">房型描述:</font>{10}</td></tr>", typeInfo.RoomTypeName, rateInfo.DisplayPrice, Utils.GetMoney(rateInfo.AmountPrice), Utils.GetMoney(rateInfo.CommissionAmount), IsLogin ? (Utils.GetMoney(rateInfo.Percent * 100) + "%") : login, IsLogin ? ("¥" + decimal.Round(rateInfo.BalancePrice)) : login, rateInfo.FreeMeal == 0 ? "无" : rateInfo.FreeMeal.ToString(), typeInfo.BedType, typeInfo.RoomRate.Internet ? "有" : "无", ImageServerPath, Utils.GetText2(typeInfo.RoomDescription, 48, true), hotelCode, comeDate, leaveDate, typeInfo.RoomTypeCode, typeInfo.VendorCode, typeInfo.RatePlanCode, cityId);
                        }
                    }
                    strRateHtml = strBuilder.ToString();
                }
            }
            string method = Utils.GetQueryStringValue("method");

            if (method == "changeDate")
            {
                Response.Clear();
                Response.Write(strRateHtml);
                Response.End();
                return;
            }
        }
Exemplo n.º 7
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");
                }
            }
        }