Esempio n. 1
0
 /// <summary>
 /// 加载数据
 /// </summary>
 public void LoadDatas(DataTable datas)
 {
     if (datas == null || datas.Rows == null)
     {
         ScrapyCachePool.LogInfo("【客户端缓存表】数据加载失败:数据集为空");
         return;
     }
     foreach (DataRow row in datas.Rows)
     {
         try
         {
             int port = -1;
             int.TryParse(row["初始化功能号"].ToString(), out port);
             ClientCacheConfig config = new ClientCacheConfig()
             {
                 表名     = row["表名"].ToString(),
                 英文名    = row["英文名"].ToString(),
                 更新消息主题 = row["更新消息主题"].ToString(),
                 后台组    = row["后台组"].ToString(),
                 数据库表名  = row["数据库表名"].ToString(),
                 端口号    = port,
             };
             this.Add(config);
         }
         catch (Exception ex)
         {
             ScrapyCachePool.LogError(string.Format("【客户端缓存表】数据加载错误:{0};StackTrace:{1}", ex.Message, ex.StackTrace));
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 拷贝
        /// </summary>
        /// <param name="des"></param>
        public override void Copy(ICacheItem des)
        {
            base.Copy(des);
            ClientCacheConfig model = des as ClientCacheConfig;

            model.英文名    = this.英文名;
            model.表名     = this.表名;
            model.更新消息主题 = this.更新消息主题;
            model.端口号    = this.端口号;
            model.后台组    = this.后台组;
            model.数据库表名  = this.数据库表名;
        }
Esempio n. 3
0
        /// <summary>
        /// 获取业务分类索引
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private string GetDomainIndex(ICacheItem item)
        {
            if (item == null)
            {
                throw new Exception(string.Format("缓存表【{0}】获取索引错误,缓存项为空", this.TableName));
            }
            ClientCacheConfig config = item as ClientCacheConfig;

            if (config == null)
            {
                throw new Exception(string.Format("缓存表【{0}】获取索引错误,缓存项目信息转换错误", this.TableName));
            }
            return(config.后台组);
        }