/// <summary> /// 获取国家信息列表 /// </summary> /// <param name="CountryName">国家名称(为空时:查询所有;不为空时,按国家名称筛选)</param> /// <returns></returns> public IList <EyouSoft.Model.TicketStructure.TicketNationInfo> GetList(string CountryName) { IList <EyouSoft.Model.TicketStructure.TicketNationInfo> ResultList = new List <EyouSoft.Model.TicketStructure.TicketNationInfo>(); string StrSql = "SELECT [Id] AS NationId,[CountryCode],[CountryName] FROM [tbl_TicketNationInfo] "; DbCommand dc = null; if (!string.IsNullOrEmpty(CountryName)) { CountryName = "%" + CountryName + "%"; StrSql += " WHERE [CountryName] LIKE @CountryName"; dc = this.TicketStore.GetSqlStringCommand(StrSql); this.TicketStore.AddInParameter(dc, "CountryName", DbType.String, CountryName); } StrSql += " ORDER BY [CountryCode] ASC"; if (dc == null) { dc = this.TicketStore.GetSqlStringCommand(StrSql); } EyouSoft.Model.TicketStructure.TicketNationInfo model = null; using (IDataReader dr = DbHelper.ExecuteReader(dc, this.TicketStore)) { while (dr.Read()) { model = new EyouSoft.Model.TicketStructure.TicketNationInfo(); model.NationId = dr.GetInt32(dr.GetOrdinal("NationId")); model.CountryCode = dr.IsDBNull(dr.GetOrdinal("CountryCode")) ? "" : dr.GetString(dr.GetOrdinal("CountryCode")); model.CountryName = dr.IsDBNull(dr.GetOrdinal("CountryName")) ? "" : dr.GetString(dr.GetOrdinal("CountryName")); ResultList.Add(model); } } model = null; return(ResultList); }
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"); } } }