⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search_index2.ascx.cs

📁 本系统是二手房交易系统 采用asp.net技术 开发环境是vs2003+sqlServer2000
💻 CS
字号:
namespace HouseSystem.Controls
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using HouseSystem.Components;

	/// <summary>
	///		Search_Index2 的摘要说明。
	/// </summary>
	public class Search_Index2 : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.DropDownList dropHouseType;
		protected System.Web.UI.WebControls.DropDownList dropAgency;
		protected System.Web.UI.WebControls.DropDownList dropArea;
		protected System.Web.UI.WebControls.DropDownList dropSquare;
		protected System.Web.UI.WebControls.DropDownList dropTime;
		protected System.Web.UI.WebControls.ImageButton imgSearch;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if (!this.Page.IsPostBack)
			{
				this.BindDrop();
			}

		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.imgSearch.Click += new System.Web.UI.ImageClickEventHandler(this.imgSearch_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void BindDrop()
		{
			this.dropArea.DataSource = BindUI.GetAreaList();
			this.dropArea.DataTextField = "Area_Name";
			this.dropArea.DataValueField = "Area_ID";
			this.dropArea.DataBind();
			this.dropArea.Items.Insert(0, "不限...");
			this.dropArea.Items[0].Value = "0";
			this.dropHouseType.DataSource = BindUI.GetHouseTypeList();
			this.dropHouseType.DataTextField = "Ht_Name";
			this.dropHouseType.DataValueField = "Ht_ID";
			this.dropHouseType.DataBind();
			this.dropHouseType.Items.Insert(0, "不限...");
			this.dropHouseType.Items[0].Value = "0";
		}
 

		private void imgSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			string text1;
			byte num1 = byte.Parse(base.Request.Form["radType2"]);
			byte num2 = byte.Parse(this.dropAgency.SelectedValue);
			int num3 = int.Parse(this.dropArea.SelectedValue);
			int num4 = int.Parse(this.dropHouseType.SelectedValue);
			int num5 = int.Parse(this.dropTime.SelectedValue);
			string text2 = this.dropSquare.SelectedValue.ToString();
			if (num1 == 1)
			{
				text1 = "SELECT ID, Type, Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE Type=1";
			}
			else
			{
				text1 = "SELECT ID, Type ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE Type=2";
			}
			if (num2 != 0)
			{
				text1 = text1 + " AND IsAgency=" + num2;
			}
			if (num3 != 0)
			{
				text1 = text1 + " AND Area_ID=" + num3;
			}
			if (num4 != 0)
			{
				text1 = text1 + " AND Ht_ID=" + num4;
			}
			if (num5 != 0)
			{
				object obj1 = text1;
				object[] objArray1 = new object[4] { obj1, " AND AddTime>=now()-", num5, "" } ;
				text1 = string.Concat(objArray1);
			}
			if (text2 != "0")
			{
				char[] chArray1 = new char[1] { ',' } ;
				string text3 = text2.Split(chArray1)[0];
				chArray1 = new char[1] { ',' } ;
				string text4 = text2.Split(chArray1)[1];
				if (text4 == "M")
				{
					int num6 = 0x7fffffff;
					text4 = num6.ToString();
				}
				string text5 = text1;
				string[] textArray1 = new string[6] { text5, " AND Square BETWEEN ", text3, " AND ", text4, "" } ;
				text1 = string.Concat(textArray1);
			}
			text1 = text1 + " ORDER BY AddTime DESC";
			base.Session["SQL"] = text1;
			base.Response.Redirect("Result2.aspx?type=" + num1.ToString());
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -