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 ToVote
    {
        private IToVote dal;

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

        /// <summary>
        /// 用户投票
        /// </summary>
        /// <param name="Info">用户投票实体类</param>
        /// <returns>投票成功返回1</returns>
        public int Add(ToVoteInfo Info)
        {
            return dal.Add(Info);
        }

        /// <summary>
        /// 取得用户是否已投票
        /// </summary>
        /// <param name="UserID">用户编号</param>
        /// <param name="VoteID">投票编号</param>
        /// <returns>如果已投票返回true,否则false</returns>
        public bool IsVote(int UserID, int VoteID)
        {
            return dal.IsVote(UserID, VoteID);
        }

        /// <summary>
        /// 投票信息
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns></returns>
        public ToVoteInfo Info(int VoteID, int UserID)
        {
            return dal.Info(VoteID, UserID);
        }
    }
}
