Exemple #1
0
 private void UpdateImagePathProduct(ImageProductInfo imageProductInfo, ProductTableAdapter productAdapter, JobClient historyJobClient, JobClient updateRedisJobClient)
 {
     while (_isRunning)
     {
         try
         {
             if (productAdapter.Connection.State == ConnectionState.Closed)
             {
                 productAdapter.Connection.Open();
             }
             productAdapter.UpdateImagePathAndValidAndIsNews(imageProductInfo.ImagePath, imageProductInfo.Id);
             Log.Info(string.Format("ProductId {0} : Update ImagePath And Valid success.", imageProductInfo.Id));
             break;
         }
         catch (Exception exception)
         {
             Log.Error(string.Format("ProductId {0} : Update ImagePath And Valid error.", imageProductInfo.Id), exception);
             Thread.Sleep(60000);
         }
     }
     SendMessageToServiceInsertHistoryDownload(new LogHistoryImageProduct
     {
         DateLog      = imageProductInfo.DownloadedTime,
         IsDownloaded = true,
         ErrorName    = string.Empty,
         ProductId    = imageProductInfo.Id,
         NewsToValid  = imageProductInfo.IsNew
     }, historyJobClient);
     if (imageProductInfo.IsNew)
     {
         SendMessageToServiceUpdateSolrAndRedis(imageProductInfo.Id);
     }
     else
     {
         SendMessageToServiceUpdateRedis(imageProductInfo.Id, updateRedisJobClient);
     }
 }