public UserInfo SignUp(SignUpUserInfo userInfo)
        {
            DbModel.UserInfo usr = _repository.SignUp(userInfo.WorkId, userInfo.UserName, userInfo.Password, userInfo.RoleId, userInfo.Remark);
            if (usr == null)
            {
                return(null);
            }
            UserInfo user = new UserInfo();

            user.Id       = usr.Id;
            user.WorkId   = usr.WorkId;
            user.UserName = usr.UserName;
            user.Password = usr.Password;
            user.RoleId   = usr.RoleId;
            user.Role     = _roleApp.Load(user.RoleId);
            user.Remark   = usr.Remark;
            return(user);
        }
        public UserInfo Load(string creditId)
        {
            DbModel.UserInfo usr = _repository.Load(p => p.WorkId.Equals(creditId) || p.Id.ToString().Equals(creditId) || p.UserName.Equals(creditId));
            if (usr == null)
            {
                return(null);
            }
            UserInfo user = new UserInfo();

            user.Id       = usr.Id;
            user.WorkId   = usr.WorkId;
            user.UserName = usr.UserName;
            user.Password = usr.Password;
            user.RoleId   = usr.RoleId;
            user.Role     = _roleApp.Load(user.RoleId);
            user.Remark   = usr.Remark;
            return(user);
        }
        public UserInfo SignIn(SignInUserInfo userInfo)
        {
            DbModel.UserInfo usr = _repository.SignIn(userInfo.CreditId, userInfo.PasswordHash.EncryptMD5());
            if (usr == null)
            {
                return(null);
            }
            UserInfo user = new UserInfo();

            user.Id       = usr.Id;
            user.WorkId   = usr.WorkId;
            user.UserName = usr.UserName;
            user.Password = usr.Password;
            user.RoleId   = usr.RoleId;
            user.Role     = _roleApp.Load(user.RoleId);
            user.Remark   = usr.Remark;
            return(user);
        }
 public void Remove(UserInfo userInfo)
 {
     DbModel.UserInfo usr = _repository.Load(p => p.WorkId.Equals(userInfo.WorkId));
     _repository.Remove(usr);
 }