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

namespace JuSNS.Home
{
    /// <summary>
    /// 投票选项类
    /// </summary>
    public class VoteOption
    {
        private IVoteOption dal;

        /// <summary>
        /// 构造函数
        /// </summary>
        public VoteOption()
        {
            dal = DataAccess.CreateVoteOption();
        }

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

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

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

        /// <summary>
        /// 选项列表
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <returns>返回列表</returns>
        public List<VoteOptionInfo> OptionList(int VoteID)
        {
            return dal.OptionList(VoteID);
        }

        /// <summary>
        /// 取得用户投票选项
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <param name="UserID">用户编号</param>
        /// <param name="tf">如果用户已投票返回true,否则返回false</param>
        /// <returns>返回列表</returns>
        public List<VoteOptionInfo> OptionList(int VoteID, int UserID, out bool tf)
        {
            return dal.OptionList(VoteID, UserID, out tf);
        }

    }
}
