Exemple #1
0
 private void UpdateProperties()
 {
     while (_isRunning)
     {
         if ((DateTime.Now - LastUpdatePropertiesTime) > TimeSpan.FromHours(12))
         {
             try
             {
                 var propertyValueDictionary =
                     WebProductPropertyBAL.GetAllPropertyValues(_productConnectionString);
                 var propertyUnitDictionary =
                     WebProductPropertyBAL.GetPropertyUnitDictionary(_productConnectionString);
                 solrIndexer.PropertyUnitDictionary  = propertyUnitDictionary;
                 solrIndexer.PropertyValueDictionary = propertyValueDictionary;
                 LastUpdatePropertiesTime            = DateTime.Now;
                 Logger.Info("Update Properties Success!");
             }
             catch (Exception exception)
             {
                 Logger.Error("Update Properties Error.", exception);
                 Thread.Sleep(30000);
             }
         }
         else
         {
             Thread.Sleep(10000);
         }
     }
 }
Exemple #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;
            });
        }