Beispiel #1
0
        /// <summary>
        /// 解析价格明细
        /// </summary>
        /// <param name="xRoomRate">XElement</param>
        /// <returns></returns>
        private IList <EyouSoft.Model.HotelStructure.RateInfo> ParseResRates(XElement xRoomRate)
        {
            IList <EyouSoft.Model.HotelStructure.RateInfo> rates = new List <EyouSoft.Model.HotelStructure.RateInfo>();
            var xRates           = xRoomRate.Element("Rates");
            var iEnumerableRates = Utils.GetXElements(xRates, "Rate");

            foreach (var xRate in iEnumerableRates)
            {
                DateTime startDate = EyouSoft.Common.Utility.GetDateTime(Utils.GetXAttributeValue(xRate, "StartDate"), DateTime.Now);
                DateTime endDate   = EyouSoft.Common.Utility.GetDateTime(Utils.GetXAttributeValue(xRate, "EndDate"), DateTime.Now);
                int      days      = (endDate - startDate).Days;

                for (int i = 0; i <= days; i++)
                {
                    var rate = new EyouSoft.Model.HotelStructure.RateInfo();
                    rate.CurrData     = startDate.AddDays(i);
                    rate.AmountPrice  = EyouSoft.Common.Utility.GetDecimal(Utils.GetXAttributeValue(xRate, "AmountPrice"));
                    rate.DisplayPrice = EyouSoft.Common.Utility.GetDecimal(Utils.GetXAttributeValue(xRate, "DisplayPrice"));
                    var xFreeMeal = Utils.GetXElement(xRate, "FreeMeal");
                    rate.FreeMeal = Common.Utility.GetInt(xFreeMeal.Value);

                    rates.Add(rate);
                }
            }

            return(rates);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
                }
            }
        }
Beispiel #4
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;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 绑定酒店房费列表
        /// </summary>
        protected void GetRateInfoList()
        {
            //是否存在房费明细
            if (orderModel != null && orderModel.Rates != null && orderModel.Rates.Count > 0)
            {
                IList <EyouSoft.Model.HotelStructure.RateInfo> rateList = orderModel.Rates; //获取价格明细列表

                StringBuilder strBuilder1 = new StringBuilder();                            //结算价行
                StringBuilder strBuilder2 = new StringBuilder();                            //反佣价行
                StringBuilder strBuilder3 = new StringBuilder();                            //早餐行
                StringBuilder strBuilder  = new StringBuilder();                            //整个房费构造
                //构造表标题
                strBuilder.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" +
                                  "<tr><th align=\"center\">&nbsp;</th>" +
                                  "<th align=\"center\">月/日</th>" +
                                  "<th align=\"center\">周一</th>" +
                                  "<th align=\"center\">周二</th>" +
                                  "<th align=\"center\">周三</th>" +
                                  "<th align=\"center\">周四</th>" +
                                  "<th align=\"center\">周五</th>" +
                                  "<th align=\"center\">周六</th>" +
                                  "<th align=\"center\">周日</th>" +
                                  "<th align=\"center\">每间总价</th>" +
                                  "<th align=\"center\">总计</th>" +
                                  "</tr>");
                DateTime firstDate = orderModel.CheckInDate;  //入住日期
                DateTime endDate   = orderModel.CheckOutDate; //离店日期
                //从入住日期到离店日期循环
                int forIndex = 1;                             //星期段循环index
                int forNum   = 1;                             //总共能循环的星期数
                for (DateTime nowDate = firstDate; firstDate <= endDate; nowDate = nowDate.AddDays(1))
                {
                    //判断是否是入住日期

                    if (firstDate == nowDate)
                    {
                        int dayInt      = (int)nowDate.DayOfWeek;                                   //获取入住日当前星期(0,1,2…6)
                        int dayToMonday = dayInt == 0 ? 6 : dayInt - 1;                             //获取前补列数
                        int dayToSunday = dayInt == 0 ? 0 : 7 - dayInt;                             //获取候补列数

                        int dayInt2      = (int)endDate.DayOfWeek;                                  //获取离店日当前星期(0,1,2…6)
                        int dayToSunday2 = dayInt2 == 0 ? 0 : 7 - dayInt2;                          //获取候补列数

                        forNum = ((endDate - firstDate).Days + dayToMonday + dayToSunday2 + 1) / 7; //星期获取循环次数(为了计算总计列的跨行数)

                        DateTime overDate = nowDate.AddDays(dayToSunday);                           //获取第一个星期的结束日
                        if (overDate > endDate)                                                     //如果结束日期大于离店日期则取离店日期
                        {
                            overDate = endDate;
                        }
                        strBuilder1.AppendFormat("<tr><td align=\"center\" class=\"orange\">售价</td><td rowspan=\"3\" align=\"center\">{0}<br />-<br />{1}</td>", nowDate.ToString("yyyy-MM-dd"), overDate.ToString("yyyy-MM-dd"));
                        strBuilder2.Append("<tr><td align=\"center\" class=\"orange\">返佣价</td>");
                        strBuilder3.Append("<tr><td align=\"center\" class=\"orange\">早餐</td>");
                        //前补列
                        for (var i = 1; i <= dayToMonday; i++)
                        {
                            strBuilder1.Append("<td align=\"center\"></td>");
                            strBuilder2.Append("<td align=\"center\"></td>");
                            strBuilder3.Append("<td align=\"center\"></td>");
                        }
                    }
                    //查找跟当前日期匹配的价格明细如果没有则输出空白列
                    EyouSoft.Model.HotelStructure.RateInfo rateInfo = rateList.FirstOrDefault(r => r.CurrData == nowDate);

                    strBuilder1.AppendFormat("<td align=\"center\">{0}</td>", rateInfo == null ? "" : "¥" + EyouSoft.Common.Utils.GetMoney(rateInfo.AmountPrice));
                    strBuilder2.AppendFormat("<td align=\"center\">{0}</td>", rateInfo == null ? "" : "¥" + EyouSoft.Common.Utils.GetMoney(rateInfo.CommissionAmount));
                    strBuilder3.AppendFormat("<td align=\"center\">{0}</td>", rateInfo == null ? "" : rateInfo.FreeMeal == 0 ? "无" : rateInfo.FreeMeal.ToString());
                    //总计列的跨行输出(如果是第一个星期段循环,如果是星期日则输出该列)
                    if (forIndex == 1)
                    {
                        if (nowDate.DayOfWeek == 0)
                        {
                            decimal CommissionAmount1 = rateList.Sum(r => r.CommissionAmount);
                            strBuilder1.AppendFormat(" <td class=\"orange strong\" rowspan=\"{0}\" align=\"center\">销售价:<br />¥{1}<br />返佣价:<br />¥{2}</td> <td class=\"orange strong\" rowspan=\"{0}\" align=\"center\">销售价:<br />¥{3}<br />返佣价:<br />¥{4}</td>", forNum * 3, orderModel.TotalAmount / (orderModel.Quantity == 0 ? 1 : orderModel.Quantity), CommissionAmount1, EyouSoft.Common.Utils.GetMoney(orderModel.TotalAmount), EyouSoft.Common.Utils.GetMoney(CommissionAmount1 * orderModel.Quantity));
                            forIndex++;
                        }
                    }
                    //判断是否是最后一个日期
                    if (nowDate == endDate)
                    {
                        int dayInt      = (int)nowDate.DayOfWeek;       //获取当前星期(0,1,2…6)
                        int dayToSunday = dayInt == 0 ? 0 : 7 - dayInt; //获取候补列数
                        //进行补后列操作
                        for (var i = 1; i <= dayToSunday; i++)
                        {
                            strBuilder1.Append("<td align=\"center\"></td>");
                            strBuilder2.Append("<td align=\"center\"></td>");
                            strBuilder3.Append("<td align=\"center\"></td>");
                        }
                        if (forIndex == 1)
                        {
                            if (nowDate.DayOfWeek != 0)
                            {
                                decimal CommissionAmount1 = rateList.Sum(r => r.CommissionAmount);
                                strBuilder1.AppendFormat(" <td class=\"orange strong\" rowspan=\"{0}\" align=\"center\">销售价:<br />¥{1}<br />返佣价:<br />¥{2}</td> <td class=\"orange strong\" rowspan=\"{0}\" align=\"center\">销售价:<br />¥{3}<br />返佣价:<br />¥{4}</td>", forNum * 3, EyouSoft.Common.Utils.GetMoney(orderModel.TotalAmount / (orderModel.Quantity == 0 ? 1 : orderModel.Quantity)), EyouSoft.Common.Utils.GetMoney(CommissionAmount1), EyouSoft.Common.Utils.GetMoney(orderModel.TotalAmount), EyouSoft.Common.Utils.GetMoney(CommissionAmount1 * orderModel.Quantity));
                                forIndex++;
                            }
                        }
                        //结尾输出
                        strBuilder1.Append("</tr>"); //结算价行结束
                        strBuilder2.Append("</tr>"); //反佣价行结束
                        strBuilder3.Append("</tr>"); //早餐行结束
                        //整个房费结束
                        strBuilder.AppendFormat("{0}{1}{2}</table>", strBuilder1.ToString(), strBuilder2.ToString(), strBuilder3.ToString());
                        break;//方法返回
                    }
                    //判断是否是星期日
                    if (nowDate.DayOfWeek == 0)
                    {
                        strBuilder1.Append("</tr>");             //结算价行结束
                        strBuilder2.Append("</tr>");             //反佣价行结束
                        strBuilder3.Append("</tr>");             //早餐行结束
                        DateTime lastDate1 = nowDate.AddDays(1); //下个开始日期
                        DateTime lastDate2 = nowDate.AddDays(7); //下个结束日期
                        if (lastDate2 > endDate)                 //如果下个结束日期超过离店日期则用离店日期
                        {
                            lastDate2 = endDate;
                        }
                        strBuilder.Append(strBuilder1.ToString() + strBuilder2.ToString() + strBuilder3.ToString());//星期段结束添加到strBuilder
                        //重新设置builder
                        strBuilder1 = new StringBuilder();
                        strBuilder2 = new StringBuilder();
                        strBuilder3 = new StringBuilder();

                        //开始换行操作进入下个星期段循环
                        strBuilder1.AppendFormat("<tr><td align=\"center\" class=\"orange\">售价</td><td rowspan=\"3\" align=\"center\">{0}<br />-<br />{1}</td>", lastDate1.ToString("yyyy-MM-dd"), lastDate2.ToString("yyyy-MM-dd"));
                        strBuilder2.Append("<tr><td align=\"center\" class=\"orange\">返佣价</td>");
                        strBuilder3.Append("<tr><td align=\"center\" class=\"orange\">早餐</td>");
                    }
                }
                hotelRateList = strBuilder.ToString();//酒店房费列表HTML
            }
        }
Beispiel #6
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");
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 解析XML获取额外收费项目信息
        /// </summary>
        /// <param name="strTmpRatePlan">当前价格计划代码</param>
        /// <param name="strTmpRoomType">当前房型代码</param>
        /// <param name="strTmpVendorCode">当前供应商代码</param>
        /// <param name="tmpRoomRate">当前房型价格信息节点</param>
        /// <param name="DateRateS">当前房型的价格详细开始日期</param>
        /// <param name="DateRateE">当前房型的价格详细结束日期</param>
        /// <param name="tmpRateInfo">房型价格详细信息实体</param>
        public void GetExcessiveFeeByXML(string strTmpRatePlan, string strTmpRoomType, string strTmpVendorCode,
                                         XElement tmpRoomRate, DateTime DateRateS, DateTime DateRateE, ref EyouSoft.Model.HotelStructure.RateInfo tmpRateInfo)
        {
            //额外收费项目信息集合
            IEnumerable <XElement> Fees = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(tmpRoomRate, "Fees"), "Fee");

            tmpRateInfo.ExcessiveFees = new List <EyouSoft.Model.HotelStructure.ExcessiveFee>();
            EyouSoft.Model.HotelStructure.ExcessiveFee FeeModel = null;
            foreach (XElement tmpFee in Fees)
            {
                string strTmpFeeStartDate = HotelBI.Utils.GetXAttributeValue(tmpFee, "StartDate").Trim();
                string strTmpFeeEndDate   = HotelBI.Utils.GetXAttributeValue(tmpFee, "EndDate").Trim();
                if (string.IsNullOrEmpty(strTmpFeeStartDate) || string.IsNullOrEmpty(strTmpFeeEndDate))
                {
                    continue;
                }

                DateTime DateFeeS = DateTime.Parse(strTmpFeeStartDate);
                DateTime DateFeeE = DateTime.Parse(strTmpFeeEndDate);
                TimeSpan TSS      = DateRateS - DateFeeS;
                TimeSpan TSE      = DateRateE - DateFeeE;

                //价格计划代码、房型代码、供应商代码都匹配后计算日期
                //比开始时间大、比结束时间小
                if (strTmpRatePlan == HotelBI.Utils.GetXAttributeValue(tmpFee, "RatePlanCode").Trim() &&
                    strTmpVendorCode == HotelBI.Utils.GetXAttributeValue(tmpFee, "VendorCode").Trim() &&
                    strTmpRoomType == HotelBI.Utils.GetXAttributeValue(tmpFee, "RoomTypeCode").Trim() &&
                    TSS.Days >= 0 && TSE.Days <= 0
                    )
                {
                    FeeModel = new EyouSoft.Model.HotelStructure.ExcessiveFee();

                    FeeModel.FeeName         = HotelBI.Utils.GetXAttributeValue(tmpFee, "FeeName").Trim();
                    FeeModel.FeeCode         = HotelBI.Utils.GetXAttributeValue(tmpFee, "FeeCode").Trim();
                    FeeModel.ChargeFrequence = HotelBI.Utils.GetXElement(tmpFee, "ChargeFrequence").Value.Trim();
                    FeeModel.Amount          = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXElement(tmpFee, "Amount").Value.Trim());
                    FeeModel.ChargeUnit      = HotelBI.Utils.GetXElement(tmpFee, "ChargeUnit").Value.Trim();
                    FeeModel.Comments        = HotelBI.Utils.GetXElement(tmpFee, "Comments").Value.Trim();
                    FeeModel.Count           = EyouSoft.Common.Utility.GetInt(HotelBI.Utils.GetXElement(tmpFee, "Count").Value.Trim());

                    tmpRateInfo.ExcessiveFees.Add(FeeModel);
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// 解析XML获取房型返佣信息
        /// </summary>
        /// <param name="strTmpRatePlan">当前价格计划代码</param>
        /// <param name="strTmpRoomType">当前房型代码</param>
        /// <param name="strTmpVendorCode">当前供应商代码</param>
        /// <param name="tmpRoomRate">当前房型价格信息节点</param>
        /// <param name="DateRateS">当前房型的价格详细开始日期</param>
        /// <param name="DateRateE">当前房型的价格详细结束日期</param>
        /// <param name="tmpRateInfo">房型价格详细信息实体</param>
        private void GetCommissionByXML(string strTmpRatePlan, string strTmpRoomType, string strTmpVendorCode,
                                        XElement tmpRoomRate, DateTime DateRateS, DateTime DateRateE, ref EyouSoft.Model.HotelStructure.RateInfo tmpRateInfo)
        {
            //返佣信息集合
            IEnumerable <XElement> Commissions = HotelBI.Utils.GetXElements(HotelBI.Utils.GetXElement(tmpRoomRate, "Commissions"), "Commission");

            foreach (XElement tmpCommission in Commissions)
            {
                string strTmpCommissionStartDate = HotelBI.Utils.GetXAttributeValue(tmpCommission, "StartDate").Trim();
                string strTmpCommissionEndDate   = HotelBI.Utils.GetXAttributeValue(tmpCommission, "EndDate").Trim();
                if (string.IsNullOrEmpty(strTmpCommissionStartDate) || string.IsNullOrEmpty(strTmpCommissionEndDate))
                {
                    continue;
                }

                DateTime DateCommissionS = DateTime.Parse(strTmpCommissionStartDate);
                DateTime DateCommissionE = DateTime.Parse(strTmpCommissionEndDate);
                TimeSpan TSS             = DateRateS - DateCommissionS;
                TimeSpan TSE             = DateRateE - DateCommissionE;

                //价格计划代码、房型代码、供应商代码都匹配后计算日期
                //比开始时间大、比结束时间小
                if (strTmpRatePlan == HotelBI.Utils.GetXAttributeValue(tmpCommission, "RatePlanCode").Trim() &&
                    strTmpVendorCode == HotelBI.Utils.GetXAttributeValue(tmpCommission, "VendorCode").Trim() &&
                    strTmpRoomType == HotelBI.Utils.GetXAttributeValue(tmpCommission, "RoomTypeCode").Trim() &&
                    TSS.Days >= 0 && TSE.Days <= 0
                    )
                {
                    string strCommissionType = HotelBI.Utils.GetXAttributeValue(tmpCommission, "CommissionType").Trim();
                    if (!string.IsNullOrEmpty(strCommissionType))
                    {
                        tmpRateInfo.CommissionType = (EyouSoft.HotelBI.HBECommissionType)Enum.Parse(typeof(EyouSoft.HotelBI.HBECommissionType), strCommissionType);
                    }
                    tmpRateInfo.Fix     = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXElement(tmpCommission, "Fix").Value.Trim());
                    tmpRateInfo.Percent = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXElement(tmpCommission, "Percent").Value.Trim());
                    tmpRateInfo.Tax     = EyouSoft.Common.Utility.GetDecimal(HotelBI.Utils.GetXElement(tmpCommission, "Tax").Value.Trim());
                }
            }
        }