public MembershipUser CreateUser(string username, string password, string email, string roles, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { status = MembershipCreateStatus.Success; MembershipUser memUser = null; if (userRo.GetUsuario(username) != null) { status = MembershipCreateStatus.DuplicateUserName; } else if (userRo.GetUsuarioByEmail(email) != null) { status = MembershipCreateStatus.DuplicateEmail; } else { Usuario usuario = new Usuario(); usuario.email = username; usuario.senha = userRo.EncryptPassword(password); usuario.email = email; userRo.AddUsuario(usuario, roles); if (usuario != null) { memUser = new MembershipUser("CustomMembershipProvider", username, usuario.codigo, usuario.email, string.Empty, string.Empty, true, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.Now, DateTime.Now); } else { status = MembershipCreateStatus.UserRejected; } } return(memUser); }