Exemple #1
0
 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);
 }
Exemple #2
0
    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);
    }
Exemple #3
0
    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;
        }
    }
Exemple #4
0
    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);
    }
Exemple #5
0
 private string ReturnStrKey(EnumUtil.CacheTypes CacheType, int SplitID)
 {
     return(((int)CacheType).ToString() + "||" + SplitID.ToString().PadLeft(2, '0'));
 }
Exemple #6
0
 protected void CacheRemove(EnumUtil.CacheTypes CacheType, int SplitID)
 {
     Cache.Remove(this.ReturnStrKey(CacheType, SplitID));
 }
Exemple #7
0
 protected void CacheRemove(EnumUtil.CacheTypes CacheType)
 {
     Cache.Remove(this.ReturnStrKey(CacheType, 0));
 }
Exemple #8
0
 protected DataTable Item(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable CacheData)
 {
     return(Item(CacheType, CachePeriod, 0, CacheDescription, CacheData));
 }
Exemple #9
0
 protected void GenerateCache(EnumUtil.CacheTypes CacheType, EnumUtil.CachePeriods CachePeriod, string CacheDescription, DataTable Data)
 {
     GenerateCache(CacheType, CachePeriod, CacheDescription, Data, "");
 }
Exemple #10
0
 public object GetCache(EnumUtil.CacheTypes CacheType, int SplitID)
 {
     return(Cache[this.ReturnStrKey(CacheType, SplitID)]);
 }
Exemple #11
0
 public object GetCache(EnumUtil.CacheTypes CacheType)
 {
     return(Cache[this.ReturnStrKey(CacheType, 00)]);
 }