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

📄 adsearch.aspx.cs

📁 its a website on property dealing made in c# and .net framework.. the database is missing though.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class adsearch : System.Web.UI.Page
{
    static string locality;
    static string price;
    static string area;
    static string facing;
    static string bedroom;
    static string floorno;
    static string tab;

    protected void Page_Load(object sender, EventArgs e)
    {
        locality = Session["l"].ToString();
        price = Session["p"].ToString();
        area = Session["ar"].ToString();
        facing = Session["fc"].ToString();
        bedroom = Session["bd"].ToString();
        floorno = Session["fl"].ToString();
        tab = Session["app"].ToString();


        if (tab == "Residential Land")
        {
            Label1.Text = tab;
            SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=epropertydb;Integrated Security=True");
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("Select locality,area,pricerent,address,city,facing,shortdescription,annualdues,electricalsupply,railwaydistance,schooldistance,busstopdistance,hospitaldistance from (residentialland join propertyforsalerent ON residentialland.propertyid=propertyforsalerent.propertyid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' )", con);
            DataSet ds = new DataSet();
            da.Fill(ds);

           //SqlDataAdapter da1 = new SqlDataAdapter("Select address,telephoneno,email,mobileno from (( residentialland join propertyowner ON residentialland.propertyid=propertyowner.propertyid) join userdetail on userdetails.userid=propertyowner.userid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' ))", con);
            SqlDataAdapter da1 = new SqlDataAdapter("select firstname,lastname,userdetails.address,userdetails.city,userdetails.state,telephoneno,email,mobileno from userdetails,propertyowner,residentialland,propertyforsalerent where (propertyforsalerent.propertyid=residentialland.propertyid and residentialland.propertyid=propertyowner.propertyid and userdetails.userid=propertyowner.userid and locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "')", con);
            DataSet ds1 = new DataSet();
           da1.Fill(ds1);

           //SqlDataAdapter da2 = new SqlDataAdapter("select firstname from userdetails,propertyowner,residentialland,propertyforsalerent where (propertyforsalerent.propertyid=residentialland.propertyid and residentialland.propertyid=propertyowner.propertyid and userdetails.userid=propertyowner.userid and locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "')", con);
           //DataSet ds2 = new DataSet();
           //da2.Fill(ds2);

           SqlDataAdapter da2 = new SqlDataAdapter("select photourl from (residentialland join propertyforsalerent ON residentialland.propertyid=propertyforsalerent.propertyid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' )", con);
           DataSet ds2 = new DataSet();
           da2.Fill(ds2);

            
            
            con.Close();
            DetailsView1.DataSource = ds;
            DetailsView1.DataBind();


           DetailsView2.DataSource = ds1;
           DetailsView2.DataBind();

           
            GridView1.DataSource = ds2;
            GridView1.DataBind();

           



        }
        else if (tab == "Residential Apartment")
        {
            
                SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=epropertydb;Integrated Security=True");
                con.Open();
                SqlDataAdapter da = new SqlDataAdapter("Select locality,area,pricerent,address,city,noofbedrooms,noofbathrooms,ownership,security,furnishing,construction,floorno,facing,shortdescription,privateterrace,watertanks,reservedparking,annualdues,internetfacility,backuppower,servantquarter,swimmingpool,liftfacility,railwaydistance,schooldistance,busstopdistance,hospitaldistance from (residentialapartment join propertyforsalerent ON residentialapartment.propertyid=propertyforsalerent.propertyid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' and noofbedrooms='" + bedroom + "' and floorno ='" + floorno + "' )", con);
                DataSet ds = new DataSet();
                da.Fill(ds);

                SqlDataAdapter da1 = new SqlDataAdapter("select firstname,lastname,userdetails.address,userdetails.city,userdetails.state,telephoneno,email,mobileno from userdetails,propertyowner,residentialapartment,propertyforsalerent where (propertyforsalerent.propertyid=residentialapartment.propertyid and residentialapartment.propertyid=propertyowner.propertyid and userdetails.userid=propertyowner.userid and locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' and noofbedrooms='" + bedroom + "' and floorno ='" + floorno + "')", con);
                DataSet ds1 = new DataSet();
                da1.Fill(ds1);
            
                con.Close();
                DetailsView1.DataSource = ds;
                DetailsView1.DataBind();

                DetailsView2.DataSource = ds1;
                DetailsView2.DataBind();

            
        }

        else if (tab == "Residential House")
        {

            SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=epropertydb;Integrated Security=True");
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("Select  locality,area,pricerent,address,city,noofbedrooms,noofbathrooms,ownership,security,furnishing,construction,facing,shortdescription,builtarea,watertanks,openarea,annualdues,internetfacility,railwaydistance,schooldistance,busstopdistance,hospitaldistance from(residentialhouse join propertyforsalerent ON residentialhouse.propertyid=propertyforsalerent.propertyid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' and noofbedrooms='" + bedroom + "' )", con);
            DataSet ds = new DataSet();
            da.Fill(ds);

            SqlDataAdapter da1 = new SqlDataAdapter("select firstname,lastname,userdetails.address,userdetails.city,userdetails.state,telephoneno,email,mobileno from userdetails,propertyowner,residentialhouse,propertyforsalerent where (propertyforsalerent.propertyid=residentialhouse.propertyid and residentialhouse.propertyid=propertyowner.propertyid and userdetails.userid=propertyowner.userid and locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' and noofbedrooms='" + bedroom + "' )", con);
            DataSet ds1 = new DataSet();
            da1.Fill(ds1);
            

            con.Close();
            DetailsView1.DataSource = ds;
            DetailsView1.DataBind();

            DetailsView2.DataSource = ds1;
            DetailsView2.DataBind();


        }
        else if (tab == "Commercial Shop")
        {

            SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=epropertydb;Integrated Security=True");
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("Select locality,area,pricerent,address,city,noofbathrooms,ownership,security,furnishing,construction,floorno,facing,shortdescription,visitorparking,annualdues,internetfacility,backuppower,nooflifts from(commercialshop join propertyforsalerent ON commercialshop.propertyid=propertyforsalerent.propertyid) where(locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "' and floorno='" + floorno + "')", con);
            DataSet ds = new DataSet();
            da.Fill(ds);

            SqlDataAdapter da1 = new SqlDataAdapter("select firstname,lastname,userdetails.address,userdetails.city,userdetails.state,telephoneno,email,mobileno from userdetails,propertyowner,commercialshop,propertyforsalerent where (propertyforsalerent.propertyid=commercialshop.propertyid and commercialshop.propertyid=propertyowner.propertyid and userdetails.userid=propertyowner.userid and locality='" + locality + "' AND facing='" + facing + "'AND pricerent='" + price + "' AND area='" + area + "'  and floorno ='" + floorno + "')", con);
            DataSet ds1 = new DataSet();
            da1.Fill(ds1);
            
            con.Close();
            DetailsView1.DataSource = ds;
            DetailsView1.DataBind();

            DetailsView2.DataSource = ds1;
            DetailsView2.DataBind();


        }




        
    }


   
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }
    protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
    {

    }
    protected void DetailsView2_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
    {

    }
    protected void DetailsView3_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
    {
        
 
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Image1.ImageUrl = @"~/images/" + GridView1.SelectedRow.Cells[1].Text + "";
 


 

    }
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
    

⌨️ 快捷键说明

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