private void SaveToBlackKeyword() { List <string> lstDelItem = new List <string>(); int iRowCount = this.gridView1.DataRowCount; for (int iRow = 0; iRow < iRowCount; iRow++) { try { KeywordSaleNew productSalenew = this.gridView1.GetRow(iRow) as KeywordSaleNew; if (productSalenew.is_selected) { lstDelItem.Add(productSalenew._id); } } catch (Exception ex) { log.ErrorFormat(ex.Message); } } if (MessageBox.Show("Bạn có muốn lưu không?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { Thread threadHideData = new Thread(() => SaveBlackKeyWord(lstDelItem)); threadHideData.Start(); } }
private void btnAutoFind_Click(object sender, EventArgs e) { int iRowCount = this.gridView1.DataRowCount; for (int iRow = 0; iRow < iRowCount; iRow++) { this.ShowDataProgressBar(((double)iRow / (double)iRowCount) * (double)100); KeywordSaleNew keywordsalenew = this.gridView1.GetRow(iRow) as KeywordSaleNew; long crc = Math.Abs(GABIZ.Base.Tools.getCRC64(keywordsalenew.name)); if (keywordsalenew.is_selected == false) { if (!Common.ValidKeyword(keywordsalenew.name)) { keywordsalenew.is_selected = true; } else if (!Common.ValidKeyWordGrammar(keywordsalenew.name, this.lstRegexCheckKeyword, true)) { keywordsalenew.is_selected = true; } else if (this.monoDbAdapter.CheckBlackLink(keywordsalenew._id)) { keywordsalenew.is_selected = true; } } } this.gridView1.RefreshData(); }
public bool SaveToSolr(KeywordSaleNew item) { var solr = GetSolrOperations(); var response = solr.Add(item); this.Commit(); return(response.Status == 0); }
private void toolStripButton1_Click(object sender, EventArgs e) { foreach (int i in gridView1.GetSelectedRows()) { KeywordSaleNew keyWord = this.gridView3.GetRow(i) as KeywordSaleNew; keyWord.is_selected = true; } this.gridView3.RefreshData(); }
private void SavePriorityKeyword(int newPriority) { if (MessageBox.Show("Bạn có muốn lưu khôn=g?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { MessageBox.Show("Vui lòng đợi hoàn thành"); Thread threadHideData = new Thread(() => { MongoDbRaoVat mongoDb = new MongoDbRaoVat(); try { int iRowCount = this.gridView1.DataRowCount; for (int iRow = 0; iRow < iRowCount; iRow++) { KeywordSaleNew keyword = this.gridView1.GetRow(iRow) as KeywordSaleNew; if (keyword.is_selected) { //SaveMongoDb. bool bOK = this.monoDbAdapter.UpdatePriorityKeyword(keyword._id, newPriority); if (bOK == false) { WriteLog("MongoUpdate", string.Format("Fail keyword:{0}", keyword.name)); } else { WriteLog("MongoUpdate", string.Format("Success keyword:{0}", keyword.name)); //Sync item in mongo and solr. string Webdomain = "raovat"; string URLSolrConnect = "http://183.91.14.85:8983/solr/keywords"; var slr = SolrRaoVatKeywordDriver.GetDriver(SolrRaoVatKeywordDriver.GetInstance()); BsonDocument document = mongoDb.GetKeyWordID(keyword._id).Result; if (document != null) { KeywordSaleNew keyword1 = mongoDb.ParseKeyWord(document); bool bOKSolr = slr.UpdateData(keyword1); if (!bOKSolr) { WriteLog("SolrUpdate", string.Format("Fail keyword:{0}", keyword1.name)); } } } } } this.Invoke(new Action(() => { MessageBox.Show("Saved priority keyword!"); })); } catch (Exception ex) { log.ErrorFormat(ex.Message); } }); threadHideData.Start(); this.btnLoadData.PerformClick(); } }
private void spinEdit1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { int iRowCount = this.gridView1.RowCount; for (int iRowSelected = 0; iRowSelected < iRowCount; iRowSelected++) { KeywordSaleNew keyword = this.gridView1.GetRow(iRowSelected) as KeywordSaleNew; if (keyword.is_selected) { keyword.priority = Convert.ToInt32(spinEditPriority.Value); } } this.gridView1.RefreshData(); } }
private void toolStripButton2_Click(object sender, EventArgs e) { List <KeywordSaleNew> lstBlackey = this.gridControlKey.DataSource as List <KeywordSaleNew>; List <KeywordSaleNew> lstGoodkey = this.gridControlGoodKey.DataSource as List <KeywordSaleNew>; for (int i = lstBlackey.Count - 1; i >= 0; i--) { KeywordSaleNew key = lstBlackey[i]; if (key.is_selected) { lstBlackey.RemoveAt(i); lstGoodkey.Add(key); key.is_selected = false; } } this.gridView3.RefreshData(); this.gridView1.RefreshData(); }