//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.Data;
using System.Collections.Generic;
using System.Reflection;
using JuSNS.Model;

namespace JuSNS.Factory
{
    public interface IShare
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="Info">分享实体类</param>
        /// <returns>添加成功返回1</returns>
        int Add(ShareInfo Info);

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

        /// <summary>
        /// 删除分享(前台)
        /// </summary>
        /// <param name="ID">分享编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>删除成功返回1</returns>
        int Del(int ID, int UserID);

        /// <summary>
        /// 取得分享评论总数
        /// </summary>
        /// <param name="ID">分享编号</param>
        /// <returns>返回评论总数</returns>
        int CommentsCount(int ID);

        /// <summary>
        /// 添加评论次数
        /// </summary>
        /// <param name="ID">分享编号</param>
        void AddComments(int ID);

        /// <summary>
        /// 取得分享信息
        /// </summary>
        /// <param name="ID">编号</param>
        /// <returns>返回分享实体类</returns>
        ShareInfo Info(int ID);

        /// <summary>
        /// 相册照片数
        /// </summary>
        /// <param name="ID">相册ID</param>
        /// <returns>相册数量</returns>
        int AlbumCount(int ID);

        /// <summary>
        /// 得到相册的封面
        /// </summary>
        /// <param name="ID">相册ID</param>
        /// <returns>#0无封面。否则为封面地址</returns>
        string AlbumIndexPic(int ID);

        /// <summary>
        /// 得到分享照片的地址
        /// </summary>
        /// <param name="ID">照片ID</param>
        /// <returns></returns>
        string PhotoURL(int ID);

        /// <summary>
        /// 获得评论列表
        /// </summary>
        /// <param name="ID">被评论的分享ID</param>
        /// <returns></returns>
        IDataReader ShareCommentList(int ID);

        /// <summary>
        /// 插入分享评论表
        /// </summary>
        /// <param name="ID">被评论ID</param>
        /// <param name="UserID">用户ID</param>
        /// <param name="Content">内容</param>
        /// <param name="isLock">是否锁定</param>
        void PostComment(int ID, int UserID, string Content, int isLock);

         /// <summary>
        /// 删除评论
        /// </summary>
        /// <param name="ID">评论ID</param>
        /// <param name="Userid">用户ID</param>
        void DelComment(int ID, int Userid);

        /// <summary>
        /// 插入分享
        /// </summary>
        void AddShareTable(ShareInfo info);

        /// <summary>
        /// 得到一个网页地址
        /// </summary>
        /// <param name="Id">分享的ID</param>
        /// <returns></returns>
        string GetURLAddress(int Id);

        /// <summary>
        /// 得到用户ID
        /// </summary>
        /// <param name="id">分享的ID</param>
        /// <returns></returns>
        int GetCaseID(int id);
    }

    public sealed partial class DataAccess
    {
        public static IShare CreateShare()
        {
            string className = path + ".Share";
            return (IShare)Assembly.Load(path).CreateInstance(className);
        }
    }
}
