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

namespace JuSNS.Factory
{
    public interface IMyInfo
    {
        //会员网络设置
        int UpdateNetSet(int provice, int city,int userid);
        /// <summary>
        /// 帐号设置（修改姓名）
        /// </summary>
        /// <param name="oldName">旧名字</param>
        /// <param name="userName">新名字</param>
        /// <param name="userid">会员编号</param>
        /// <returns></returns>
        int UpdateUserName(string oldName, string userName, int userid);
        /// <summary>
        /// 检查邮箱是否已经被使用了
        /// </summary>
        /// <param name="Email">被检查的邮箱</param>
        /// <returns></returns>
        bool CheckEmail(string Email);

        /// <summary>
        /// 邮箱设置
        /// </summary>
        /// <param name="newEmail">新默认邮箱</param>
        /// <param name="oldEmail">以前的默认邮箱</param>
        /// <param name="userid">会员编号</param>
        /// <param name="Ip">IP</param>
        /// <param name="flag">true：添加新邮箱，false：更新邮箱</param>
        /// <returns></returns>
        int UpdateEmail(string newEmail, string oldEmail, int userid, string Ip, bool flag);

        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name="Email">要删除的邮箱</param>
        /// <returns></returns>
        int DelInfo(string Email);

        
        /// <summary>
        /// 根据ID返回Datatable
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        DataTable getEmail(int Id, int flag);

        /// <summary>
        ///  检查用户密码是否正确
        /// </summary>
        /// <param name="userId">会员编号</param>
        /// <returns></returns>
        bool getPwd(int userId, string Pwd);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="OldPwd">旧密码</param>
        /// <param name="NewPwd">新密码</param>
        /// <param name="userId">会员编号</param>
        int ChanagePwd(string OldPwd, string NewPwd, int userId);

        /// <summary>
        /// 保存MSN/Gtalk
        /// </summary>
        /// <returns></returns>
        int UpdateMSNGtalk(string value, int userid, int flag);

        /// <summary>
        /// 邮件通知设置
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        int UpdateEmailSet(string type, string value, int userID, string IP, int flag);
        /// <summary>
        /// 读取发送邮件通知内容
       /// </summary>
       /// <param name="userid"></param>
       /// <returns></returns>
        bool sendEmailStr(int userid, string email, string username, int day);

        /// <summary>
        /// 判断MSN,Gtalk,Mobile 是否存在
        /// </summary>
        /// <param name="temp"></param>
        /// <param name="flag">标识0：MSN 1：Gtalk 2:手机号码</param>
        /// <returns></returns>
        int getMSNGtalk(string temp, int flag);

        int DelUserSelf(int UserID);
    }

    public sealed partial class DataAccess
    {
        public static IMyInfo CreateMyInfo()
        {
            string className = path + ".MyInfo";
            return (IMyInfo)Assembly.Load(path).CreateInstance(className);
        }
    }
}
