示例#1
0
        /// <summary>
        /// 更新数据版本
        /// </summary>
        /// <param name="cacheKey">数据索引</param>
        /// <returns>成功返回1 失败返回-1</returns>
        private int UpdateDataVersion(Neusoft.FrameWork.Models.CacheDataType cacheKey)
        {
            string sql = "";

            if (this.Sql.GetSql("DataCaching.UpdateDataVersion", ref sql) == -1)
            {
                return(-1);
            }

            sql = string.Format(sql, cacheKey.ToString());

            return(this.ExecNoQuery(sql));
        }
示例#2
0
        /// <summary>
        /// 根据缓存索引获取缓存配置信息
        ///
        /// ErrCode=NoDataFound       未维护数据
        /// ErrCode=NoManagmentFound  未维护数据提取信息
        /// ErrCode=PauseCache        暂停了缓存处理
        /// </summary>
        /// <param name="cacheKey">数据索引</param>
        /// <returns>成功返回数据配置信息 失败返回null</returns>
        internal Neusoft.FrameWork.Models.NeuCache GetCacheConfig(Neusoft.FrameWork.Models.CacheDataType cacheKey)
        {
            string sql = "";

            if (this.Sql.GetSql("DataCaching.GetCacheCofig.Simple", ref sql) == -1)
            {
                this.Err = this.Sql.Err;
                return(null);
            }

            sql = string.Format(sql, cacheKey.ToString());

            if (this.ExecQuery(sql) == -1)
            {
                this.Err = "执行Sql语句失败:  " + this.Err;
                return(null);
            }

            Neusoft.FrameWork.Models.NeuCache configInfo = new Neusoft.FrameWork.Models.NeuCache();
            bool isFindData = false;

            try
            {
                if (this.Reader.Read())
                {
                    configInfo.DataVersion = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[0].ToString());
                    configInfo.DLL         = this.Reader[1].ToString();
                    configInfo.Class       = this.Reader[2].ToString();
                    configInfo.Fun         = this.Reader[3].ToString();
                    configInfo.Valid       = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[4]);

                    isFindData = true;
                }
            }
            catch (Exception e)
            {
                this.Err = e.Message;
                return(null);
            }
            finally
            {
                this.Reader.Close();
            }

            if (isFindData == false)
            {
                this.Err     = configInfo.ID.ToString() + " 类型数据未维护缓存管理信息。";
                this.ErrCode = "NoDataFound";
                return(null);
            }
            if (string.IsNullOrEmpty(configInfo.DLL) || string.IsNullOrEmpty(configInfo.Class) || string.IsNullOrEmpty(configInfo.Fun))
            {
                this.Err     = "未正确维护  " + cacheKey.ToString() + "   类型数据的数据提取管理程序";
                this.ErrCode = "NoManagmentFound";
                return(null);
            }
            if (configInfo.Valid == false)
            {
                this.Err     = configInfo.ID.ToString() + " 类型数据暂停了缓存处理。";
                this.ErrCode = "PauseCache";
                return(null);
            }

            return(configInfo);
        }