コード例 #1
0
 private void UpdateData()
 {
     while (_isRunning)
     {
         if ((DateTime.Now - LastUpdateDataTime) > TimeSpan.FromMinutes(600))
         {
             try
             {
                 var regionTree         = RegionBAL.GetRegionTree(_productConnectionString);
                 var categoryTree       = ProductCategoryBAL.GetProductCategoryTree(_productConnectionString);
                 var categoryTags       = IndexProductTools.GetAllCategoryTags(_productConnectionString);
                 var listPrefixCategory = IndexProductTools.GetAllPrefixCategory(_productConnectionString);
                 solrIndexer.RegionTree         = regionTree;
                 solrIndexer.CategoryTree       = categoryTree;
                 solrIndexer.CategoryTags       = categoryTags;
                 solrIndexer.ListPrefixCategory = listPrefixCategory;
                 LastUpdateDataTime             = DateTime.Now;
                 Logger.Info("Update Data Success!");
             }
             catch (Exception exception)
             {
                 Logger.Error("Update Data Error.", exception);
                 Thread.Sleep(30000);
             }
         }
         else
         {
             Thread.Sleep(10000);
         }
     }
 }
コード例 #2
0
        private void InitData()
        {
            this.Invoke((MethodInvoker) delegate
            {
                panelMainControl.Enabled = false;
            });
            var listMerchantUseDatafeedID = IndexProductTools.GetListMerchantUseDatafeedID(_productConnectionString);;
            var listSpecialMerchantID     = IndexProductTools.GetListSpecialMerchantID(_productConnectionString);
            var listPriorMerchants        = IndexProductTools.GetAllPriorMerchants(_productConnectionString);
            var listBadMerchant           = IndexProductTools.GetAllBadMerchantId(_productConnectionString, 35);

            solrIndexer.ListMerchantUseDatafeedID = listMerchantUseDatafeedID;
            solrIndexer.ListSpecialMerchantID     = listSpecialMerchantID;
            solrIndexer.ListPriorMerchants        = listPriorMerchants;
            solrIndexer.ListBadMerchantID         = listBadMerchant;
            var regionTree         = RegionBAL.GetRegionTree(_productConnectionString);
            var categoryTree       = ProductCategoryBAL.GetProductCategoryTree(_productConnectionString);
            var categoryTags       = IndexProductTools.GetAllCategoryTags(_productConnectionString);
            var listPrefixCategory = IndexProductTools.GetAllPrefixCategory(_productConnectionString);

            solrIndexer.RegionTree         = regionTree;
            solrIndexer.CategoryTree       = categoryTree;
            solrIndexer.CategoryTags       = categoryTags;
            solrIndexer.ListPrefixCategory = listPrefixCategory;
            var propertyValueDictionary = WebProductPropertyBAL.GetAllPropertyValues(_productConnectionString);
            var propertyUnitDictionary  = WebProductPropertyBAL.GetPropertyUnitDictionary(_productConnectionString);

            solrIndexer.PropertyUnitDictionary  = propertyUnitDictionary;
            solrIndexer.PropertyValueDictionary = propertyValueDictionary;
            this.Invoke((MethodInvoker) delegate
            {
                panelMainControl.Enabled = true;
            });
        }