Ejemplo n.º 1
0
 public void AddToRole(long userId, long roleId)
 {
     DbSessionManager.Execute <int>((IDbSession sess) => {
         roleWorker.AddToRole(sess, userId, roleId);
         return(0);
     });
 }
Ejemplo n.º 2
0
 public void Save(UserTdm user, List <long> roleIds)
 {
     DbSessionManager.ExecuteWithTrans <int>((IDbSession sess) => {
         userWorker.Save(sess, user);
         foreach (var i in roleIds)
         {
             roleWorker.AddToRole(sess, user.Id, i);
         }
         return(0);
     });
 }
Ejemplo n.º 3
0
        public void Save(OAuthTdm tdm)
        {
            DbSessionManager.ExecuteWithTrans <int>((IDbSession sess) =>
            {
                UserTdm user  = new UserTdm();
                user.Id       = sess.GetNextSequence("sys_user__id__seq");
                user.UserName = "******" + user.Id.ToString();
                user.NickName = String.IsNullOrEmpty(tdm.NickName)? user.UserName: tdm.NickName;
                user.Password = "******".MD5();
                // userId.Avatar = "";
                user.Gender = tdm.Gender;
                userWorker.Save(sess, user);

                tdm.Id     = sess.GetNextSequence("sys_oauth__id__seq");
                tdm.UserId = user.Id;
                oauthWorker.Save(sess, tdm);

                roleWorker.AddToRole(sess, user.Id, WebApp.UsersRoleId);
                return(0);
            });
        }