protected DataTable Item(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, int SplitID, string CacheDescription, DataTable CacheData) { if (this.GetCache(CacheType, SplitID) == null) { this.GenerateCache(CacheType, CachePeriod, CacheDescription, CacheData); } return(((CM.CacheValue) this.GetCache(CacheType, SplitID)).Data); }
public Hashtable GenerateHash(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable dtDataSource, string SplitCellName) { Hashtable Hash = new Hashtable(); DataTable dtData = new DataTable(); string Key = String.Empty; CacheValue CacheValue = new CacheValue(); if (SplitCellName == String.Empty) { SplitCellName = this.SplitCellName; } if (isHasSplitCell(dtDataSource, SplitCellName)) { dtDataSource.DefaultView.Sort = SplitCellName; dtDataSource = dtDataSource.DefaultView.ToTable(); for (int i = 0; i < dtDataSource.Rows.Count; i++) { if (i != dtDataSource.Rows.Count - 1) { if (dtDataSource.Rows[i][SplitCellName].ToString() == dtDataSource.Rows[i + 1][SplitCellName].ToString()) { if (dtData.Columns.Count < 1) { dtData = dtDataSource.Clone(); } dtData.Rows.Add(dtDataSource.Rows[i].ItemArray); } else { dtData.Rows.Add(dtDataSource.Rows[i].ItemArray); Key = ReturnStrKey(CacheType, Convert.ToInt32(dtDataSource.Rows[i][SplitCellName])); CacheValue = SetCacheData(CacheType, CachePeriod, CacheDescription, dtData); Hash.Add(Key, CacheValue); dtData = new DataTable(); } } else { if (dtData.Columns.Count < 1) { dtData = dtDataSource.Clone(); } dtData.Rows.Add(dtDataSource.Rows[i].ItemArray); Key = ReturnStrKey(CacheType, Convert.ToInt32(dtDataSource.Rows[i][SplitCellName])); CacheValue = SetCacheData(CacheType, CachePeriod, CacheDescription, dtData); Hash.Add(Key, CacheValue); dtData = new DataTable(); } } } else { Key = ReturnStrKey(CacheType, 0); CacheValue = SetCacheData(CacheType, CachePeriod, CacheDescription, dtDataSource); Hash.Add(Key, CacheValue); } return(Hash); }
protected void GenerateCache(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable Data, string SplitCellName) { CM objCM = new CM(); Hashtable Hash = objCM.GenerateHash(CacheType, CachePeriod, CacheDescription, Data, SplitCellName); foreach (DictionaryEntry DE in Hash) { Cache[DE.Key.ToString()] = DE.Value; } }
private CacheValue SetCacheData(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string Description, DataTable Data) { CacheValue CacheValue = new CacheValue(); CacheValue.Code = CacheType; CacheValue.Period = (int)CachePeriod; CacheValue.TimeStamp = DateTime.Now; CacheValue.Description = Description; CacheValue.Data = Data; return(CacheValue); }
protected DataTable Item(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable CacheData) { return(Item(CacheType, CachePeriod, 0, CacheDescription, CacheData)); }
protected void GenerateCache(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable Data) { GenerateCache(CacheType, CachePeriod, CacheDescription, Data, ""); }