示例#1
0
        public static CreateUserStatus Create(HiMembershipUser userToCreate, string passwordQuestion, string passwordAnswer, string[] roles)
        {
            CreateUserStatus result;

            if (userToCreate == null)
            {
                result = CreateUserStatus.UnknownFailure;
            }
            else
            {
                MemberUserProvider memberUserProvider = MemberUserProvider.Instance();
                try
                {
                    CreateUserStatus createUserStatus = memberUserProvider.CreateMembershipUser(userToCreate, passwordQuestion, passwordAnswer);
                    if (createUserStatus == CreateUserStatus.Created)
                    {
                        Roles.AddUserToRoles(userToCreate.Username, roles);
                    }
                }
                catch (CreateUserException ex)
                {
                    result = ex.CreateUserStatus;
                    return(result);
                }
                result = CreateUserStatus.Created;
            }
            return(result);
        }
示例#2
0
        public bool ChangePasswordQuestionAndAnswer(string newQuestion, string newAnswer)
        {
            bool result;

            if (string.IsNullOrEmpty(newQuestion) || string.IsNullOrEmpty(newAnswer))
            {
                result = false;
            }
            else
            {
                if (newQuestion.Length > 256 || newAnswer.Length > 128)
                {
                    result = false;
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.PasswordQuestion))
                    {
                        result = false;
                    }
                    else
                    {
                        MemberUserProvider memberUserProvider = MemberUserProvider.Instance();
                        result = memberUserProvider.ChangePasswordQuestionAndAnswer(this.Username, newQuestion, newAnswer);
                    }
                }
            }
            return(result);
        }
示例#3
0
 public static bool UpdateUser(HiMembershipUser user)
 {
     if (user == null)
     {
         return(false);
     }
     return(MemberUserProvider.Instance().UpdateMembershipUser(user));
 }
示例#4
0
 public virtual bool ChangePasswordQuestionAndAnswer(string oldAnswer, string newQuestion, string newAnswer)
 {
     if (string.IsNullOrEmpty(newQuestion) || string.IsNullOrEmpty(newAnswer))
     {
         return(false);
     }
     if ((newQuestion.Length > 0x100) || (newAnswer.Length > 0x80))
     {
         return(false);
     }
     return(this.ValidatePasswordAnswer(oldAnswer) && MemberUserProvider.Instance().ChangePasswordQuestionAndAnswer(this.Username, newQuestion, newAnswer));
 }
示例#5
0
        public static bool UpdateUser(HiMembershipUser user)
        {
            bool result;

            if (user == null)
            {
                result = false;
            }
            else
            {
                MemberUserProvider memberUserProvider = MemberUserProvider.Instance();
                result = memberUserProvider.UpdateMembershipUser(user);
            }
            return(result);
        }
示例#6
0
 public static CreateUserStatus Create(HiMembershipUser userToCreate, string passwordQuestion, string passwordAnswer, string[] roles)
 {
     if (userToCreate == null)
     {
         return CreateUserStatus.UnknownFailure;
     }
     MemberUserProvider provider = MemberUserProvider.Instance();
     try
     {
         if (provider.CreateMembershipUser(userToCreate, passwordQuestion, passwordAnswer) == CreateUserStatus.Created)
         {
             Roles.AddUserToRoles(userToCreate.Username, roles);
         }
     }
     catch (CreateUserException exception)
     {
         return exception.CreateUserStatus;
     }
     return CreateUserStatus.Created;
 }
示例#7
0
 public static int GetUserIdByEmail(string email)
 {
     return(MemberUserProvider.Instance().GetUserIdByEmail(email));
 }
示例#8
0
        public static HiMembershipUser GetMembershipUser(int userId, string username, bool userIsOnline)
        {
            MemberUserProvider memberUserProvider = MemberUserProvider.Instance();

            return(memberUserProvider.GetMembershipUser(userId, username, userIsOnline));
        }
示例#9
0
 public static bool BindOpenId(string username, string openId, string openIdType)
 {
     return(MemberUserProvider.Instance().BindOpenId(username, openId, openIdType));
 }
示例#10
0
 public virtual bool ValidatePasswordAnswer(string answer)
 {
     return(MemberUserProvider.Instance().ValidatePasswordAnswer(this.Username, answer));
 }
示例#11
0
 public static string GetUsernameWithOpenId(string openId, string openIdType)
 {
     return(MemberUserProvider.Instance().GetUsernameWithOpenId(openId, openIdType));
 }
示例#12
0
 public static bool IsExistEmal(string email)
 {
     return(MemberUserProvider.Instance().IsExistEmal(email));
 }
示例#13
0
 public static int GetUserIdBySessionId(string sessionid)
 {
     return(MemberUserProvider.Instance().GetUserIdBySessionId(sessionid));
 }
示例#14
0
 public static int GetUserIdByOpenId(string openId, string OpenIdType)
 {
     return(MemberUserProvider.Instance().GetUserIdByOpenId(openId, OpenIdType));
 }
示例#15
0
 public static int GetUserIdByAliPayOpenId(string openId)
 {
     return(MemberUserProvider.Instance().GetUserIdByAliPayOpenId(openId));
 }
示例#16
0
 public static bool IsExistUserName(int userid, string userName)
 {
     return(MemberUserProvider.Instance().IsExistUserName(userid, userName));
 }
示例#17
0
 public static string UpdateSessionId(int userId)
 {
     return(MemberUserProvider.Instance().UpdateSessionId(userId));
 }