public DataSet Search(HouseSearch house) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_HouseSearch"); db.AddInParameter(command, "BathRooms", DbType.String, house.BathRooms); db.AddInParameter(command, "BedRooms", DbType.String, house.BedRooms); db.AddInParameter(command, "Zip", DbType.String, house.Zip); return(db.ExecuteDataSet(command)); }
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; } }
public DataSet Search(HouseSearch house) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_HouseSearch"); db.AddInParameter(command, "BathRooms", DbType.String, house.BathRooms); db.AddInParameter(command, "BedRooms", DbType.String, house.BedRooms); db.AddInParameter(command, "Zip", DbType.String, house.Zip); return db.ExecuteDataSet(command); }