commentaccess.cs
来自「ASP.NET 2.0动态网站设计实例源代码,本书介绍了ASP.NET2.0的基」· CS 代码 · 共 97 行
CS
97 行
///////////////////////////////////////////////////////////
// CommentAccess.cs
// Implementation of the Class CommentAccess
// Generated by Enterprise Architect
// Created on: 07-五月-2006 14:00:58
///////////////////////////////////////////////////////////
using BookShop.Entity;
using System.Data;
using System.Data.SqlClient;
namespace BookShop.DataAccess {
/// <summary>
/// 评论数据操作
/// </summary>
public class CommentAccess {
public CommentAccess(){
}
~CommentAccess(){
}
public virtual void Dispose(){
}
/// <summary>
/// 添加评论
/// </summary>
/// <param name="coment"></param>
public bool AddComment(CommentEntity coment){
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@CommenderID",SqlDbType.Int),
new SqlParameter("@BookID",SqlDbType.Int),
new SqlParameter("@Title",SqlDbType.NVarChar,200),
new SqlParameter("@Content",SqlDbType.NText)
};
parms[0].Value = coment.MemberID;
parms[1].Value = coment.GoodsID;
parms[2].Value = coment.Title;
parms[3].Value = coment.Content;
if (DbTools.ExectueNoQuery("AddComment", parms) > 0)
return true;
else
return false;
}
/// <summary>
/// 删除指定ID的评论
/// </summary>
/// <param name="ID"></param>
public bool DeleteCommentByID(int ID){
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@ID",SqlDbType.Int)
};
parms[0].Value=ID;
if(DbTools.ExectueNoQuery("DelteCommentByID",parms)>0)
return true;
else
return false;
}
/// <summary>
/// 根据会员ID获取评论列表
/// </summary>
/// <param name="memberID"></param>
public DataTable GetCommentsByCommenterID(int memberID){
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@MemberID",SqlDbType.Int)
};
parms[0].Value = memberID;
return DbTools.ExecuteQuery("GetCommentsByCommenterID", parms).Tables[0];
}
/// <summary>
/// 获取指定货物的评论
/// </summary>
/// <param name="goodsID"></param>
public DataTable GetCommentsByGoodsID(int goodsID){
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@GoodsID",SqlDbType.Int)
};
parms[0].Value = goodsID;
return DbTools.ExecuteQuery("GetCommentsByGoodsID", parms).Tables[0];
}
}//end CommentAccess
}//end namespace DataAccess
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?