/// <summary>
 /// 注册
 /// </summary>
 /// <param name="userAccount"></param>
 /// <returns></returns>
 public Result SignUpByEmail(UserAccount userAccount)
 {
     return(Result.Success("Register Succeed!")
            .ContinueAssert(userAccount.TenantId >= 0, "非法的租户")
            .ContinueAssert(!string.IsNullOrEmpty(userAccount.Email), "邮箱不能为空")
            .ContinueAssert(userAccount.Email.IsEmail(), "邮箱格式不正确")
            //check register
            .Continue(re => ValidateRegisterdByEmail(userAccount.Email))
            .Continue(re =>
     {
         //如果属于普通权限的才可以赋值,不允许直接给租户管理员
         if (SystemIdentityProvider.Collection().Contains(userAccount.SystemIdentity))
         {
             return Result.Error("非法授权");
         }
         return re;
     })
            //+salt
            .Continue(re =>
     {
         userAccount.Password = GetSaltPwd(userAccount.Password);
         return re;
     })
            //register
            .Continue(re =>
     {
         return Add(userAccount);
     }));
 }
        public new Result <UserAccount> Update(UserAccount entity)
        {
            UserAccount old = GetById(entity.Id);

            if (old != null)
            {
                //编码不允许修改
                old.HasOfficialSystemPermission = entity.HasOfficialSystemPermission;
                old.HasSettingSystemPermission  = entity.HasSettingSystemPermission;
                //如果属于普通权限的才可以赋值,不允许直接给租户管理员
                if (SystemIdentityProvider.Collection().Contains(entity.SystemIdentity))
                {
                    old.SystemIdentity = entity.SystemIdentity;
                }
                old.Phone = entity.Phone;

                old.Name        = entity.Name;
                old.Group       = entity.Group;
                old.SortNumber  = entity.SortNumber;
                old.Description = entity.Description;
                old.ModifyBy    = entity.ModifyBy;
                old.ModifyTime  = DateTime.Now;
            }
            return(base.Update(old));
        }