Example #1
0
        protected void FindHome_Click(object sender, EventArgs e)
        {
            StudentSearchresults.Visible = false;
            HouseSearch house = new HouseSearch();
            HouseDAO houseDAO = new HouseDAO();

            house.Zip = string.IsNullOrEmpty(Zipcode.Text.Trim()) ? null : Zipcode.Text.Trim();

            if (DrpBedRooms.SelectedItem.Value != "-1")
            {
                house.BedRooms = int.Parse(DrpBedRooms.SelectedItem.Value);
            }
            else
            {
                house.BedRooms = null;
            }

            if (DrpBathRooms.SelectedItem.Value != "-1")
            {
                house.BathRooms = int.Parse(DrpBathRooms.SelectedItem.Value);
            }
            else
            {
                house.BathRooms = null;
            }

            DataSet ds;
            ds = houseDAO.Search(house);

            if (ds != null)
            {
                DataListHouseSearchresults.DataSource = ds.Tables[0];
                DataListHouseSearchresults.DataBind();

                HouseSearchresults.Visible = true;
            }
            else
            {
                Searchresults.Visible = true;
            }
        }