using System;
using System.Collections.Generic;
using System.Reflection;
using JuSNS.Model;

namespace JuSNS.Factory
{
    //用户投票类接口
    public interface IToVote
    {
        /// <summary>
        /// 用户投票
        /// </summary>
        /// <param name="Info">用户投票实体类</param>
        /// <returns>投票成功返回1</returns>
        int Add(ToVoteInfo Info);

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

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

    public sealed partial class DataAccess
    {
        public static IToVote CreateToVote()
        {
            string className = path + ".ToVote";
            return (IToVote)Assembly.Load(path).CreateInstance(className);
        }
    }
}
