/// <summary> /// 获取所有的城市信息集合 /// </summary> /// <returns></returns> public virtual IList <EyouSoft.Model.HotelStructure.HotelCity> GetList() { IList <EyouSoft.Model.HotelStructure.HotelCity> lists = null; EyouSoft.Model.HotelStructure.HotelCity model = null; DbCommand dc = this._db.GetSqlStringCommand(Sql_Select_HotelCity); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db)) { lists = new List <EyouSoft.Model.HotelStructure.HotelCity>(); while (dr.Read()) { model = new EyouSoft.Model.HotelStructure.HotelCity(); model.CityCode = dr.GetString(dr.GetOrdinal("CityCode")); model.CityName = dr.GetString(dr.GetOrdinal("CityName")); model.Id = dr.GetInt32(dr.GetOrdinal("Id")); model.IsHot = dr.GetString(dr.GetOrdinal("IsHot")) == "0" ? false : true; model.SimpleSpelling = dr.IsDBNull(dr.GetOrdinal("SimpleSpelling")) ? "" : dr.GetString(dr.GetOrdinal("SimpleSpelling")); model.Spelling = dr.IsDBNull(dr.GetOrdinal("Spelling")) ? "" : dr.GetString(dr.GetOrdinal("Spelling")); lists.Add(model); model = null; } } return(lists); }
/// <summary> /// 根据酒店模块类型获取城市信息集合 /// </summary> /// <param name="type">类型</param> /// <returns></returns> public virtual IList <EyouSoft.Model.HotelStructure.HotelCity> GetList(EyouSoft.Model.HotelStructure.HotelShowType type) { IList <EyouSoft.Model.HotelStructure.HotelCity> lists = null; EyouSoft.Model.HotelStructure.HotelCity model = null; DbCommand dc = this._db.GetSqlStringCommand(Sql_Select_HotelCity); this._db.AddInParameter(dc, "ShowType", DbType.Byte, (int)type); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db)) { lists = new List <EyouSoft.Model.HotelStructure.HotelCity>(); while (dr.Read()) { model = new EyouSoft.Model.HotelStructure.HotelCity(); model.CityCode = dr.GetString(dr.GetOrdinal("CityCode")); model.CityName = dr.GetString(dr.GetOrdinal("CityName")); lists.Add(model); model = null; } } return(lists); }
/// <summary> /// 获取酒店城市信息实体 /// </summary> /// <param name="CityCode">城市三字码</param> /// <returns></returns> public virtual EyouSoft.Model.HotelStructure.HotelCity GetModel(string CityCode) { EyouSoft.Model.HotelStructure.HotelCity model = null; string Sql = "SELECT [ID],[CityName],[Spelling],[SimpleSpelling],[CityCode],[IsHot] FROM [dbo].[tbl_HotelCity] WHERE [CityCode]=@CityCode"; DbCommand dc = this._db.GetSqlStringCommand(Sql); this._db.AddInParameter(dc, "CityCode", DbType.AnsiString, CityCode); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db)) { while (dr.Read()) { model = new EyouSoft.Model.HotelStructure.HotelCity(); model.CityCode = dr.GetString(dr.GetOrdinal("CityCode")); model.CityName = dr.GetString(dr.GetOrdinal("CityName")); model.Id = dr.GetInt32(dr.GetOrdinal("Id")); model.IsHot = dr.GetString(dr.GetOrdinal("IsHot")) == "0" ? false : true; model.SimpleSpelling = dr.IsDBNull(dr.GetOrdinal("SimpleSpelling")) ? "" : dr.GetString(dr.GetOrdinal("SimpleSpelling")); model.Spelling = dr.IsDBNull(dr.GetOrdinal("Spelling")) ? "" : dr.GetString(dr.GetOrdinal("Spelling")); } } return(model); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //设置title this.Page.Title = EyouSoft.Common.PageTitle.Hotel_Title; //设置关键字 AddMetaTag("description", EyouSoft.Common.PageTitle.Hotel_Des); AddMetaTag("keywords", EyouSoft.Common.PageTitle.Hotel_Keywords); //设置导航栏 this.CityAndMenu1.HeadMenuIndex = 4; #region 获得参数 //城市三字码 string cityCode = Utils.GetQueryStringValue("cityCode"); //入住日期 string inTime = Utils.GetQueryStringValue("inTime"); //离开日期 string leaveTime = Utils.GetQueryStringValue("leaveTime"); //开始价格 decimal?priceBegin = Utils.GetDecimal(Utils.GetQueryStringValue("priceBegin")); //结束价格 decimal?priceEnd = Utils.GetDecimal(Utils.GetQueryStringValue("priceEnd")); //地理位置 string landMark = Utils.GetQueryStringValue("landMark"); //酒店星级 string hotelLevel = Utils.GetQueryStringValue("hotelLevel"); if (hotelLevel == null || hotelLevel == "") { hotelLevel = "0"; } //即时确认 string instant = Utils.GetQueryStringValue("instant"); //接机服务 string service = Utils.GetQueryStringValue("service"); //上网设施 string internet = Utils.GetQueryStringValue("internet"); //装修时间 string decoration = Utils.GetQueryStringValue("decoration"); //特殊房型 string special = Utils.GetQueryStringValue("special"); //床型 string bed = Utils.GetQueryStringValue("bed"); //行政区域 string district = Utils.GetQueryStringValue("district"); //查询方式 string searchWay = Utils.GetQueryStringValue("searchWay"); //酒店名称 string hotelName = Utils.GetQueryStringValue("hotelName"); //排序 string sort = Utils.GetQueryStringValue("sort"); #endregion #region 设置查询控件值 this.HotelSearchControl1.CityCode = cityCode; this.HotelSearchControl1.InTime = inTime; this.HotelSearchControl1.LeaveTime = leaveTime; this.HotelSearchControl1.PriceBegin = Convert.ToDecimal(priceBegin); this.HotelSearchControl1.PriceEnd = Convert.ToDecimal(priceEnd); this.HotelSearchControl1.HotelLevel = hotelLevel; this.HotelSearchControl1.HotelName = hotelName; this.HotelSearchControl1.Instant = Utils.GetInt(instant, 0); this.HotelSearchControl1.Service = Utils.GetInt(service, 0); this.HotelSearchControl1.Internet = Utils.GetInt(internet, 0); this.HotelSearchControl1.Decoration = decoration; this.HotelSearchControl1.Special = special; this.HotelSearchControl1.Bed = bed; this.HotelSearchControl1.LandMark = landMark; #endregion #region 页面控件赋值 if (inTime != "" && Utils.GetDateTimeNullable(inTime) != null) { this.lblInTime.Text = inTime; } if (leaveTime != "" && Utils.GetDateTimeNullable(leaveTime) != null) { this.lblLeaveTime.Text = leaveTime; } if (Utils.GetDateTimeNullable(inTime) != null && Utils.GetDateTimeNullable(leaveTime) != null) { TimeSpan sp = Utils.GetDateTime(leaveTime) - Utils.GetDateTime(inTime); this.lblDayCount.Text = sp.Days.ToString(); } //显示城市名 EyouSoft.Model.HotelStructure.HotelCity cityModel = EyouSoft.BLL.HotelStructure.HotelCity.CreateInstance().GetModel(cityCode); if (cityModel != null) { this.litCity.Text = cityModel.CityName; } if (priceBegin <= 0 && priceEnd <= 0) { this.litMoney.Text = ""; } else if (priceBegin <= 0 && priceEnd > 0) { this.litMoney.Text = priceEnd + "元以下"; } else if (priceBegin > 0 && priceEnd > 0) { this.litMoney.Text = priceBegin + " - " + priceEnd + "元"; } #endregion #region 设置用户控件城市ID //查询控件 this.HotelSearchControl1.CityId = this.CityId; //常识控件 this.CommonUserControl1.CityId = this.CityId; //促销酒店 this.SpecialHotelControl1.CityId = this.CityId; //最新加入酒店 this.HotHotelControl1.CityId = this.CityId; #endregion //排序设置图片 SetImgBySort(sort); //设置用户控件图片URL this.HotelSearchControl1.ImageServerPath = this.ImageServerPath; //设置图片宽度 this.ImgFristControl1.ImageWidth = "225px"; this.ImgSecondControl1.ImageWidth = "225px"; this.hideUrl.Value = Request.Url.Query; } }