示例#1
0
 public void Write(DbWorkersContainer container)
 {
     SafeExecute(WriteCategories, container, "update category error");
     SafeExecute(UpdateShopStatistics, container, "update shop statistics error");
     SafeExecute(WriteShopProcessLog, container, "update shop process log error");
     SafeExecute(UpdateShopUpdateDate, container, "update shop update date error");
 }
示例#2
0
 private void SafeExecute(Action <DbWorkersContainer> action, DbWorkersContainer container, string message)
 {
     try {
         action(container);
     }
     catch (Exception e) {
         _addMessage($"{DateTime.Now} { message }", false);
         _logger.Error(e);
     }
 }
示例#3
0
        private void WriteCategories(DbWorkersContainer container)
        {
            var shopCategories = _shopData.Categories.Values.ToList();

            if (shopCategories.Any())
            {
                container.UpdateShopCategory(_shopData.Name, shopCategories);
                _addMessage($"Updated {shopCategories.Count} shop categories", false);
            }
            else
            {
                _addMessage("The shop has no categories", false);
            }
        }
示例#4
0
 private void UpdateShopStatistics(DbWorkersContainer container)
 {
     container.UpdateShopStatistics(_product);
 }
示例#5
0
 private void WriteShopProcessLog(DbWorkersContainer container)
 {
     container.WriteShopProcessLog(this);
 }
示例#6
0
 private void UpdateShopUpdateDate(DbWorkersContainer container)
 {
     container.UpdateShopUpdateDate(_info.ShopId, _info.StartTime);
 }