//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.Text;
using JuSNS.Model;
using JuSNS.Common;
using JuSNS.Factory;
using System.Data;

namespace JuSNS.Home
{
    /// <summary>
    /// 分享类
    /// </summary>
    public class Share
    {
        private IShare dal;
        /// <summary>
        /// 构造函数
        /// </summary>
        public Share()
        {
            dal = DataAccess.CreateShare();
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="Info">分享实体类</param>
        /// <returns>添加成功返回1</returns>
        public int Add(ShareInfo Info)
        {
            return dal.Add(Info);
        }

        /// <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="UserID">用户编号</param>
        /// <returns>删除成功返回1</returns>
        public int Del(int ID, int UserID)
        {
            return dal.Del(ID, UserID);
        }

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

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

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

        /// <summary>
        /// 得到相册中照片数量
        /// </summary>
        /// <param name="ID">相册ID</param>
        /// <returns>照片数量</returns>
        public int AlbumCount(int ID)
        {
            return dal.AlbumCount(ID);
        }

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

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

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

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

        /// <summary>
        /// 删除评论
        /// </summary>
        /// <param name="ID">评论ID</param>
        /// <param name="UserID">用户ID</param>
        public void DelComment(int ID, int Userid)
        {
            dal.DelComment(ID, Userid);
        }

        /// <summary>
        /// 插入分享
        /// </summary>
        /// <param name="info"></param>
        public void AddShareTable(ShareInfo info)
        {
            dal.AddShareTable(info);
        }

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

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