示例#1
0
        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;
        }
示例#2
0
 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;
     }
 }
示例#3
0
文件: Program.cs 项目: Leooonard/CGXM
 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;
 }
示例#4
0
        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;
        }
示例#5
0
文件: Config.cs 项目: Leooonard/CGXM
 public static Config GetDefaultConfig()
 {
     Config config = new Config();
     config.value = C.DEFAULT_NUMBER_VALUE;
     return config;
 }