Example #1
0
        protected Configuration Import(CachedConfiguration cachedConfig)
        {
            Configuration config = new Configuration();

            //config.Load(new StringReader(cachedConfig.Xml));
            return(config);
        }
Example #2
0
        /// <summary>
        /// Imports a cached configuration
        /// </summary>
        /// <returns></returns>
        public CachedConfiguration Import()
        {
            CachedConfiguration c = new CachedConfiguration();
            string strReadSQL     = "SELECT top 1 * FROM [dsto_configuration] order by date_created DESC";

            switch (Provider)
            {
            case DataProviders.SQL:
                strReadSQL = "SELECT top 1 * FROM [dsto_configuration] ORDER BY date_created DESC";
                break;

            case DataProviders.MYSQL:
                strReadSQL = "SELECT * FROM [dsto_configuration] ORDER BY date_created DESC LIMIT 0,1";
                break;

            case DataProviders.SQLite:
                strReadSQL = "SELECT * FROM [dsto_configuration] ORDER BY date_created DESC LIMIT 0,1";
                break;
            }

            System.Data.DataTable dt = new System.Data.DataTable();
            if (ExecuteQuery(strReadSQL, dt) > 0)
            {
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    c.Version = Convert.ToString(dr["Version"]);
                    c.Xml     = Convert.ToString(dr["Config"]);
                    c.Key     = Convert.ToString(dr["Key"]);
                }
            }
            return(c);
        }