using System;
using System.Collections.Generic;
using System.Reflection;
using JuSNS.Model;
using System.Data;

namespace JuSNS.Factory
{
    /// <summary>
    /// 群组接口类
    /// </summary>
    public interface IUserGroup
    {
        /// <summary>
        /// 添加群组
        /// </summary>
        /// <param name="Info">群组实体类</param>
        /// <returns>添加成功返回群编号</returns>
        int Add(UserGroupInfo Info);

        /// <summary>
        /// 删除群组(后台)
        /// </summary>
        /// <param name="GroupID">群组编号</param>
        /// <returns>删除成功返回1</returns>
        int Del(int GroupID);


        int isRec(int GroupId, int st);

        /// <summary>
        ///  删除群组
        /// </summary>
        /// <param name="GroupID">群组编号</param>
        /// <param name="UserID">群主编号</param>
        /// <returns>删除成功返回1,否则返回-1</returns>
        int Del(int GroupID, int UserID);

        /// <summary>
        /// 修改群组基本信息
        /// </summary>
        /// <param name="Info">群组实体类</param>
        /// <returns>修改成功返回1</returns>
        int EditInfo(UserGroupInfo Info);

        /// <summary>
        /// 修改群组头像
        /// </summary>
        /// <param name="Info">群组实体类</param>
        /// <returns>修改成功返回1</returns>
        int EditHead(UserGroupInfo Info);

        /// <summary>
        /// 取得会员总共加入的群组数
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <returns></returns>
        int Count(int UserID, string a);

        /// <summary>
        /// 检查是否是自已的群组
        /// </summary>
        /// <param name="GroupID">群组编号</param>
        /// <param name="UserID">会员编号</param>
        /// <returns></returns>
        bool IsMyGroup(int GroupID, int UserID);

        /// <summary>
        /// 群组信息
        /// </summary>
        /// <param name="GroupID">群组编号</param>
        /// <returns>返回群组实体类</returns>
        UserGroupInfo Info(int GroupID);
        /// <summary>
        /// 取得指定用户群组
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        List<UserGroupInfo> GetUserGroup(int UserID);

        DataTable GetUserGroupDis(int GroupID, int TopNum);
    }
    public sealed partial class DataAccess
    {
        public static IUserGroup CreateUserGroup()
        {
            string className = path + ".UserGroup";
            return (IUserGroup)Assembly.Load(path).CreateInstance(className);
        }
    }
}
