Esempio n. 1
0
        public void SyncEnd()
        {
            var count = 0;

            if (_syncHistoryId.HasValue)
            {
                using (var db = _dbFactory.GetRWDb())
                {
                    var history = db.SyncHistory.Get(_syncHistoryId.Value);
                    var status  = SyncStatus.Complete;
                    if (_withWarning.Any(String.IsNullOrEmpty))
                    {
                        status = SyncStatus.CompleteWithWarnings;
                    }
                    if (_withErrors.Any(String.IsNullOrEmpty))
                    {
                        status = SyncStatus.CompleteWithErrors;
                    }

                    if (history != null)
                    {
                        history.EndDate = DateTime.UtcNow;
                        lock (_syncListObj)
                        {
                            count = _orderList.Count(v => !String.IsNullOrEmpty(v));
                        }
                        history.ProcessedTotal       = count;
                        history.ProcessedWithWarning = _withWarning.Count(v => !String.IsNullOrEmpty(v));
                        history.ProcessedWithError   = _withErrors.Count(v => !String.IsNullOrEmpty(v));
                        history.Status = (int)status;
                        db.Commit();
                    }
                }
            }

            _logger.Info("[Sync] end, type=" + _syncType
                         + ", market=" + _market
                         + ", marketplaceId=" + _marketplaceId
                         + ", id=" + _syncHistoryId
                         + ", total=" + count
                         + ", withErrors=" + _withErrors.Count
                         + ", withWarning=" + _withWarning.Count);

            _syncHistoryId = null;
        }
Esempio n. 2
0
 /// <summary>
 /// Return count of Unobserved Events
 /// </summary>
 /// <returns></returns>
 public int UnobservedEventCount()
 {
     return(EventLogEntries.Count(e => e.Observed == false));
 }
Esempio n. 3
0
 public bool ExistsNeighbor(PhysicalAddress physicalAddress)
 {
     return(neighbors.Count(n => n.physicalAddress.Equals(physicalAddress)) > 0);
 }