Exemple #1
0
        /// <summary>
        /// 单条插入数据库
        /// </summary>
        /// <param name="pCrawlResultDetailList"></param>
        public void InsertCrawlResult(CrawlResultDetail pCrawlResultDetail)
        {
            using (var sqlConnection = new SqlConnection(Constant.DatabaseConnection))
            {
                string sql = string.Format("Insert into CTaskResult values(@url,@rcontent,@isdeleted,@createdtime)");
                sqlConnection.Open();
                sqlConnection.Execute(sql,
                    new
                    {
                        url = "",
                        rcontent = pCrawlResultDetail.Content,
                        isdeleted = false,
                        createdtime = DateTime.Now
                    });

                sqlConnection.Close();
            }
        }
Exemple #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="pTaskDetail"></param>
        /// <param name="pResultDetail"></param>
        public CrawlOriData(CrawlTaskDetail pTaskDetail, CrawlResultDetail pResultDetail, byte pChaset)
        {
            Host  = pTaskDetail.Host;
            Title = pTaskDetail.Title;
            Url   = pTaskDetail.Url;
            Ext   = pResultDetail.Ext;
            Data  = pResultDetail.Content;
            Dt    = DateTime.Now;
            if (Ext == null)
            {
                Ext = "html";
            }

            mDataTypeDic.TryGetValue(Ext, out DataType);

            Key    = pTaskDetail.Key;
            Chaset = pChaset;
        }
Exemple #3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="pTaskDetail"></param>
        /// <param name="pResultDetail"></param>
        public CrawlOriData(CrawlTaskDetail pTaskDetail, CrawlResultDetail pResultDetail, byte pChaset)
        {
            Host = pTaskDetail.Host;
            Title = pTaskDetail.Title;
            Url = pTaskDetail.Url;
            Ext = pResultDetail.Ext;
            Data = pResultDetail.Content;
            Dt = DateTime.Now;
            if (Ext == null) { Ext = "html"; }

            mDataTypeDic.TryGetValue(Ext, out DataType);

            Key = pTaskDetail.Key;
            Chaset = pChaset;
        }