public Config SelectConfigByCfID(int cfID) { string comm = "select * from Config where cfID=" + cfID.ToString(); SqlConnection conn = openConn(); SqlCommand com = new SqlCommand(comm, conn); SqlDataReader reader = com.ExecuteReader(); if (reader.HasRows) { reader.Read(); Config config = new Config(); config.InitBySqlDataReader(reader); closeConnection(conn); return config; } closeConnection(conn); return null; }
public Config SelectConfigByPrID(int prID) { Config config = new Config(); string comm = "select * from Config where prID=" + prID.ToString(); SqlConnection conn = openConn(); SqlCommand com = new SqlCommand(comm, conn); SqlDataReader reader = com.ExecuteReader(); if (reader.Read()) { config.InitBySqlDataReader(reader); return config; } else { return null; } }
public ObservableCollection<Config> selectAllRelatedConfig() { if (!isValid(new List<string>() { "prName", "pID" })) return null; ObservableCollection<Config> configList = new ObservableCollection<Config>(); string sqlCommand = String.Format("select cfID from Config where prID={0}", prID); Sql sql = new Sql(); SqlDataReader reader = sql.selectConfigIDByPrID(sqlCommand); while (reader.Read()) { int cfID = Int32.Parse(reader[0].ToString()); Config config = new Config(); config.id = cfID; config.select(); configList.Add(config); } sql.closeConnection(); return configList; }
public List<Config> SelectConfigByPmId(int id) { List<Config> configList = new List<Config>(); string comm= "select * from Config where pmID="+ id.ToString(); SqlConnection conn = openConn(); SqlCommand com = new SqlCommand(comm, conn); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { Config config = new Config(); config.InitBySqlDataReader(reader); configList.Add(config); } closeConnection(conn); return configList; }
public static Config GetDefaultConfig() { Config config = new Config(); config.value = C.DEFAULT_NUMBER_VALUE; return config; }