Exemplo n.º 1
0
 public ObservableCollection<House> getAllRelatedHouse()
 {
     if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" }))
         return null;
     ObservableCollection<House> houseList = new ObservableCollection<House>();
     string sqlCommand = String.Format("select hID from House where vID={0}", vID);
     Sql sql = new Sql();
     SqlDataReader reader = sql.selectHouseIDByVID(sqlCommand);
     if (reader.HasRows)
     {
         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;
     }
     else
     {
         sql.closeConnection();
         return null;
     }
 }