コード例 #1
0
        /// <summary>
        /// 检查用户名是否存在,返回0标示存在,1标示不存在,2标示异常
        /// </summary>
        /// <param name="username">用户名</param>

        protected void CheckUserExsit(string username)
        {
            AccountRemoteHelper accountHelper = new AccountRemoteHelper();
            var exsit = accountHelper.ExistUserName(username);

            if (exsit)
            {
                Response.Write("0");
            }
            else
            {
                Response.Write("1");
            }
            Response.Flush();
            Response.End();
        }
コード例 #2
0
 /// <summary>
 /// 接口实例
 /// </summary>
 /// <returns></returns>
 public static IAccountHelper CreateInstance()
 {
     if (SiteConfigs.GetConfig().SiteGroupEnabled)
     {
         if (string.IsNullOrEmpty(SiteConfigs.GetConfig().PassportServiceUrl))
         {
             throw new Exception("您还没有在site.config中设置好身份认证服务地址(PassportServiceUrl)的值!");
         }
         AccountRemoteHelper ar = new AccountRemoteHelper();
         return(ar);
     }
     else
     {
         AccountLocalHelper al = HelperFactory.Instance.GetHelper <AccountLocalHelper>();
         return(al);
     }
 }
コード例 #3
0
        /// <summary>
        /// 添加用户返回,0标示添加成功,1标示失败,2标示异常
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pwd"></param>
        /// <param name="email"></param>
        protected void AddUser(string username, string pwd, string email)
        {
            AccountRemoteHelper accountHelper = new AccountRemoteHelper();
            Account             account       = new Account();

            account.LastName = username;
            account.Password = pwd;
            account.Email    = email;
            try
            {
                accountHelper.AddAccount(account);
                Response.Write("0");
            }
            catch
            {
                Response.Write("1");
            }

            Response.Flush();
            Response.End();
        }