public override bool select() { if (chID == C.ERROR_INT) return false; string sqlCommand = String.Format("select * from CommonHouse where chID={0}", chID); Sql sql = new Sql(); SqlDataReader reader = sql.selectCommonHouse(sqlCommand); initBySqlDataReader(reader); sql.closeConnection(); return true; }
public override bool update() { if (!isValid()) return false; string sqlCommand = String.Format(@"update MainRoad set prID={0},mrName='{1}',mrPath='{2}' where mrID={3}" , prID, mrName, mrPath, mrID); Sql sql = new Sql(); return sql.updateMainRoad(sqlCommand); }
public override bool select() { if (!isValid(new List<string>() { "prID", "mrName", "mrPath" })) return false; string sqlCommand = String.Format(@"select * from MainRoad where mrID={0}", mrID); Sql sql = new Sql(); SqlDataReader reader = sql.selectMainRoad(sqlCommand); initBySqlDataReader(reader); sql.closeConnection(); return true; }
public override bool select() { if (cpsID == C.ERROR_INT) return false; string sqlCommand = String.Format("select * from CityPlanStandard where cpsID = {0}", cpsID.ToString()); Sql sql = new Sql(); SqlDataReader reader = sql.selectCityPlanStandard(sqlCommand); reader.Read(); cpsID = Int32.Parse(reader[0].ToString()); cpsNumber = reader[1].ToString(); cpsShortDescription = reader[2].ToString(); cpsLongDescription = reader[3].ToString(); sql.closeConnection(); return true; }
public override bool save() { if (!isValid(new List<string>() { "mrID" })) return false; string sqlCommand = String.Format(@"insert into MainRoad (prID,mrName,mrPath) values ({0}, '{1}', '{2}')" , prID, mrName, mrPath); Sql sql = new Sql(); return sql.insertMainRoad(sqlCommand); }
public override bool select() { if (!isValid(new List<string>() { "pID", "lContent", "lMapLayerName", "lIsChoosed"})) return false; string sqlCommand = String.Format(@"select * from Label where lID={0}", lID); Sql sql = new Sql(); SqlDataReader reader = sql.selectLabel(sqlCommand); this.initBySqlDataReader(reader); sql.closeConnection(); return true; }
public static bool IsCityPlanStandardNumberAndShortDescription(string number, string shortDescription) { string SqlCommand = String.Format(@"select cpsID from CityPlanStandard where cpsNumber='{0}'", number); Sql sql = new Sql(); int cpsID = sql.selectCityPlanStandardIDByCpsNumber(SqlCommand); if (cpsID == C.ERROR_INT) return false; CityPlanStandard cityPlanStandard = new CityPlanStandard(); cityPlanStandard.id = cpsID; cityPlanStandard.select(); return cityPlanStandard.shortDescription == shortDescription; }
public bool saveWithoutCheck() { string sqlCommand = String.Format(@"Insert into Village (prID,vName,vBoundary,vInUse) values({0},'{1}','{2}',{3})" , prID, vName, vBoundary, vInUse ? 1 : 0); Sql sql = new Sql(); return sql.insertVillage(sqlCommand); }
public override bool update() { if (!isValid()) return false; string sqlCommand = String.Format(@"update Village set prID={0},vName='{1}',vBoundary='{2}',vInUse={3} where vID={4}" , prID, vName, vBoundary, vInUse ? 1 : 0, vID); Sql sql = new Sql(); return sql.updateVillage(sqlCommand); }
public override bool update() { if (!isValid()) return false; string sqlCommand = String.Format(@"update InnerRoad set prID={0},vID={1},irName='{2}',irPath='{3}' where irID={4}" , prID, vID, irName, irPath, irID); Sql sql = new Sql(); return sql.updateInnerRoad(sqlCommand); }
public override bool save() { if (!isValid(new List<string>() { "vID" })) return false; string sqlCommand = String.Format(@"Insert into Village (prID,vName,vBoundary,vInUse) values({0},'{1}','{2}',{3})" , prID, vName, vBoundary, vInUse ? 1 : 0); Sql sql = new Sql(); return sql.insertVillage(sqlCommand); }
public bool saveWithoutCheck() { string sqlCommand = String.Format(@"insert into InnerRoad (prID,vID,irName,irPath) values ({0},{1},'{2}','{3}')" , prID, vID, irName, irPath); Sql sql = new Sql(); return sql.insertInnerRoad(sqlCommand); }
public override bool save() { if (!isValid(new List<string>() { "irID" })) return false; string sqlCommand = String.Format(@"insert into InnerRoad (prID,vID,irName,irPath) values ({0},{1},'{2}','{3}')" , prID, vID, irName, irPath); Sql sql = new Sql(); return sql.insertInnerRoad(sqlCommand); }
public static int GetLastCommonHouseID() { string sqlCommand = String.Format("select max(chID) from CommonHouse"); Sql sql = new Sql(); return sql.selectMaxCommonHouseID(sqlCommand); }
public override bool update() { if (!isValid()) return false; string sqlCommand = String.Format(@"update Label set pID={0},lContent='{1}',lMapLayerName='{2}',lIsChoosed={3} where lID={4}" , pID, lContent, lMapLayerName, lIsChoosed ? 1 : 0, lID); Sql sql = new Sql(); return sql.updateLabel(sqlCommand); }
public override bool delete() { if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" })) return false; string sqlCommand = String.Format(@"delete from Village where vID={0}", vID); Sql sql = new Sql(); return sql.deleteVillage(sqlCommand); }
public override bool delete() { if (!isValid(new List<string>() { "pID", "lContent", "lMapLayerName", "lIsChoosed"})) return false; string sqlCommand = String.Format(@"delete from Label where lID={0}", lID); Sql sql = new Sql(); return sql.deleteLabel(sqlCommand); }
public override bool select() { if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" })) return false; string sqlCommand = String.Format("select * from Village where vID={0}", vID); Sql sql = new Sql(); SqlDataReader reader = sql.selectVillage(sqlCommand); initBySqlDataReader(reader); sql.closeConnection(); return true; }
public static Label GetLabelByMapLayerName(string mapLayerName) { string sqlCommand = String.Format(@"select * from Label where lMapLayerName='{0}'", mapLayerName); Sql sql = new Sql(); SqlDataReader reader = sql.selectLabelByMapLayerName(sqlCommand); Label label = new Label(); label.initBySqlDataReader(reader); sql.closeConnection(); return label; }
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 static CityPlanStandard GetCityPlanStandardByNumber(string number) { string sqlCommand = String.Format(@"select cpsID from CityPlanStandard where cpsNumber='{0}'", number); Sql sql = new Sql(); int cpsID = sql.selectCityPlanStandardIDByCpsNumber(sqlCommand); if (cpsID == C.ERROR_INT) return null; CityPlanStandard cityPlanStandard = new CityPlanStandard(); cityPlanStandard.id = cpsID; cityPlanStandard.select(); return cityPlanStandard; }
public CommonHouse getRelatedCommonHouse() { if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" })) return null; string sqlCommand = String.Format("select chID from CommonHouse where vID={0}", vID); Sql sql = new Sql(); SqlDataReader reader = sql.selectCommonHouseIDByVID(sqlCommand); if (reader.HasRows) { reader.Read(); int commonHouseID = Int32.Parse(reader[0].ToString()); CommonHouse commonHouse = new CommonHouse(); commonHouse.id = commonHouseID; commonHouse.select(); return commonHouse; } else { return null; } }
public static ObservableCollection<CityPlanStandard> GetAllCityPlanStandard() { if (allCityPlanStandardList != null) return allCityPlanStandardList; allCityPlanStandardList = new ObservableCollection<CityPlanStandard>(); string sqlCommand = String.Format(@"select cpsID from CityPlanStandard"); Sql sql = new Sql(); SqlDataReader reader = sql.selectAllCityPlanStandard(sqlCommand); while (reader.Read()) { int cpsID = Int32.Parse(reader[0].ToString()); CityPlanStandard cityPlanStandard = new CityPlanStandard(); cityPlanStandard.id = cpsID; cityPlanStandard.select(); allCityPlanStandardList.Add(cityPlanStandard); } return allCityPlanStandardList; }
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; } }
public bool saveWithoutCheck() { string sqlCommand = String.Format(@"insert into MainRoad (prID,mrName,mrPath) values ({0}, '{1}', '{2}')" , prID, mrName, mrPath); Sql sql = new Sql(); return sql.insertMainRoad(sqlCommand); }
public static int GetLastVillageID() { string sqlCommand = String.Format("select max(vID) from Village"); Sql sql = new Sql(); return sql.selectMaxVillageID(sqlCommand); }
public override bool delete() { if (!isValid(new List<string>() { "prID", "mrName", "mrPath" })) return false; string sqlCommand = String.Format(@"delete from MainRoad where mrID={0}", mrID); Sql sql = new Sql(); return sql.deleteMainRoad(sqlCommand); }
public override bool save() { if (!isValid(new List<string>() { "lID"})) return false; string sqlCommand = String.Format(@"insert into Label (pID,lContent,lMapLayerName,lIsChoosed) values ({0}, '{1}', '{2}',{3})" , pID, lContent, lMapLayerName, lIsChoosed ? 1 : 0); Sql sql = new Sql(); return sql.insertLabel(sqlCommand); }
public static int GetLastMainRoadID() { string sqlCommand = String.Format("select max(mrID) from MainRoad"); Sql sql = new Sql(); return sql.selectMaxMainRoadID(sqlCommand); }
public override bool delete() { if (chID == C.ERROR_INT) return false; string sqlCommand = String.Format(@"delete from CommonHouse where chID={0}", chID); Sql sql = new Sql(); return sql.deleteCommonHouse(sqlCommand); }