using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using JuSNS.Factory;

namespace JuSNS.Home
{
    /// <summary>
    /// 留言板
    /// </summary>
    public class GBook
    {
        private IGBook dal;
        /// <summary>
        /// 构造函数
        /// </summary>
        public GBook()
        {
            dal = DataAccess.CreateGBook();
        }
        /// <summary>
        /// 新增留言
        /// </summary>
        /// <param name="id"></param>
        /// <param name="senderId"></param>
        /// <param name="recieverId"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public int Edit(int id, int senderId, int receiverId, string content,int pid,int ispub)
        {
            return dal.Edit(id, senderId, receiverId, content, pid, ispub);
        }
        /// <summary>
        /// 查看是否有权查看某人留言
        /// </summary>
        /// <param name="guestId"></param>
        /// <param name="masterId"></param>
        /// <returns></returns>
        public bool CheckAuthority(int guestId, int masterId)
        {
            return dal.CheckAuthority(guestId, masterId);
        }
        /// <summary>
        /// 删除留言
        /// </summary>
        /// <param name="userId">操作用户的ID</param>
        /// <param name="id">要删除的留言ID</param>
        /// <returns></returns>
        public int Delete(int userId, int id)
        {
            return dal.Delete(userId, id);
        }

        /// <summary>
        /// 得到留言的回复
        /// </summary>
        public IDataReader GetRepayBook(int UserID, int ParentID)
        {
            return dal.GetRepayBook(UserID, ParentID);
        }
    }
}
