Ejemplo n.º 1
0
        public static void SetLastUpdate(UpdateFileEntrySr ufe)
        {
            lock (m_objLocker)
            {
                eDataSyncCacheType dsct = (eDataSyncCacheType)Enum.Parse(typeof(eDataSyncCacheType), ufe.DataSyncCacheType, true);

                switch (dsct)
                {
                case eDataSyncCacheType.String: m_ufeLastLocalization = ufe; break;

                case eDataSyncCacheType.Match: m_ufeLastLine = ufe; break;

                case eDataSyncCacheType.Statistic: m_ufeStatLastLine = ufe; break;

                case eDataSyncCacheType.Resources: m_ufeLastResource = ufe; break;

                case eDataSyncCacheType.Metainfo: m_ufeMetaLastLine = ufe; break;

                case eDataSyncCacheType.ActiveTournaments: return;

                case eDataSyncCacheType.Liability: m_ufeLiabLastLine = ufe; break;

                default:

                    Debug.Assert(false);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private static void RefreshByType(eDataSyncCacheType type)
        {
            using (DataTable dt = DataCopy.GetDataTable(ConnectionManager.GetConnection(), null, "SELECT * FROM UpdateFileEntry WHERE DataSyncCacheType = '{0}' ORDER BY DataSyncCacheID DESC", type))
            {
                CheckTime ct = new CheckTime();
                ct.AddEvent("UpdateFileEntry SQL Done (Count = {0})", dt.Rows.Count);

                if (dt.Rows.Count > 0)
                {
                    SetLastUpdate(UpdateFileEntrySr.CreateFromDataRow(dt.Rows[0]));
                }

                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        UpdateFileEntrySr ufe = UpdateFileEntrySr.CreateFromDataRow(dr);

                        if (m_diUpdates.ContainsKey(ufe.DataSyncCacheID))
                        {
                            m_diUpdates.Add(ufe.DataSyncCacheID, ufe);
                        }
                    }
                    catch (Exception excp)
                    {
                        m_logger.ErrorFormat("RefreshByType Row Exception:{0}\r\n{1}", excp, excp.Message, excp.StackTrace);
                    }
                }

                ct.AddEvent("RefreshByType({0}) filled up (Count = {1})", type, m_diUpdates.Count);
                ct.Info(m_logger);
            }
        }
Ejemplo n.º 3
0
        public static UpdateFileEntrySr GetLastUpdate(eDataSyncCacheType type)
        {
            RefreshDbStoredUpdates();

            lock (m_objLocker)
            {
                switch (type)
                {
                case eDataSyncCacheType.String: return(m_ufeLastLocalization);

                case eDataSyncCacheType.Match: return(m_ufeLastLine);

                case eDataSyncCacheType.Statistic: return(m_ufeStatLastLine);

                case eDataSyncCacheType.ActiveTournaments: return(null);

                case eDataSyncCacheType.Resources: return(m_ufeLastResource);

                case eDataSyncCacheType.Metainfo: return(m_ufeMetaLastLine);

                case eDataSyncCacheType.Liability: return(m_ufeLiabLastLine);

                default:

                    Debug.Assert(false);
                    break;
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
 public UpdateRecordSr(long lDataSyncCacheId, string sFileName, eDataSyncCacheType dsct, string sData, string sDescription)
 {
     this.DataSyncCacheId   = lDataSyncCacheId;
     this.FileName          = sFileName;
     this.DataSyncCacheType = dsct;
     this.Data        = sData;
     this.Description = sDescription;
 }