Exemple #1
0
 public ObservableCollection<House> selectAllRelatedHouse()
 {
     if (!isValid(new List<string>() { "prName", "pID" }))
         return null;
     ObservableCollection<House> houseList = new ObservableCollection<House>();
     string sqlCommand = String.Format("select hID from House where prID={0}", prID);
     Sql sql = new Sql();
     SqlDataReader reader = sql.selectHouseIDByPrID(sqlCommand);
     if (!reader.HasRows)
     {
         sql.closeConnection();
         return null;
     }
     while (reader.Read())
     {
         int hID = Int32.Parse(reader[0].ToString());
         House house = new House();
         house.id = hID;
         house.select();
         houseList.Add(house);
     }
     sql.closeConnection();
     return houseList;
 }