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

namespace JuSNS.Factory
{
    public interface ISpace
    {
        DataTable getUserInfo(int Id,int flag);
        DataTable getConstellation(int flag);//读取所有星座
        int UpdateUserInfo(JuSNS.Model.UserBasicInfo Info, int ID, int flag);
        /// <summary>
        /// 更新会员信息可见度
        /// </summary>
        /// <param name="StrName">字段名称</param>
        /// <param name="k">值</param>
        /// <param name="UserID">会员编号</param>
        /// <returns></returns>
        int UpdatePrivacy(string StrName, int k, int UserID);
        /// <summary>
        /// 根据相关编号删除会员相关信息
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        int DelInfo(int ID, int flag);
        /// <summary>
        /// 根据受教育程度和区域读学校信息
        /// </summary>
        /// <param name="AreaId">区域编号</param>
        /// <param name="DegreeID">受教育程度</param>
        /// <returns></returns>
        DataTable getShool(int AreaId, int DegreeID);
        /// <summary>
        /// 根据省份名称,地区编号和受教育程度搜索学校
        /// </summary>
        /// <param name="shoolName">省份名称</param>
        /// <param name="AreaId">地区编号</param>
        /// <param name="DegreeID">受教育程度</param>
        /// <returns></returns>
        DataTable searchShool(string shoolName, int AreaId, int DegreeID);

        /// <summary>
        /// 添加会员教育信息
        /// </summary>
        /// <param name="Info"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        int AddEducationInfo(JuSNS.Model.UserEducationInfo Info, int ID);
        
        /// <summary>
        /// 添加更新会员工作信息
        /// </summary>
        /// <param name="Info"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        int AddCareerInfo(JuSNS.Model.UserCareerInfo Info, int ID);

        /// <summary>
        /// 留言
        /// </summary>
        /// <param name="myid">留言者编号</param>
        /// <param name="userId">接收者编号</param>
        /// <param name="content">留言内容</param>
        /// <param name="IP">留言IP</param>
        /// <returns></returns>
        int LeaveWords(int myid, int userId, string content, string IP);
         /// <summary>
        /// 检查用户是否具有某种权限
        /// </summary>
        /// <param name="privacy">权限类型</param>
        /// <param name="guest">等待验证的是否有权限的用户ID</param>
        /// <param name="host">主体者的ID</param>
        /// <returns></returns>
        bool CheckPar(int privacy, int guest, int host);

        /// <summary>
        /// 添加、更新访问信息
        /// </summary>
        /// <param name="MasterID">被访问者编号</param>
        /// <param name="VisitorID">访问者编号</param>
        /// <param name="LastVisitTime">访问时间</param>
        /// <returns></returns>
        int InserVisit(int MasterID, int VisitorID);

        /// <summary>
        /// 判断是否是同一个网络
        /// </summary>
        /// <param name="myId"></param>
        /// <param name="Friend"></param>
        /// <returns>true :是的  false：不是</returns>
        bool CheckSameNet(int myId, int Friend);

        /// <summary>
        /// 添加修改行业
        /// </summary>
        /// <param name="VocationName">行业名称</param>
        /// <param name="flag">标识 0：添加，1：修改</param>
        /// <returns></returns>
        int UpdateAddVocation(int ID, string VocationName, int flag);

        /// <summary>
        /// 锁定、解锁、删除行业信息
        /// </summary>
        /// <param name="ID">行业编号</param>
        /// <param name="value"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        int LockDelVocation(int ID, int value, int flag);

        /// <summary>
        /// 读取用户在同一时间同一操作类型的日志
        /// </summary>
        /// <param name="type"></param>
        /// <param name="userID"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        DataTable getPhoto(int type, int userID, DateTime time);
        /// <summary>
        /// 删除添加的相片日志
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        int DelUserInfo(int ID, string time, int type, int userid);

        DataTable GetSpaceTemplateList(int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SqlConditionInfo[] SqlCondition);

        DataTable GetSpaceTemplateList1(int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SqlConditionInfo[] SqlCondition);

        IDataReader GetSpaceTemplate(int TID);

        void UpdateSpaceTemplateLockStatc(int ID, int num);
        /// <summary>
        /// 更新会员被查看次数
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="times"></param>
        /// <returns></returns>
        int InsertClick(int UserID, int times);

        IDataReader getSpaceTemplateInfo(int ID);

        void USpaceTemplate(int ID, string TName, string TPath, string TPicture, DateTime CreatTime, int IsLock, int IPoint, int GPoint, int isBG, int UserID, int UserNumber);

        bool GetIsFriend(int UserID, int uID);
    }
    public sealed partial class DataAccess
    {
        public static ISpace CreateSpace()
        {
            string className = path + ".Space";
            return (ISpace)Assembly.Load(path).CreateInstance(className);
        }
    }
}
