Beispiel #1
0
        //Сохранение старого файла истории и добавление нового
        public void UpdateHistory(bool openAfterUpdate)
        {
            try
            {
                if (LastHistoryId > 300000)
                {
                    _reasonUpdate = "Старый файл истории содержит более 300000 записей";
                }

                if (_reasonUpdate != null && HistoryIsStable)
                {
                    CloseHistory();
                    Thread.Sleep(1500);
                    DaoDb.FromTemplate(_historyTemplate, _historyFile, ReplaceByTemplate.Always, true);
                    Thread.Sleep(1500);
                    if (openAfterUpdate)
                    {
                        OpenHistoryRecs();
                    }
                }
            }
            catch (Exception ex)
            {
                AddErrorAboutHistory(ex);
            }
        }
Beispiel #2
0
 //Задание файла истории
 public AccessHistory(Logger logger,          //логгер
                      string historyFile,     //файл истории
                      string historyTemplate) //шаблон для файла истории
 {
     try
     {
         Logger           = logger;
         _historyFile     = historyFile;
         _historyTemplate = historyTemplate;
         if (_historyFile != null)
         {
             if (_historyTemplate != null &&
                 DaoDb.FromTemplate(_historyTemplate, _historyFile, ReplaceByTemplate.IfNewVersion, true))
             {
                 _updateReason = "Новая версия файла истории";
             }
             OpenHistoryRecs();
         }
     }
     catch (OutOfMemoryException) { }
     catch (Exception ex)
     {
         AddErrorAboutHistory(ex);
     }
 }
Beispiel #3
0
        //Сохранение старого файла истории и добавление нового
        public void UpdateHistory()
        {
            try
            {
                if (_historyId > 300000)
                {
                    _updateReason = "Старый файл истории содержит более 300000 записей";
                    _historyId    = 0;
                }

                if (_updateReason != null)
                {
                    Close();
                    Thread.Sleep(1500);
                    DaoDb.FromTemplate(_historyTemplate, _historyFile, ReplaceByTemplate.Always, true);
                    Thread.Sleep(1500);
                    OpenHistoryRecs();
                }
            }
            catch (OutOfMemoryException) { }
            catch (Exception ex)
            {
                AddErrorAboutHistory(ex);
            }
        }
Beispiel #4
0
 //Задание файла истории historyFile и файла его шаблона historyTemplate, открытие истории, useSubHistory - использовать SubHistory
 public void OpenHistory(string historyFile = null, string historyTemplate = null, bool useSubHistory = false, bool useErrorsList = true)
 {
     try
     {
         _historyFile     = historyFile;
         _historyTemplate = historyTemplate;
         _useSubHistory   = useSubHistory;
         _useErrorsList   = useErrorsList;
         if (_historyFile != null)
         {
             if (_historyTemplate != null && DaoDb.FromTemplate(_historyTemplate, _historyFile, ReplaceByTemplate.IfNewVersion, true))
             {
                 _reasonUpdate = "Новая версия файла истории";
             }
             OpenHistoryRecs();
         }
     }
     catch (Exception ex)
     {
         AddErrorAboutHistory(ex);
     }
 }