public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { int cpsID = (int)value; CityPlanStandard cityPlanStandard = new CityPlanStandard(); cityPlanStandard.id = cpsID; cityPlanStandard.select(); return String.Format("{0}-{1}", cityPlanStandard.number, cityPlanStandard.shortDescription); }
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 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 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; }