public List <Comment> ParseComment(DsConfigurationComment.Configuration_CommentRow configuration, HtmlDocument doc, JobWaitAS job) { List <Comment> lst = new List <Comment>(); var nodeReviews = doc.DocumentNode.SelectNodes(configuration.CommentListXpath); if (nodeReviews != null) { foreach (var nodeReview in nodeReviews) { Comment cmt = new Comment(); cmt.Author = GetTextReview(nodeReview, configuration.AuthorXPath); cmt.Title = GetTextReview(nodeReview, configuration.ContentXPath); cmt.Content = GetTextReview(nodeReview, ".//div[@itemprop='description']"); cmt.DatePublish = GetTextReview(nodeReview, configuration.DatePostXPath); cmt.ProductId = job.Id; cmt.CompanyId = job.CompanyId; cmt.Url = job.Url; if (!string.IsNullOrEmpty(cmt.Content)) { lst.Add(cmt); } } } return(lst); }
private void SaveData() { try { using (var db = new Configuration_CommentTableAdapter()) { var tblConfigurationCommentDataTable = gridControl1.DataSource as DsConfigurationComment.Configuration_CommentDataTable; var changeRow = tblConfigurationCommentDataTable.GetChanges(); if (changeRow != null) { foreach (DataRow VARIABLE in changeRow.Rows) { DsConfigurationComment.Configuration_CommentRow row = VARIABLE as DsConfigurationComment.Configuration_CommentRow; db.prc_Configuration_Commment_Upsert(row.CompanyId, row.CommentListXpath, row.AuthorXPath, row.ContentXPath, row.ScoreXPath, row.DatePostXPath, ""); } } } MessageBox.Show("Saved!"); } catch (Exception exp) { MessageBox.Show(exp.Message + exp.StackTrace); } }
public ConsumerAsComment(RabbitMQServer rabbitmqServer) : base(rabbitmqServer, Config.QueueWaitAsComment, false) { string domain = "lazada.vn"; _noSqlHtml = NoSqlCommentSystem.Instance(); _producerComment = new ProducerBasic(rabbitmqServer, "Comment", "Comment.CommentUser.#"); using (var db = new DsConfigurationCommentTableAdapters.Configuration_CommentTableAdapter()) { DsConfigurationComment.Configuration_CommentDataTable tbl = new DsConfigurationComment.Configuration_CommentDataTable(); db.FillByCompanyDomain(tbl, domain); _configuration = tbl.Rows[0] as DsConfigurationComment.Configuration_CommentRow; } }