/// <summary> /// 将酒店常旅客信息记录导出Excel文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ExcelClick() { string[] TableTitle = { "订单号", "订单状态", "审核状态", "旅客姓名", "酒店名称", "房型", "预定入住日期", "预定离店日期", "间夜数", "总价", "返佣比例", "返佣金额" }; string ExcelName = string.Empty; PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); string orderId = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderId"] ?? "")), ""); //订单编号 //string electtronOrderNum = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["electtronOrderNum"] ?? "")), null);//电子订单号 string orderType = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderType"] ?? "")), ""); //订单类型 DateTime?orderStartTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["orderStartTime"] ?? null)), new System.Nullable <DateTime>()); //开始预订日期 DateTime?orderEndTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["orderEndTime"] ?? null)), new System.Nullable <DateTime>()); //预订结束日期 DateTime?checkInStartTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInStartTime"] ?? null)), new System.Nullable <DateTime>()); //开始入住日期 DateTime?checkInEndTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInEndTime"] ?? null)), new System.Nullable <DateTime>()); //结束入住日期 string hotelName = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["hotelName"] ?? "")), ""); //酒店名称 string orderStatus = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderStatus"] ?? "")), ""); //订单状态 string customerName = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["customerName"] ?? "")), ""); //客人名称 EyouSoft.Model.HotelStructure.SearchOrderInfo SearchInfo = new EyouSoft.Model.HotelStructure.SearchOrderInfo(); SearchInfo.ResOrderId = orderId; SearchInfo.HotelName = hotelName; if (orderStatus.ToString() != "" && orderStatus.ToString() != "ahol_ckAll") { SearchInfo.OrderState = (EyouSoft.Model.HotelStructure.OrderStateList) int.Parse(orderStatus); } SearchInfo.CustomerName = customerName; SearchInfo.CheckInSDate = checkInStartTime; SearchInfo.CheckInEDate = checkInEndTime; SearchInfo.CreateSDate = orderStartTime; SearchInfo.CreateEDate = orderEndTime; if (orderType.ToString() != "") { SearchInfo.OrderType = (EyouSoft.Model.HotelStructure.OrderType) int.Parse(orderType); } SearchInfo.CompanyId = this.SiteUserInfo.CompanyID; IList <EyouSoft.Model.HotelStructure.OrderInfo> list = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(PageSize, PageIndex, ref RecordCount, SearchInfo); if (list != null && list.Count > 0) { EduceExcel(list, ExcelName, TableTitle); list = null; } else { MessageBox.ResponseScript(this, "alert('没有订单信息 ');topTab.url(topTab.activeTabIndex,'/HotelCenter/HotelOrderManage/HotelOrderList.aspx');"); return; } }
string orderType; //订单类别(历史订单,当前订单) protected void Page_Load(object sender, EventArgs e) { orderType = Utils.GetQueryStringValue("orderType"); pageIndex = Utils.GetInt(Utils.GetQueryStringValue("Page"), 1); //查询实体 EyouSoft.Model.HotelStructure.SearchOrderInfo SearchInfo = new EyouSoft.Model.HotelStructure.SearchOrderInfo(); SearchInfo.CompanyId = SiteUserInfo.CompanyID; if (orderType == "now") //当前订单 { SearchInfo.CreateSDate = DateTime.Now.Date; //预定开始时间为今天零点 orderList = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(pageSize, pageIndex, ref recordCount, SearchInfo); recordCountNow = recordCount; //当前订单数 } else if (orderType == "history") //历史订单 { SearchInfo.CreateEDate = DateTime.Now.Date; //预定结束时间为今天零点 orderList = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(pageSize, pageIndex, ref recordCount, SearchInfo); recordCountHistory = recordCount; //历史订单数 } else//默认为显示当前订单(并获取历史订单数,当前订单数) { SearchInfo.CreateEDate = DateTime.Now.Date; //预定结束时间为今天零点 orderList = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(pageSize, pageIndex, ref recordCount, SearchInfo); recordCountNow = recordCount; //当前订单数 SearchInfo = new EyouSoft.Model.HotelStructure.SearchOrderInfo(); SearchInfo.CreateSDate = DateTime.Now.Date; //预定结束时间为今天零点 SearchInfo.CompanyId = SiteUserInfo.CompanyID; orderList = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(pageSize, pageIndex, ref recordCount, SearchInfo); recordCountHistory = recordCount;//历史订单数 } //绑定订单列表 if (orderList != null && orderList.Count > 0) { rpt_orderList.DataSource = orderList; rpt_orderList.DataBind(); BindExportPage(); } else { //无订单则隐藏分页控件,显示无订单消息 ExporPageInfoSelect1.Visible = false; remark = "暂无订单信息"; } }
protected void BindHotelOrderList() { ////默认查询两周内日期 DateTime?StartTime = DateTime.Now.AddDays(-14); DateTime?EndTime = DateTime.Now; string FirstLoadStarTime = DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd"); //第一次加载开始预订日期 string FirstLoadEndTime = DateTime.Now.ToString("yyyy-MM-dd"); //第一次加载结束预定日期 PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); //获得当前页码 string orderId = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderId"] ?? "")), ""); //订单编号 string orderType = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderType"] ?? "")), ""); //订单类型 DateTime?orderStartTime = null; DateTime?orderEndTime = null; DateTime?checkInStartTime = null; DateTime?checkInEndTime = null; if (Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInStartTime"] ?? "")), "") != "") { checkInStartTime = DateTime.Parse(Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInStartTime"] ?? "")), ""));//开始入住日期 } if (Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInEndTime"] ?? "")), "") != "") { checkInEndTime = DateTime.Parse(Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["checkInEndTime"] ?? "")), "")); //结束入住日期 } string hotelName = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["hotelName"] ?? "")), ""); //酒店名称 string orderStatus = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["orderStatus"] ?? "")), ""); //订单状态 string customerName = Utils.GetString(Utils.InputText(Server.UrlDecode(Request.QueryString["customerName"] ?? "")), ""); //客人名称 if (this.IsFirstKey == "1")//第一次加载 { this.hol_txtOrderStartTime.Value = FirstLoadStarTime; this.hol_txtOrderEndTime.Value = FirstLoadEndTime; orderStartTime = DateTime.Parse(FirstLoadStarTime); orderEndTime = DateTime.Parse(FirstLoadEndTime); } else { orderStartTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["orderStartTime"] ?? null)), null); //开始预订日期 orderEndTime = Utils.GetDateTimeNullable(Utils.InputText(Server.UrlDecode(Request.QueryString["orderEndTime"] ?? null)), null); //开始预订日期 this.hol_txtOrderStartTime.Value = orderStartTime.ToString(); //开始预订日期; this.hol_txtOrderEndTime.Value = orderEndTime.ToString(); //结束预订日期; } #region 查询实体赋值 EyouSoft.Model.HotelStructure.SearchOrderInfo SearchInfo = new EyouSoft.Model.HotelStructure.SearchOrderInfo(); SearchInfo.ResOrderId = orderId; //订单编号 SearchInfo.HotelName = hotelName; //酒店名称 if (orderStatus.ToString() != "ahol_ckAll" && orderStatus != "") { //订单状态 SearchInfo.OrderState = (EyouSoft.Model.HotelStructure.OrderStateList) int.Parse(orderStatus); } if (orderType != "") {//订单类型 SearchInfo.OrderType = (EyouSoft.Model.HotelStructure.OrderType) int.Parse(orderType); } SearchInfo.CustomerName = customerName; //客人姓名 SearchInfo.CheckInSDate = checkInStartTime == null ? null : checkInStartTime; //开始入住日期 SearchInfo.CheckInEDate = checkInEndTime == null ? null :checkInEndTime; //结束入住日期 预定结束日期 SearchInfo.CreateSDate = orderStartTime; //预定开始日期 SearchInfo.CreateEDate = orderEndTime; //预定结束日期 SearchInfo.CompanyId = this.SiteUserInfo.CompanyID; //公司ID #endregion #region 初始化查询后表单值 this.hol_txtHotelName.Value = hotelName;//酒店名称 string startTime1 = string.Empty; string endTime1 = string.Empty; if (this.IsFirstKey == "1") { startTime1 = FirstLoadStarTime; //开始预订日期 endTime1 = FirstLoadEndTime; //预订结束日期 } else { startTime1 = Utils.InputText(Server.UrlDecode(Request.QueryString["orderStartTime"] ?? "")).ToString(); //开始预订日期 endTime1 = Utils.InputText(Server.UrlDecode(Request.QueryString["orderEndTime"] ?? "")).ToString(); //预订结束日期 } string starTime2 = Utils.InputText(Server.UrlDecode(Request.QueryString["checkInStartTime"] ?? "")).ToString(); //开始入住日期 string endTime2 = Utils.InputText(Server.UrlDecode(Request.QueryString["checkInEndTime"] ?? "")).ToString(); //结束入住日期 this.hol_txtOrderStartTime.Value = startTime1; //预定开始日期 this.hol_txtOrderEndTime.Value = endTime1; //预定结束日期 this.hol_txtCheckInStartTime.Value = starTime2 == ""?"":starTime2; //入住开始日期 this.hol_txtCheckInEndTime.Value = endTime2 == ""?"":endTime2; //入住结束日期 this.hol_txtOrderId.Value = orderId; //订单编号 this.hol_txtCustomerName.Value = customerName; //客人姓名 this.hol_ddlOrderType.SelectedValue = orderType == "" ? "" : orderType; //订单类别 switch (orderStatus) //订单状态 { case "ahol_ckAll": this.ahol_ckAll.Checked = true; //全部 break; case "": this.ahol_ckAll.Checked = true; //全部 break; case "0": this.ahol_ckOK.Checked = true; //确认 this.ahol_ckAll.Checked = false; break; case "1": this.ahol_ckHandle.Checked = true; //处理 this.ahol_ckAll.Checked = false; break; case "2": this.ahol_ckCansel.Checked = true; //取消 this.ahol_ckAll.Checked = false; break; //case "4": // this.ahol_ckNOWSHOW.Checked = true;//NOWSHOW // this.ahol_ckAll.Checked = false; // break; //default: // this.ahol_ckAll.Checked = true;//默认选择全部 // break; } #endregion //查询酒店订单集合 IList <EyouSoft.Model.HotelStructure.OrderInfo> list = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(PageSize, PageIndex, ref RecordCount, SearchInfo); if (list.Count != 0 && list != null) { this.hol_crp_HotelOrderList.DataSource = list; this.hol_crp_HotelOrderList.DataBind(); //绑定分页 BindPage(this.SiteUserInfo.CompanyID, orderId, orderType, hotelName, customerName, orderStatus, orderStartTime, orderEndTime, checkInStartTime, checkInEndTime); } else { this.hol_crp_HotelOrderList.EmptyText = "<tr height=\"100px\"><td colspan=\"8\" style='text-align:center;'>暂无订单信息</td></tr>"; this.hol_ExportPageInfo1.Visible = false; } //释放资源 list = null; }
/// <summary> /// 绑定搜索的订单列表 /// </summary> protected void BindOrderInfo() { int recordCount = 0; string BuyerUName = Utils.InputText(Request.QueryString["CustomerName"]); string OrderId = Utils.InputText(Request.QueryString["OrderId"]); DateTime?CreateSDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CreateSDate"])); DateTime?CreateEDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CreateEDate"])); DateTime?CheckInSDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CheckInSDate"])); DateTime?CheckInEDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CheckInEDate"])); DateTime?CheckOutSDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CheckOutSDate"])); DateTime?CheckOutEDate = Utils.GetDateTimeNullable(Utils.InputText(Request.QueryString["CheckOutEDate"])); string HotelName = Utils.InputText(Request.QueryString["HotelName"]); string OrderSate = Request.QueryString["OrderSate"]; EyouSoft.Model.HotelStructure.OrderStateList?StateEmnu = null; switch (OrderSate) { case "1": StateEmnu = EyouSoft.Model.HotelStructure.OrderStateList.已确认; break; case "2": StateEmnu = EyouSoft.Model.HotelStructure.OrderStateList.取消; break; case "3": StateEmnu = EyouSoft.Model.HotelStructure.OrderStateList.处理中; break; case "4": StateEmnu = EyouSoft.Model.HotelStructure.OrderStateList.NOWSHOW; break; default: break; } //订单查询 EyouSoft.Model.HotelStructure.SearchOrderInfo ModelSearchOrder = new EyouSoft.Model.HotelStructure.SearchOrderInfo(); ModelSearchOrder.BuyerUName = BuyerUName == "" ? null : BuyerUName; ModelSearchOrder.ResOrderId = OrderId == "" ? null : OrderId; ModelSearchOrder.CreateSDate = CreateSDate; ModelSearchOrder.CreateEDate = CreateEDate; ModelSearchOrder.CheckInSDate = CheckInSDate; ModelSearchOrder.CheckInEDate = CheckInEDate; ModelSearchOrder.CheckOutSDate = CheckOutSDate; ModelSearchOrder.CheckOutEDate = CheckOutEDate; ModelSearchOrder.HotelName = HotelName == "" ? null : HotelName; ModelSearchOrder.OrderState = StateEmnu; IList <EyouSoft.Model.HotelStructure.OrderInfo> ModelList = EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().GetList(PageSize, PageIndex, ref recordCount, ModelSearchOrder); if (ModelList != null && ModelList.Count > 0) { this.ExporPageInfoSelect1.intPageSize = PageSize; this.ExporPageInfoSelect1.intRecordCount = recordCount; this.ExporPageInfoSelect1.CurrencyPage = PageIndex; this.ExporPageInfoSelect1.HrefType = Adpost.Common.ExporPage.HrefTypeEnum.JsHref; this.ExporPageInfoSelect1.AttributesEventAdd("onclick", "OrderSearch.LoadData(this);", 1); this.ExporPageInfoSelect1.AttributesEventAdd("onchange", "OrderSearch.LoadData(this);", 0); this.crptIOList.DataSource = ModelList; this.crptIOList.DataBind(); ModelList = null; } else { this.crptIOList.EmptyText = "<tr><td colspan=\"14\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有找到相关的数据!</span></div></td></tr>"; this.ExporPageInfoSelect1.Visible = false; } ModelSearchOrder = null; }
/// <summary> /// 分页获取酒店订单 /// </summary> /// <param name="PageSize">每页显示条数</param> /// <param name="PageIndex">当前页码</param> /// <param name="RecordCount">总记录数</param> /// <param name="SearchInfo">查询实体</param> /// <returns>酒店订单列表</returns> public IList <EyouSoft.Model.HotelStructure.OrderInfo> GetList(int PageSize, int PageIndex, ref int RecordCount, EyouSoft.Model.HotelStructure.SearchOrderInfo SearchInfo) { return(dal.GetList(PageSize, PageIndex, ref RecordCount, SearchInfo)); }
/// <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); }