private void frmAddTagsWebsites_Load(object sender, EventArgs e) { this.tagsTableAdapter.Connection.ConnectionString = WssConnection.ConnectionIndividual; _solrRootProductClient = SolrRootProductClient.GetClient(SolrClientManager.GetSolrClient("solrRootProducts")); try { tagsTableAdapter.FillBy_WebsiteId(dBIndi.Tags, _idWebsite); } catch (Exception exception) { Log.Error(string.Format("Website: {0} . {1}", _domainCurrent, exception)); } }
private void InitSolr() { _solrRootProductClient = SolrRootProductClient.GetClient(SolrClientManager.GetSolrClient("solrRootProducts")); }
private void RootProductAnalyzed(byte[] rootProductByte) { var jsonListProduct = UtilZipFile.Unzip(rootProductByte); var result = JsonConvert.DeserializeObject <List <RootProductAnalyzedObject> >(jsonListProduct); var dataNameCode = new Dictionary <long, List <RootProductAnalyzedObject> >(); foreach (var rootItem in result) { if (dataNameCode.ContainsKey(rootItem.RootProductId)) { dataNameCode[rootItem.RootProductId].Add(rootItem); } else { dataNameCode.Add(rootItem.RootProductId, new List <RootProductAnalyzedObject>() { rootItem }); } } var rootAdapter = new RootProductsTableAdapter(); rootAdapter.Connection.ConnectionString = _connectionStringIndi; var solrRootProductClient = SolrRootProductClient.GetClient(SolrClientManager.GetSolrClient("solrRootProducts")); DBProductTableAdapters.ProductTableAdapter productAdapter = new ProductTableAdapter(); productAdapter.Connection.ConnectionString = _connectionProduct; foreach (var rootItem in dataNameCode) { try { var rootProductSql = new RootProductSql() { RootId = rootItem.Key, Name = rootItem.Value[0].Name, WebsiteId = rootItem.Value[0].WebsiteId, NumMerchant = rootItem.Value.Count, CategoryId = rootItem.Value[0].CategoryId }; rootProductSql.LocalPath = Websosanh.Core.Common.BAL.UrlUtilities.GetRootProductLocalPath(rootProductSql.RootId, rootProductSql.Name); long minprice = 0; rootProductSql.ProductIdList = new List <long>(); var imagePath = ""; foreach (var item in rootItem.Value) { rootProductSql.ProductIdList.Add(item.Id); if (!(minprice > 0 && minprice < item.Price)) { minprice = item.Price; } if (string.IsNullOrEmpty(imagePath)) { imagePath = GetImagePath(item.Id, productAdapter); } } rootProductSql.MinPrice = minprice; rootProductSql.Image = imagePath; rootProductSql.ProductIdListString = rootProductSql.GetProductIdListString(); if (InsertSQlRootProduct(ref rootProductSql, rootAdapter)) { InsertSolrRootProduct(rootProductSql, solrRootProductClient); } } catch (Exception exception) { Log.Error(exception); } } }