コード例 #1
0
ファイル: Sql.cs プロジェクト: wingzhangmaybe/CGXM
        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
ファイル: Sql.cs プロジェクト: wingzhangmaybe/CGXM
 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
ファイル: Sql.cs プロジェクト: wingzhangmaybe/CGXM
        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;
 }