using System;
using System.Collections;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using Solog.Model;
namespace Solog.AcessTask
...{
class SqlHelper
...{
//把DataReader转换成实体类型#region //把DataReader转换成实体类型
/**//// <summary>
/// 转换成实体类型
/// </summary>
/// <returns>ArticleInfo</returns>
public static ArticleInfo ConvertToArticleInfo(OleDbDataReader dr, ArticleInfo info)
...{
if (dr == null || info == null)
return info;
info.ID = (int)dr["log_ID"];
info.cateId = (int)dr["log_CateID"];
info.cateName = (string)dr["cate_Name"];
info.postTime = (DateTime)dr["log_PostTime"];
info.ViewNums = (int)dr["log_ViewNums"];
info.commentNum = (int)dr["log_CommNums"];
info.content = (string)dr["log_Content"];
info.from = (string)dr["log_From"];
info.intro = (string)dr["log_Intro"];
info.isShow = (bool)dr["log_IsShow"];
info.isTop = (bool)dr["log_IsTop"];
info.title = (string)dr["log_Title"];
return info;
}
//转换成评论实体类
public static CommentInfo ConvertToCommentInfo(OleDbDataReader dr, CommentInfo info)
...{
if (dr == null || info == null)
return info;
info.comm_ID=(int)dr["comm_ID"];
info.logId = (int)dr["blog_ID"];
info.commContent = (string)dr["comm_Content"];
info.author = (string)dr["comm_Author"];
info.postTime = (DateTime)dr["comm_PostTime"];
info.email = (string)dr["author_email"];
info.web = (string)dr["author_web"];
info.postIp = (string)dr["comm_PostIp"];
return info;
}
//转换成访问统计类
public static VistorInfo ConvertToVistorInfo(OleDbDataReader dr, VistorInfo info)
...{
if (dr == null || info == null)
return info;
info.ID=(int)dr["coun_ID"];
info.IP=(string)dr["coun_IP"];
info.Agent = (string)dr["coun_Agent"];
info.ReferUrl=(string)dr["coun_Refer"];
info.VistorTime=(DateTime)dr["coun_Time"];
return info;
}
#endregion
}
}
using System.Collections;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using Solog.Model;
namespace Solog.AcessTask
...{
class SqlHelper
...{
//把DataReader转换成实体类型#region //把DataReader转换成实体类型
/**//// <summary>
/// 转换成实体类型
/// </summary>
/// <returns>ArticleInfo</returns>
public static ArticleInfo ConvertToArticleInfo(OleDbDataReader dr, ArticleInfo info)
...{
if (dr == null || info == null)
return info;
info.ID = (int)dr["log_ID"];
info.cateId = (int)dr["log_CateID"];
info.cateName = (string)dr["cate_Name"];
info.postTime = (DateTime)dr["log_PostTime"];
info.ViewNums = (int)dr["log_ViewNums"];
info.commentNum = (int)dr["log_CommNums"];
info.content = (string)dr["log_Content"];
info.from = (string)dr["log_From"];
info.intro = (string)dr["log_Intro"];
info.isShow = (bool)dr["log_IsShow"];
info.isTop = (bool)dr["log_IsTop"];
info.title = (string)dr["log_Title"];
return info;
}
//转换成评论实体类
public static CommentInfo ConvertToCommentInfo(OleDbDataReader dr, CommentInfo info)
...{
if (dr == null || info == null)
return info;
info.comm_ID=(int)dr["comm_ID"];
info.logId = (int)dr["blog_ID"];
info.commContent = (string)dr["comm_Content"];
info.author = (string)dr["comm_Author"];
info.postTime = (DateTime)dr["comm_PostTime"];
info.email = (string)dr["author_email"];
info.web = (string)dr["author_web"];
info.postIp = (string)dr["comm_PostIp"];
return info;
}
//转换成访问统计类
public static VistorInfo ConvertToVistorInfo(OleDbDataReader dr, VistorInfo info)
...{
if (dr == null || info == null)
return info;
info.ID=(int)dr["coun_ID"];
info.IP=(string)dr["coun_IP"];
info.Agent = (string)dr["coun_Agent"];
info.ReferUrl=(string)dr["coun_Refer"];
info.VistorTime=(DateTime)dr["coun_Time"];
return info;
}
#endregion
}
}