public bool isDirty()
        {
            ObservableCollection<Village> tempVillageList = program.getAllRelatedVillage();
            if (villageList.Count != tempVillageList.Count)
                return true;

            foreach (Village village in villageList)
            {
                int villageID = village.id;
                Village villageCopy = new Village();
                villageCopy.id = villageID;
                villageCopy.select();
                if (!village.compare(villageCopy))
                {
                    return true;
                }

                int innerRoadID = village.innerRoad.id;
                InnerRoad innerRoadCopy = new InnerRoad();
                innerRoadCopy.id = innerRoadID;
                innerRoadCopy.select();
                if (!village.innerRoad.compare(innerRoadCopy))
                {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 2
0
 public InnerRoad getRelatedInnerRoad()
 {
     if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" }))
         return null;
     string sqlCommand = String.Format("select irID from InnerRoad where vID={0}", vID);
     Sql sql = new Sql();
     SqlDataReader reader = sql.selectInnerRoadIDByVillageID(sqlCommand);
     if (reader.HasRows)
     {
         reader.Read();
         int innerRoadID = Int32.Parse(reader[0].ToString());
         InnerRoad innerRoad = new InnerRoad();
         innerRoad.id = innerRoadID;
         innerRoad.select();
         return innerRoad;
     }
     else
     {
         return null;
     }
 }
 public bool isDirty()
 {
     foreach (InnerRoad innerRoad in innerRoadList)
     {
         int innerRoadID = innerRoad.id;
         InnerRoad innerRoadCopy = new InnerRoad();
         innerRoadCopy.id = innerRoadID;
         innerRoadCopy.select();
         if (!innerRoad.compare(innerRoadCopy))
         {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 4
0
        public ObservableCollection<InnerRoad> getAllRelatedInnerRoad()
        {
            if (!isValid(new List<string>() { "prName", "pID" }))
                return null;

            ObservableCollection<InnerRoad> innerRoadList = new ObservableCollection<InnerRoad>();
            string sqlCommand = String.Format(@"select irID from InnerRoad where prID={0}", prID);
            Sql sql = new Sql();
            SqlDataReader reader = sql.selectAllInnerRoadByPrID(sqlCommand);
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    int irID = Int32.Parse(reader[0].ToString());
                    InnerRoad innerRoad = new InnerRoad();
                    innerRoad.id = irID;
                    innerRoad.select();
                    innerRoadList.Add(innerRoad);
                }
                sql.closeConnection();
                return innerRoadList;
            }
            else
            {
                sql.closeConnection();
                return null;
            }
        }