Exemplo n.º 1
0
        public bool Add(User user)
        {
            user.Passwd       = EscapePassword(user.Account, InitPassword);
            user.SigninStatus = (short)AccountSigninStatus.NoSignin;
            user.SignupDate   = DateTime.Now.ToUnixTime();
            user.Status       = (short)AccountStatus.Normal;

            var handler = new RoleHandle(Repository);
            var role    = handler.First(t => t.Id == user.RoleId);

            user.OrgId = role.OrgId;

            return
                (null != Handler.Add(user, true));
        }
Exemplo n.º 2
0
        public bool Modify(User user, Expression <Func <User, bool> > predicate)
        {
            var handler = new RoleHandle(Repository);
            var role    = handler.First(t => t.Id == user.RoleId);

            var count = Handler.ModifyAny(
                m =>
            {
                m.OrgId    = role.OrgId;
                m.Account  = user.Account;
                m.Category = user.Category;
                m.RoleId   = user.RoleId;
                return(m);
            }, predicate, true).Count();

            return(0 < count);
        }