//by JuSNS v1.0系列
//官方站：www.juSNS.com，演示站:www.ju001.com，www.julala.cn
//QQ:655071(技术)，QQ:9170617（客服）
//MSN:simplt@163.com EMail:simplt@163.com
//program design by Simplt.Xie，arjun
//========================================
using System;
using System.Collections.Generic;
using System.Reflection;
using JuSNS.Model;

namespace JuSNS.Factory
{
    /// <summary>
    /// 照片接口类
    /// </summary>
    public interface IPhoto
    {
        /// <summary>
        /// 添加照片
        /// </summary>
        /// <param name="Info">照片实体类</param>
        /// <returns>添加成功返回1</returns>
        int Add(PhotoInfo Info);

        /// <summary>
        /// 修改照片
        /// </summary>
        /// <param name="Info">照片实体类</param>
        /// <returns>修改成功返回1</returns>
        int Edit(PhotoInfo Info);

        /// <summary>
        /// 添加照片被查看次数
        /// </summary>
        /// <param name="PhotoID">相片编号</param>
        /// <returns>添加成功返回1</returns>
        int AddViews(int PhotoID);

        /// <summary>
        /// 添加照片评论次数
        /// </summary>
        /// <param name="PhotoID">相片编号</param>
        /// <returns>添加成功返回1</returns>
        int AddComm(int PhotoID);

        /// <summary>
        /// 取得照片被查看次数
        /// </summary>
        /// <param name="PhotoID">相片编号</param>
        /// <returns>返回查看次数</returns>
        int ViewsCount(int PhotoID);

        /// <summary>
        /// 取得照片评论次数
        /// </summary>
        /// <param name="PhotoID">相片编号</param>
        /// <returns>返回照片评论次数</returns>
        int CommCount(int PhotoID);

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

        /// <summary>
        /// 删除照片(前台)
        /// </summary>
        /// <param name="PhotoID">照片编号</param>
        /// <param name="UploadUser">照片上传者编号</param>
        /// <returns></returns>
        int Del(int PhotoID, int UploadUser);

        /// <summary>
        /// 取得会员当前头像地址
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回头像地址</returns>
        string NonceHead(int UserID);

        /// <summary>
        /// 照片信息
        /// </summary>
        /// <param name="PhotoID">照片编号</param>
        /// <returns>返回照片实体类</returns>
        PhotoInfo Info(int PhotoID);

        /// <summary>
        /// 照片信息列表
        /// </summary>
        /// <param name="AlbumID">相册编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>返回照片集</returns>
        List<PhotoInfo> InfoList(int AlbumID,int UserID);
        /// <summary>
        /// 照片信息列表
        /// </summary>
        /// <param name="AlbumID">相册编号</param>
        /// <returns></returns>
        List<PhotoInfo> InfoList(int AlbumID);
        /// <summary>
        /// 同一个相册照片数量
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <returns></returns>
        int PhotoCount(int photoID);

        /// <summary>
        /// 同一相册上一张照片ID
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <returns></returns>
        int NextPhotoID(int photoID);

        /// <summary>
        /// 头像像册下一张照片
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int NextPhotoID(int photoID, int UserID);

        /// <summary>
        /// 同一相册上一张照片ID
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <returns></returns>
        int PrePhotoID(int photoID);
        /// <summary>
        /// 同一相册上一张照片ID,头像相册中
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int PrePhotoID(int photoID,int UserID);
        /// <summary>
        /// 照片位于相册中的第几张
        /// </summary>
        /// <param name="photoID"></param>
        /// <returns></returns>
        int TheNumber(int photoID);
        /// <summary>
        /// 照片位于相册中的第几张,头像相册中
        /// </summary>
        /// <param name="photoID">照片ID</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int TheNumber(int photoID,int UserID);

        /// <summary>
        /// 设置封面照片
        /// </summary>
        /// <param name="photoID">相片编号</param>
        /// <param name="UserID">会员编号</param>
        /// <param name="tf">true代表是头像</param>
        void SetCover(int photoID, int UserID, bool tf);

        /// <summary>
        /// 头像照片信息列表
        /// </summary>
        /// <param name="AlbumID">相册编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>返回照片集</returns>
        List<PhotoInfo> HeadInfoList(int AlbumID, int UserID);

        /// <summary>
        /// 锁定
        /// </summary>
        /// <param name="PhotoID">照片ID</param>
        /// <returns></returns>
        int Lock(int PhotoID);


        int unLock(int PhotoID);
        /// <summary>
        /// 返回头像数目
        /// </summary>
        /// <param name="PhotoID">照片id</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int HeadCount(int PhotoID,int UserID);

        List<PhotoInfo> GroupInfoList(int GroupID);
    }

    public sealed partial class DataAccess
    {
        public static IPhoto CreatePhoto()
        {
            string className = path + ".Photo";
            return (IPhoto)Assembly.Load(path).CreateInstance(className);
        }
    }
}
