private void ParseProduct(ref Entities.CrawlerProduct.RabbitMQ.MsProduct product, Row row) { product.Product_Id = Convert.ToInt64(row.GetValue(typeof(object), "product_id")); product.Name = row.GetValue(typeof(object), "name").ToString(); product.Note = row.GetValue(typeof(object), "note").ToString(); product.Price = Convert.ToInt64(row.GetValue(typeof(object), "price")); product.DateSearch = Convert.ToInt64(row.GetValue(typeof(object), "date_search")); if (product.DateSearch > 0) { string str = product.DateSearch.ToString(); string strYear = str.Substring(0, 2); string strMonth = str.Substring(2, 2); string strDay = str.Substring(4, 2); string strHour = str.Substring(6, 2); string strMinute = str.Substring(8, 2); str = strMonth + "/" + strDay + "/" + "20" + strYear + " " + strHour + ":" + strMinute; DateTime date = Convert.ToDateTime(str); product.Date = date; } else { product.Date = null; } product.Classification = row.GetValue(typeof(object), "classification").ToString(); product.Url = QT.Entities.Common.Obj2String(row.GetValue(typeof(object), "url")); product.Is_Black_Link = QT.Entities.Common.Obj2Bool(row.GetValue(typeof(object), "is_black_list")); }
public List <QT.Entities.CrawlerProduct.RabbitMQ.MsProduct> GetDetailSession(string session) { List <QT.Entities.CrawlerProduct.RabbitMQ.MsProduct> lst = new List <Entities.CrawlerProduct.RabbitMQ.MsProduct>(); string query = string.Format(this.querySelectBySession, session); RowSet rowSet = _session.Execute(query); IEnumerable <Row> rows = rowSet.GetRows(); foreach (Row row in rows) { QT.Entities.CrawlerProduct.RabbitMQ.MsProduct product = new Entities.CrawlerProduct.RabbitMQ.MsProduct(); ParseProduct(ref product, row); lst.Add(product); } return(lst); }