protected string orderState; // protected void Page_Load(object sender, EventArgs e) { this.CityAndMenu1.HeadMenuIndex = 4; if (!IsLogin) { Response.Redirect("~/Register/Login.aspx"); return; } HotelSearch1.CityId = Utils.GetInt(Utils.GetQueryStringValue("CityID")); CommonUser1.CityId = HotelSearch1.CityId; resOrderId = Utils.GetQueryStringValue("resOrderId"); EyouSoft.IBLL.HotelStructure.IHotelOrder orderBll = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance(); string method = Utils.GetQueryStringValue("method"); int errorCode = 0; // 错误代码 string errorDesc = ""; //错误描述 HotelSearch1.ImageServerPath = ImageServerPath; if (method != "cancel") { orderModel = orderBll.GetInfo(resOrderId, out errorCode, out errorDesc); if (orderModel == null) { orderModel = new EyouSoft.Model.HotelStructure.OrderInfo(); if (errorDesc == "") { errorDesc = "订单不存在"; } Utils.ShowError(errorDesc, "hotel"); return; } orderState = orderModel.OrderState.ToString(); IList <EyouSoft.HotelBI.HBEResGuestInfo> guestList = orderModel.ResGuests; if (guestList != null && guestList.Count > 0) { foreach (EyouSoft.HotelBI.HBEResGuestInfo guest in guestList) { guestNames += guest.PersonName + ","; //旅客姓名 guestTypes += (guest.GuestTypeIndicator == EyouSoft.HotelBI.HBEGuestTypeIndicator.D?"内宾":"外宾") + ","; //旅客类型 guestMible = guest.Mobile; //旅客手机 } guestNames = guestNames.TrimEnd(','); guestTypes = guestTypes.TrimEnd(','); } this.Page.Title = orderModel.HotelName + "_酒店预订完成_同业114酒店频道"; } else { if (orderBll.Cancel(resOrderId, "", out errorDesc) > 0) //取消订单 { Utils.ResponseMegSuccess(); //输出成功 } else { Utils.ResponseMeg(false, errorDesc == ""?"取消失败":errorDesc);//输出失败 } } }
private void TestCreateHotelOrder() { EyouSoft.Model.HotelStructure.OrderInfo info = new EyouSoft.Model.HotelStructure.OrderInfo(); info.HotelCode = "SOHOTO0738"; info.CityCode = "HGH"; info.CountryCode = "CN"; info.RatePlanCode = "BK002"; info.RoomTypeCode = "INCE003"; info.CheckInDate = DateTime.Parse("2010-12-07"); info.CheckOutDate = DateTime.Parse("2010-12-15"); info.VendorCode = "SOHOTO"; info.VendorName = "SOHOTO"; info.Quantity = 2; info.ArriveEarlyTime = "1600"; info.ArriveLateTime = "1800"; info.TotalAmount = 800; info.ResGuests = new List <EyouSoft.HotelBI.HBEResGuestInfo>(); EyouSoft.HotelBI.HBEResGuestInfo guest1 = new EyouSoft.HotelBI.HBEResGuestInfo(); guest1.GuestTypeIndicator = EyouSoft.HotelBI.HBEGuestTypeIndicator.D; guest1.IsMobileContact = true; guest1.Mobile = "15868456678"; guest1.PersonName = "test汪奇志"; info.ResGuests.Add(guest1); EyouSoft.HotelBI.HBEResGuestInfo guest2 = new EyouSoft.HotelBI.HBEResGuestInfo(); guest2.GuestTypeIndicator = EyouSoft.HotelBI.HBEGuestTypeIndicator.F; guest2.IsMobileContact = true; guest2.Mobile = "13777476875"; guest2.PersonName = "test张志瑜"; info.ResGuests.Add(guest2); info.ContacterFullname = "test周文超"; info.ContacterMobile = "15168353279"; info.IsMobileContact = true; info.BuyerCId = "201012030001"; info.BuyerUId = "201012030001"; info.SpecialRequest = "测试时的特殊要求"; string errorDesc; int result = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().Add(info, out errorDesc); if (result > 0) { //this.TestCancelHotelOrder(info.ResOrderId); Response.Write(info.ResOrderId); } }
protected void Page_Load(object sender, EventArgs e) { ImageServerUrl = EyouSoft.Common.ImageManage.GetImagerServerUrl(1); resOrderId = Utils.GetQueryStringValue("resOrderId"); EyouSoft.IBLL.HotelStructure.IHotelOrder orderBll = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance(); string method = Utils.GetQueryStringValue("method"); int errorCode = 0; // 错误代码 string errorDesc = ""; //错误描述 orderModel = orderBll.GetInfo(resOrderId, out errorCode, out errorDesc); if (orderModel == null) { orderModel = new EyouSoft.Model.HotelStructure.OrderInfo(); if (errorDesc == "") { errorDesc = "订单不存在"; } Utils.ShowError(errorDesc, "hotel"); return; } userName = orderModel.BuyerUName; IList <EyouSoft.HotelBI.HBEResGuestInfo> guestList = orderModel.ResGuests; if (guestList != null && guestList.Count > 0) { foreach (EyouSoft.HotelBI.HBEResGuestInfo guest in guestList) { guestNames += guest.PersonName + ","; //旅客姓名 guestTypes += guest.GuestTypeIndicator.ToString() + ","; //旅客类型 guestMible = guest.Mobile; //旅客手机 } } //EyouSoft.HotelBI.SingleSeach searchModel = new EyouSoft.HotelBI.SingleSeach(); //searchModel.HotelCode = orderModel.HotelCode;//酒店代码 //searchModel.CheckInDate = orderModel.CheckInDate.ToString("yyyy-MM-dd");//入住日期 //searchModel.CheckOutDate = orderModel.CheckOutDate.ToString("yyyy-MM-dd");//离店日期 //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);//获取酒店实体 //string theMess = IsOk(errorInfo, hotelModel); //if (theMess != "") //{ // Utils.ShowError(theMess, ""); // return; //} GetRateInfoList(); }
/// <summary> /// 添加订单 /// </summary> /// <param name="model">酒店订单实体</param> /// <returns>true:成功 false:失败</returns> public virtual bool Add(EyouSoft.Model.HotelStructure.OrderInfo model) { model.OrderId = Guid.NewGuid().ToString(); #region 构造旅客信息SQL StringBuilder strTravellers = new StringBuilder();//存储旅客SQL if (model.ResGuests != null && model.ResGuests.Count > 0) { foreach (EyouSoft.HotelBI.HBEResGuestInfo info in model.ResGuests) { strTravellers.AppendFormat(Sql_HotelTraveller_INSERT, model.OrderId, info.PersonName, (int)info.GuestTypeIndicator, info.Mobile); } } #endregion DbCommand dc = this._database.GetSqlStringCommand(Sql_HotelOrder_INSERT + strTravellers.ToString()); this._database.AddInParameter(dc, "OrderId", DbType.AnsiStringFixedLength, model.OrderId); this._database.AddInParameter(dc, "BuyerCId", DbType.AnsiStringFixedLength, model.BuyerCId); this._database.AddInParameter(dc, "BuyerCName", DbType.String, model.BuyerCName); this._database.AddInParameter(dc, "BuyerUFullname", DbType.String, model.BuyerUFullName); this._database.AddInParameter(dc, "BuyerUId", DbType.AnsiStringFixedLength, model.BuyerUId); this._database.AddInParameter(dc, "BuyerUName", DbType.String, model.BuyerUName); this._database.AddInParameter(dc, "CheckInDate", DbType.DateTime, model.CheckInDate); this._database.AddInParameter(dc, "CheckOutDate", DbType.DateTime, model.CheckOutDate); this._database.AddInParameter(dc, "CheckState", DbType.Int32, (int)model.CheckState); this._database.AddInParameter(dc, "CityCode", DbType.String, model.CityCode); this._database.AddInParameter(dc, "CommissionFix", DbType.Decimal, model.CommissionFix); this._database.AddInParameter(dc, "CommissionPercent", DbType.Decimal, model.CommissionPercent); this._database.AddInParameter(dc, "CommissionType", DbType.Int32, (int)model.CommissionType); this._database.AddInParameter(dc, "ContacterFullname", DbType.String, model.ContacterFullname); this._database.AddInParameter(dc, "ContacterMobile", DbType.String, model.ContacterMobile); this._database.AddInParameter(dc, "ContacterTelephone", DbType.String, model.ContacterTelephone); this._database.AddInParameter(dc, "CreateDateTime", DbType.DateTime, DateTime.Now); this._database.AddInParameter(dc, "HotelCode", DbType.String, model.HotelCode); this._database.AddInParameter(dc, "HotelName", DbType.String, model.HotelName); this._database.AddInParameter(dc, "IsMobileContact", DbType.String, model.IsMobileContact?"1":"0"); this._database.AddInParameter(dc, "OrderState", DbType.Int32, (int)model.ResStatus); this._database.AddInParameter(dc, "OrderType", DbType.Int32, (int)model.OrderType); this._database.AddInParameter(dc, "PaymentType", DbType.Int32, (int)model.PaymentType); this._database.AddInParameter(dc, "ResOrderId", DbType.String, model.ResOrderId); this._database.AddInParameter(dc, "RoomTypeCode", DbType.String, model.RoomTypeCode); this._database.AddInParameter(dc, "RoomTypeName", DbType.String, model.RoomTypeName); this._database.AddInParameter(dc, "TotalAmount", DbType.Decimal, model.TotalAmount); this._database.AddInParameter(dc, "RatePlanCode", DbType.String, model.RatePlanCode); this._database.AddInParameter(dc, "VendorCode", DbType.String, model.VendorCode); this._database.AddInParameter(dc, "Remark", DbType.String, model.Comments); return(DbHelper.ExecuteSqlTrans(dc, this._database) > 0 ? true : false); }
/// <summary> /// 根据订单号获取订单信息 /// </summary> /// <param name="ResOrderId">订单号</param> /// <returns></returns> public virtual EyouSoft.Model.HotelStructure.OrderInfo GetOrderInfo(string ResOrderId) { EyouSoft.Model.HotelStructure.OrderInfo model = null; DbCommand dc = this._database.GetSqlStringCommand(Sql_HotelOrder_GETORDERINFO); this._database.AddInParameter(dc, "ResOrderId", DbType.String, ResOrderId); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { if (dr.Read()) { model = new EyouSoft.Model.HotelStructure.OrderInfo(); model.OrderId = dr[dr.GetOrdinal("OrderId")].ToString(); model.ResOrderId = dr[dr.GetOrdinal("ResOrderId")].ToString(); model.BuyerUName = dr[dr.GetOrdinal("BuyerUName")].ToString(); model.BuyerUFullName = dr[dr.GetOrdinal("BuyerUFullname")].ToString(); model.ContacterFullname = dr[dr.GetOrdinal("ContacterFullname")].ToString(); model.ContacterMobile = dr[dr.GetOrdinal("ContacterMobile")].ToString(); model.ContacterTelephone = dr[dr.GetOrdinal("ContacterTelephone")].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("OrderState"))) { model.ResStatus = (EyouSoft.HotelBI.HBEResStatus) int.Parse(dr[dr.GetOrdinal("OrderState")].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("CheckState"))) { model.CheckState = (EyouSoft.Model.HotelStructure.CheckStateList) int.Parse(dr[dr.GetOrdinal("CheckState")].ToString()); } model.HotelName = dr[dr.GetOrdinal("HotelName")].ToString(); model.RoomTypeName = dr[dr.GetOrdinal("RoomTypeName")].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("CheckInDate"))) { model.CheckInDate = DateTime.Parse(dr[dr.GetOrdinal("CheckInDate")].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("CheckOutDate"))) { model.CheckOutDate = DateTime.Parse(dr[dr.GetOrdinal("CheckOutDate")].ToString()); } model.TotalAmount = decimal.Parse(dr[dr.GetOrdinal("TotalAmount")].ToString()); model.CommissionPercent = decimal.Parse(dr[dr.GetOrdinal("CommissionPercent")].ToString()); model.CommissionFix = decimal.Parse(dr[dr.GetOrdinal("CommissionFix")].ToString()); model.BuyerCId = dr[dr.GetOrdinal("BuyerCId")].ToString(); model.ResGuests = GetTravellers(dr[dr.GetOrdinal("Travellers")].ToString()); model.Comments = dr[dr.GetOrdinal("Remark")].ToString(); } } return(model); }
/// <summary> /// 发送预订指令,正值时成功,负值或0时失败 /// </summary> /// <param name="info">订单信息业务实体</param> /// <param name="errorDesc">错误描述</param> /// <returns>正值:成功 负值或0失败</returns> private int CreateOrderRequest(EyouSoft.Model.HotelStructure.OrderInfo info, out string errorDesc) { errorDesc = string.Empty; #region 发送指令 int createOrderRequestResult = 1; info.ResponseXML = Utils.CreateRequest(info.RequestXML); ErrorInfo errorInfo = Utils.ResponseErrorHandling(info.ResponseXML); switch (errorInfo.ErrorType) { case ErrorType.未知错误: createOrderRequestResult = -1000; break; case ErrorType.系统级错误: createOrderRequestResult = -1001; break; case ErrorType.业务级错误: createOrderRequestResult = -1002; errorDesc = errorInfo.ErrorDesc; break; } if (createOrderRequestResult < 1) { return(createOrderRequestResult); } #endregion try { XElement xResponse = XElement.Parse(info.ResponseXML); XElement xHotelReservation = xResponse.Element("HotelResRS").Element("HotelReservations").Element("HotelReservation");// Utils.GetXElement(Utils.GetXElement(Utils.GetXElement(xResponse, "HotelResRS"), "HotelReservations"), "HotelReservation"); info.ResOrderId = Utils.GetXAttributeValue(xHotelReservation, "ResOrderID"); } catch { createOrderRequestResult = -1003; } if (createOrderRequestResult != -1003 && string.IsNullOrEmpty(info.ResOrderId)) { createOrderRequestResult = -1004; } return(createOrderRequestResult); }
/*/// <summary> * /// 根据酒店接口(HBE)订单状态获取平台酒店订单状态 * /// </summary> * /// <param name="orderHintState">酒店接口(HBE)订单状态</param> * /// <returns></returns> * private EyouSoft.Model.HotelStructure.OrderStateList GetOrderStateByResStatus(EyouSoft.HotelBI.HBEResStatus orderResState) * { * EyouSoft.Model.HotelStructure.OrderStateList state = EyouSoft.Model.HotelStructure.OrderStateList.处理中; * * return state; * }*/ #endregion #region IHotelOrder 成员 /// <summary> /// 添加订单,正值时成功,负值或0时失败 /// </summary> /// <param name="model">酒店订单实体</param> /// <param name="errorDesc">错误描述</param> /// <returns>正值:成功 负值或0:失败</returns> public int Add(EyouSoft.Model.HotelStructure.OrderInfo model, out string errorDesc) { errorDesc = string.Empty; #region 验证 if (model == null) { return(0); } if (string.IsNullOrEmpty(model.HotelCode)) { return(-1); } if (string.IsNullOrEmpty(model.CityCode)) { return(-2); } if (string.IsNullOrEmpty(model.CountryCode)) { return(-3); } if (string.IsNullOrEmpty(model.RatePlanCode)) { return(-4); } if (string.IsNullOrEmpty(model.RoomTypeCode)) { return(-5); } if (model.CheckInDate == DateTime.MinValue) { return(-6); } if (model.CheckOutDate == DateTime.MinValue) { return(-7); } if (string.IsNullOrEmpty(model.VendorCode)) { return(-8); } if (string.IsNullOrEmpty(model.VendorName)) { return(-9); } if (model.Quantity <= 0) { return(-10); } if (string.IsNullOrEmpty(model.ArriveEarlyTime)) { return(-11); } if (string.IsNullOrEmpty(model.ArriveLateTime)) { return(-12); } if (model.TotalAmount <= 0) { return(-13); } if (model.ResGuests == null || model.ResGuests.Count < 1) { return(-14); } if (string.IsNullOrEmpty(model.ResGuests[0].PersonName)) { return(-15); } if (string.IsNullOrEmpty(model.ResGuests[0].Mobile)) { return(-16); } if (string.IsNullOrEmpty(model.ContacterFullname)) { return(-17); } if (string.IsNullOrEmpty(model.ContacterMobile)) { return(-18); } if (string.IsNullOrEmpty(model.BuyerCId)) { return(-19); } if (string.IsNullOrEmpty(model.BuyerUId)) { return(-20); } if (model.CheckInDate < DateTime.Today) { return(-21); } int datediff = (model.CheckOutDate - model.CheckInDate).Days; if (datediff < 1) { return(-22); } if (datediff > 30) { return(-23); } model.CreateDateTime = DateTime.Now; model.OrderId = Guid.NewGuid().ToString(); model.CheckState = EyouSoft.Model.HotelStructure.CheckStateList.待审结; model.ResStatus = HBEResStatus.RES; #endregion int orderRequestResult = this.CreateOrderRequest(model, out errorDesc); if (orderRequestResult < 1) { return(orderRequestResult); } return(dal.Add(model) ? 1 : -101); }
/// <summary> /// 解析订单详细信息返回指令 /// </summary> /// <param name="xml">返回指令</param> /// <param name="errorCode">错误代码 正值:成功 负值或0:失败</param> /// <returns></returns> private EyouSoft.Model.HotelStructure.OrderInfo ParseOrderDetailResponseXML(string xml, out int errorCode) { errorCode = 1; EyouSoft.Model.HotelStructure.OrderInfo info = null; try { info = new EyouSoft.Model.HotelStructure.OrderInfo(); XElement xResponse = XElement.Parse(xml); XElement xHotelResDetailSearchRS = xResponse.Element("HotelResDetailSearchRS"); XElement xHotelReservations = xHotelResDetailSearchRS.Element("HotelReservations"); XElement xHotelReservation = xHotelReservations.Element("HotelReservation"); //XElement xHotelReservation = xResponse.Element("HotelResDetailSearchRS").Element("HotelReservations").Element("HotelReservation"); info.CreateDateTime = EyouSoft.Common.Utility.GetDateTime112(Utils.GetXAttributeValue(xHotelReservation, "CreateDateTime")); info.ResOrderId = Utils.GetXAttributeValue(xHotelReservation, "ResOrderId"); info.ResStatus = (HBEResStatus)Enum.Parse(typeof(HBEResStatus), Utils.GetXAttributeValue(xHotelReservation, "ResStatus")); info.TotalAmount = Common.Utility.GetDecimal(xHotelReservation.Element("TotalAmount").Value); XElement xRoomStays = xHotelReservation.Element("RoomStays"); XElement xRoomStay = xRoomStays.Element("RoomStay"); XElement xBasicProperty = xRoomStay.Element("BasicProperty"); info.HotelCode = Utils.GetXAttributeValue(xBasicProperty, "HotelCode"); info.HotelName = Utils.GetXAttributeValue(xBasicProperty, "HotelName"); info.CityCode = Utils.GetXAttributeValue(xBasicProperty, "CityCode"); info.CityName = Utils.GetXAttributeValue(xBasicProperty, "CityName"); info.Quantity = Common.Utility.GetInt(xBasicProperty.Element("RoomQuantity").Value); info.SpecialRequest = Utils.GetXElement(xRoomStay, "SpecialRequest").Value; XElement xTimeSpan = Utils.GetXElement(xRoomStay, "TimeSpan"); info.CheckInDate = EyouSoft.Common.Utility.GetDateTime(Utils.GetXAttributeValue(xTimeSpan, "StartDate")); info.CheckOutDate = EyouSoft.Common.Utility.GetDateTime(Utils.GetXAttributeValue(xTimeSpan, "EndDate")); XElement xRoomRates = xRoomStay.Element("RoomRates"); XElement xRoomRate = xRoomRates.Element("RoomRate"); info.RoomTypeCode = Utils.GetXAttributeValue(xRoomRate, "RoomTypeCode"); info.RoomTypeName = Utils.GetXAttributeValue(xRoomRate, "RoomTypeName"); info.Rates = this.ParseResRates(xRoomRate); #region 旅客信息 XElement xResGuests = xHotelReservation.Element("ResGuests"); info.ResGuests = this.ParseResGuests(xResGuests); #endregion #region 全局信息 XElement xResGlobalInfo = xHotelReservation.Element("ResGlobalInfo"); info.ArriveEarlyTime = Utils.GetXElement(xResGlobalInfo, "ArriveEarlyTime").Value; info.ArriveLateTime = Utils.GetXElement(xResGlobalInfo, "ArriveLateTime").Value; info.PaymentType = (HBEPaymentType)Enum.Parse(typeof(HBEPaymentType), Utils.GetXElement(xResGlobalInfo, "Payment").Value); #endregion #region 联系人信息 XElement xContactorInfo = xHotelReservation.Element("ContactorInfo"); XElement xProfile = xContactorInfo.Element("Profile"); info.ContacterFullname = Utils.GetXElement(xProfile, "PersonName").Value; info.ContacterMobile = Utils.GetXElement(xProfile, "Mobile").Value; info.ContacterTelephone = Utils.GetXElement(xProfile, "Telephone").Value; #endregion } catch { errorCode = -1003; info = null; } return(info); }
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"); } } }
/// <summary> /// 分页获取酒店订单 /// </summary> /// <param name="PageSize">每页显示条数</param> /// <param name="PageIndex">当前页码</param> /// <param name="RecordCount">总记录数</param> /// <param name="SearchInfo">查询实体</param> /// <returns>酒店订单列表</returns> public virtual IList <EyouSoft.Model.HotelStructure.OrderInfo> GetList(int PageSize, int PageIndex, ref int RecordCount, EyouSoft.Model.HotelStructure.SearchOrderInfo SearchInfo) { IList <EyouSoft.Model.HotelStructure.OrderInfo> list = new List <EyouSoft.Model.HotelStructure.OrderInfo>(); #region 构造SQL条件 StringBuilder strWhere = new StringBuilder(" 1=1 "); string TableName = "tbl_HotelOrder"; string primaryKey = "OrderId"; string fields = "OrderId,ResOrderId,BuyerUName,BuyerUFullname,ContacterFullname,ContacterMobile,ContacterTelephone,OrderState,CheckState,HotelName,RoomTypeName,CheckInDate,CheckOutDate,TotalAmount,CommissionPercent,CommissionFix,BuyerCId,(select TravellerId,OrderId,TravellerName,TravellerType,Mobile from tbl_HotelTraveller where OrderId=tbl_HotelOrder.OrderId for xml auto,root('Traveller')) as Travellers"; string StrOrderBy = " CreateDateTime DESC "; if (SearchInfo != null) { if (!string.IsNullOrEmpty(SearchInfo.CompanyId)) { strWhere.AppendFormat(" and BuyerCId='{0}' ", SearchInfo.CompanyId); } if (!string.IsNullOrEmpty(SearchInfo.ResOrderId)) { strWhere.AppendFormat(" and ResOrderId like'%{0}%' ", SearchInfo.ResOrderId); } if (SearchInfo.OrderType.HasValue) { strWhere.AppendFormat(" and OrderType={0} ", (int)SearchInfo.OrderType.Value); } if (SearchInfo.OrderState.HasValue) { switch (SearchInfo.OrderState.Value) { case EyouSoft.Model.HotelStructure.OrderStateList.处理中: strWhere.Append(" and OrderState in(1,2,7) "); break; case EyouSoft.Model.HotelStructure.OrderStateList.取消: strWhere.Append(" and OrderState in(3,4,6) "); break; case EyouSoft.Model.HotelStructure.OrderStateList.已确认: strWhere.Append(" and OrderState= 0 "); break; } } if (!string.IsNullOrEmpty(SearchInfo.HotelName)) { strWhere.AppendFormat(" and HotelName like'%{0}%' ", SearchInfo.HotelName); } if (!string.IsNullOrEmpty(SearchInfo.CustomerName)) { strWhere.AppendFormat(" and OrderId in(select OrderId from tbl_HotelTraveller where TravellerName like '%{0}%')", SearchInfo.CustomerName); } if (SearchInfo.CheckState.HasValue) { strWhere.AppendFormat(" and CheckState={0} ", (int)SearchInfo.CheckState.Value); } if (SearchInfo.CheckOutSDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CheckOutDate)>=0 ", SearchInfo.CheckOutSDate.Value.ToString()); } if (SearchInfo.CheckOutEDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CheckOutDate)<=0 ", SearchInfo.CheckOutEDate.Value.ToString()); } if (SearchInfo.CheckInSDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CheckInDate)>=0 ", SearchInfo.CheckInSDate.Value.ToString()); } if (SearchInfo.CheckInEDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CheckInDate)<=0 ", SearchInfo.CheckInEDate.Value.ToString()); } if (SearchInfo.CreateSDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CreateDateTime)>=0 ", SearchInfo.CreateSDate.Value.ToString()); } if (SearchInfo.CreateEDate.HasValue) { strWhere.AppendFormat(" and datediff(dd,'{0}',CreateDateTime)<=0 ", SearchInfo.CreateEDate.Value.ToString()); } if (!string.IsNullOrEmpty(SearchInfo.BuyerUName)) { strWhere.AppendFormat(" AND BuyerUName LIKE '%{0}%' ", SearchInfo.BuyerUName); } } #endregion using (IDataReader dr = DbHelper.ExecuteReader(this._database, PageSize, PageIndex, ref RecordCount, TableName, primaryKey, fields, strWhere.ToString(), StrOrderBy)) { while (dr.Read()) { EyouSoft.Model.HotelStructure.OrderInfo model = new EyouSoft.Model.HotelStructure.OrderInfo(); model.OrderId = dr[dr.GetOrdinal("OrderId")].ToString(); model.ResOrderId = dr[dr.GetOrdinal("ResOrderId")].ToString(); model.BuyerUName = dr[dr.GetOrdinal("BuyerUName")].ToString(); model.BuyerUFullName = dr[dr.GetOrdinal("BuyerUFullname")].ToString(); model.ContacterFullname = dr[dr.GetOrdinal("ContacterFullname")].ToString(); model.ContacterMobile = dr[dr.GetOrdinal("ContacterMobile")].ToString(); model.ContacterTelephone = dr[dr.GetOrdinal("ContacterTelephone")].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("OrderState"))) { model.ResStatus = (EyouSoft.HotelBI.HBEResStatus) int.Parse(dr[dr.GetOrdinal("OrderState")].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("CheckState"))) { model.CheckState = (EyouSoft.Model.HotelStructure.CheckStateList) int.Parse(dr[dr.GetOrdinal("CheckState")].ToString()); } model.HotelName = dr[dr.GetOrdinal("HotelName")].ToString(); model.RoomTypeName = dr[dr.GetOrdinal("RoomTypeName")].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("CheckInDate"))) { model.CheckInDate = DateTime.Parse(dr[dr.GetOrdinal("CheckInDate")].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("CheckOutDate"))) { model.CheckOutDate = DateTime.Parse(dr[dr.GetOrdinal("CheckOutDate")].ToString()); } model.TotalAmount = decimal.Parse(dr[dr.GetOrdinal("TotalAmount")].ToString()); model.CommissionPercent = decimal.Parse(dr[dr.GetOrdinal("CommissionPercent")].ToString()); model.CommissionFix = decimal.Parse(dr[dr.GetOrdinal("CommissionFix")].ToString()); model.BuyerCId = dr[dr.GetOrdinal("BuyerCId")].ToString(); model.ResGuests = GetTravellers(dr[dr.GetOrdinal("Travellers")].ToString()); list.Add(model); model = null; } } return(list); }