Ejemplo n.º 1
0
 public static void QueryLog(ref IActionAnalyzer actionAnalyzer, int reportValue,
                             ref BackgroundWorker worker, ref DoWorkEventArgs e)
 {
     try
     {
         using (var db = new LibraryLogModel())
         {
             int count = 0;
             var table = db.FrontOfficeAction.AsNoTracking()
                         .OrderBy(s => s.FrontOfficeSessionId)
                         .ThenBy(d => d.ActionDateTime);
             if (Maximum > 0)
             {
                 table = (IOrderedQueryable <DbEntities.FrontOfficeAction>)table.Take(Maximum);
             }
             foreach (var row in table)
             {
                 if (worker.CancellationPending)
                 {
                     e.Cancel = true;
                     break;
                 }
                 count++;
                 actionAnalyzer.AnalyzeAction(row);
                 if (count % reportValue == 0)
                 {
                     worker.ReportProgress(count, BackgroundWorkerState.ActionAnalyzerReportProgress);
                 }
             }
         }
     }
     catch (Exception ignore)
     {
     }
 }
Ejemplo n.º 2
0
        public static int GetLogSize()
        {
            int size;

            using (var db = new LibraryLogModel())
            {
                size = db.FrontOfficeAction.Count();
            }
            if (Maximum > 0 && Maximum < size)
            {
                size = Maximum;
            }
            return(size);
        }