예제 #1
0
        private void frmChoiceKeywordCategories_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dBTool.KeywordCategories' table. You can move, or remove it, as needed.
            connectionString = Server.ConnectionString;
            this.keywordCategoriesTableAdapter.Connection = new SqlConnection(connectionString);
            productCategoryTree = ProductCategoryBAL.GetProductCategoryTree(connectionString);
            var comboboxItemList = new List <ObjectItem>();

            comboboxItemList.AddRange(
                productCategoryTree.GetAllNodeInLevel(2)
                .Select(x => new ObjectItem()
            {
                Value = x.Value.ID, Text = string.Format("{1}<-{0}", productCategoryTree.GetParentNode(x.ID).Value.Name, x.Value.Name)
            }));
            comboboxItemList.AddRange(
                productCategoryTree.GetAllNodeInLevel(3)
                .Select(x => new ObjectItem()
            {
                Value = x.Value.ID, Text = string.Format("{1}<-{0}", productCategoryTree.GetParentNode(x.ID).Value.Name, x.Value.Name)
            }));
            comboboxItemList.AddRange(
                productCategoryTree.GetAllNodeInLevel(4)
                .Select(x => new ObjectItem()
            {
                Value = x.Value.ID, Text = string.Format("{1}<-{0}", productCategoryTree.GetParentNode(x.ID).Value.Name, x.Value.Name)
            }));
            object[] comboboxItemArray = comboboxItemList.OrderBy(x => x.Text).ToArray();
            comboBoxCategory1.Items.AddRange(comboboxItemArray);
            comboBoxCategory2.Items.AddRange(comboboxItemArray);
            comboBoxCategory3.Items.AddRange(comboboxItemArray);
            comboBoxCategory4.Items.AddRange(comboboxItemArray);
            comboBoxCategory5.Items.AddRange(comboboxItemArray);
        }
예제 #2
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);
         }
     }
 }
예제 #3
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;
            });
        }