📄 commentaccess.cs
字号:
///////////////////////////////////////////////////////////
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -