using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using JuSNS.Model;
using JuSNS.Common;
using JuSNS.Factory;

namespace JuSNS.Home
{
    /// <summary>
    /// 投票类
    /// </summary>
    public class Vote
    {
        private IVote dal;
        /// <summary>
        /// 构造函数
        /// </summary>
        public Vote()
        {
            dal = DataAccess.CreateVote();
        }

        /// <summary>
        /// 添加投票
        /// </summary>
        /// <param name="Info">投票实体类</param>
        /// <returns>添加成功返回投票编号</returns>
        public int Add(VoteInfo Info)
        {
            return dal.Add(Info);
        }

        /// <summary>
        /// 删除投票
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>删除成功返回1</returns>
        public int Del(int VoteID, int UserID)
        {
            return dal.Del(VoteID, UserID);
        }

        /// <summary>
        /// 添加参加人数
        /// </summary>
        /// <param name="ID">投票编号</param>
        /// <returns>添加成功返回1</returns>
        public int AddJCnt(int ID)
        {
            return dal.AddJCnt(ID);
        }

        /// <summary>
        /// 用户添加的投票数
        /// </summary>
        /// <param name="UserID">投票编号</param>
        /// <returns>返回记录数</returns>
        public int MyAddCnt(int UserID)
        {
            return dal.MyAddCnt(UserID);
        }


        /// <summary>
        /// 相册信息
        /// </summary>
        /// <param name="ID">投票编号</param>
        /// <returns>返回投票实体类</returns>
        public VoteInfo Info(int ID)
        {
            return dal.Info(ID);
        }


        /// <summary>
        /// 好友最近发起的投票列表
        /// </summary>
        /// <param name="Num">条数</param>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回列表</returns>
        public DataTable FriendNewVoteList(int Num, int UserID)
        {
            return dal.FriendNewVoteList(Num, UserID);
        }

        /// <summary>
        /// 好友最近参加的投票列表
        /// </summary>
        /// <param name="Num">条数</param>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回列表</returns>
        public DataTable FriendNewJoinVoteList(int Num, int UserID)
        {
            return dal.FriendNewJoinVoteList(Num, UserID);
        }

        /// <summary>
        /// 最近的热门投票列表
        /// </summary>
        /// <param name="Num">条数</param>
        /// <returns>返回列表</returns>
        public DataTable HotVote(int Num)
        {
            return dal.HotVote(Num);
        }

        /// <summary>
        /// 我发起的投票列表
        /// </summary>
        /// <param name="Num">条数</param>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回列表</returns>
        public DataTable MyAddVote(int Num, int UserID)
        {
            return dal.MyAddVote(Num, UserID);
        }

        /// <summary>
        /// 我发起的投票列表(排除当前的投票编号)
        /// </summary>
        /// <param name="Num">条数</param>
        /// <param name="UserID">会员编号</param>
        /// <param name="VoteID">会员编号</param>
        /// <returns>返回列表</returns>
        public DataTable MyAddVote(int Num, int UserID, int VoteID)
        {
            return dal.MyAddVote(Num, UserID, VoteID);
        }

        /// <summary>
        /// 我参与的投票列表
        /// </summary>
        /// <param name="Num">条数</param>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回列表</returns>
        public DataTable MyJoinVote(int Num, int UserID)
        {
            return dal.MyJoinVote(Num, UserID);
        }

        /// <summary>
        /// 取得朋友投票选项
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <param name="VoteID">投票编号</param>
        /// <returns>返回数据表</returns>
        public DataTable FriendVote(int UserID, int VoteID)
        {
            return dal.FriendVote(UserID, VoteID);
        }

        /// <summary>
        /// 其它人投票选项
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <param name="VoteID">投票编号</param>
        /// <returns>返回数据表</returns>
        public DataTable OtherVote(int UserID, int VoteID)
        {
            return dal.OtherVote(UserID, VoteID);
        }
    }
}