using System;
using System.Collections.Generic;
using System.Text;
using JuSNS.Model;
using JuSNS.Common;
using JuSNS.Factory;

namespace JuSNS.Home
{
    /// <summary>
    /// 群讨论类
    /// </summary>
    public class Group
    {
        private IGroup dal;

        /// <summary>
        /// 构造函数
        /// </summary>
        public Group()
        {
            dal = DataAccess.CreateGroup();
        }

        /// <summary>
        /// 添加新主题
        /// </summary>
        /// <param name="Info">群讨论实体类</param>
        /// <returns>添加成功返回1</returns>
        public int Add(GroupDiscussInfo Info)
        {
            return dal.Add(Info);
        }

        /// <summary>
        /// 修改主题信息
        /// </summary>
        /// <param name="Content">内容</param>
        /// <param name="UserID">会员编号</param>
        /// <param name="ID">回复编号</param>
        /// <returns>修改成功返回1</returns>
        public int Edit(string Content, int UserID, int ID)
        {
            return dal.Edit(Content, UserID, ID);
        }

        /// <summary>
        /// 删除(后台)
        /// </summary>
        /// <param name="ID">编号</param>
        /// <returns>删除成功返回1</returns>
        public int Del(int ID)
        {
            return dal.Del(ID);
        }

        /// <summary>
        /// 删除(前台)
        /// </summary>
        /// <param name="ID">编号</param>
        /// <param name="GroupID">会员编号</param>
        /// <returns>返回影响记录数</returns>
        public int Del(int ID, int UserID)
        {
            return dal.Del(ID, UserID);
        }

        /// <summary>
        /// 回复主题
        /// </summary>
        /// <param name="Info">群讨论实体类</param>
        /// <returns>回复成功返回1</returns>
        public int Replay(GroupDiscussInfo Info)
        {
            return dal.Replay(Info);
        }

        /// <summary>
        /// 锁定主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>锁定成功返回1</returns>
        public int Lock(int ID)
        {
            return dal.Lock(ID);
        }

        /// <summary>
        /// 解锁主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>解锁成功返回1</returns>
        public int UnLock(int ID)
        {
            return dal.UnLock(ID);
        }

        /// <summary>
        /// 置顶主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>置顶成功返回1</returns>
        public int Top(int ID)
        {
            return dal.Top(ID);
        }

        /// <summary>
        /// 取消置顶
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>取消置顶成功返回1</returns>
        public int UnTop(int ID)
        {
            return dal.UnTop(ID);
        }

        /// <summary>
        /// 取得讨论信息
        /// </summary>
        /// <param name="ID">贴子编号</param>
        /// <returns>返回群讨论实体类</returns>
        public GroupDiscussInfo Info(int ID)
        {
            return dal.Info(ID);
        }
    }
}
