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

namespace JuSNS.Factory
{
    public interface IManager
    {
        /// <summary>
        /// 检查登录
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        EnumLoginState CheckLogin(int adminId, string password);
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="Email">用户名</param>
        /// <param name="Password">密码</param>
        /// <returns></returns>
        EnumLoginState Login(string loginName, string md5Password, out int adminId, out string trueName);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="adminId"></param>
        /// <param name="oldPassword">未经md5的旧密码</param>
        /// <param name="newPassword">未经md5的新密码</param>
        /// <returns>0,成功,1,该管理员ID不存在,2旧密码错误</returns>
        int ChangePasswrod(int adminId, string oldPassword, string newPassword);

        int AddAdmin(string AdminName, string Password, string TrueName, int state);

        int updateAdmin(string AdminName, string Password, string TrueName, int state, int AdminID);

        DataTable GetAdminInfo(int ID);

        DataTable AdminList();
    }
    public sealed partial class DataAccess
    {
        public static IManager CreateManager()
        {
            string className = path + ".Manager";
            return (IManager)Assembly.Load(path).CreateInstance(className);
        }
    }
}
