Exemplo n.º 1
0
        protected override User ExecuteProcedure()
        {
            var user = GetUser();

            if (this.Name != null)
            {
                user.Name = this.Name;
            }
            if (this.Sex != null)
            {
                user.Sex = this.Sex.Value;
            }
            if (this.Nickname != null)
            {
                user.Nickname = this.Nickname;
            }
            if (this.BirthDay != null)
            {
                user.BirthDay = this.BirthDay.Value;
            }
            if (this.LocationId != null)
            {
                user.Location = LocationCommon.FindBy(this.LocationId.Value, QueryLevel.None);
            }
            if (this.PhotoId != null)
            {
                user.Photo = VirtualFileCommon.FindById(this.PhotoId.Value, QueryLevel.None);
            }
            if (this.ExpandedProperties != null)
            {
                user.ExpandedProperties = this.ExpandedProperties;
            }
            SaveTo(user);


            var account = GetAccount();

            if (this.Email != null)
            {
                account.Email = this.Email;
            }
            if (this.MobileNumber != null)
            {
                account.MobileNumber = this.MobileNumber;
            }
            SaveTo(account);

            return(user);
        }
Exemplo n.º 2
0
 protected override DTObject DynamicInvoke(dynamic arg)
 {
     if (arg.StoreKey != null)
     {
         VirtualFile file = VirtualFileCommon.FindByStoreKey(arg.StoreKey, QueryLevel.None);
         if (!file.IsEmpty())
         {
             var cmd = new DeleteVirtualFile(file.Disk.Id, file.Id);
             cmd.Execute();
         }
     }
     else
     {
         VirtualFile file = VirtualFileCommon.FindById(arg.Id, QueryLevel.None);
         if (!file.IsEmpty())
         {
             var cmd = new DeleteVirtualFile(file.Disk.Id, file.Id);
             cmd.Execute();
         }
     }
     return(DTObject.Empty);
 }
Exemplo n.º 3
0
        private User BuildUser()
        {
            var account = OpenAccount();
            var disk    = OpenDisk(account);

            var user = new User(account, disk)
            {
                Name               = this.Name ?? string.Empty,
                Nickname           = this.NickName ?? string.Empty,
                Sex                = this.Sex ?? UserSubsystem.Sex.Secret,
                ExpandedProperties = this.ExpandedProperties ?? Array.Empty <ExpandedProperty>()
            };

            if (this.LocationId != null)
            {
                user.Location = LocationCommon.FindBy(this.LocationId.Value, QueryLevel.None);
            }
            if (this.PhotoId != null)
            {
                user.Photo = VirtualFileCommon.FindById(this.PhotoId.Value, QueryLevel.None);
            }
            return(user);
        }
Exemplo n.º 4
0
        protected override DTObject DynamicInvoke(dynamic arg)
        {
            var file = VirtualFileCommon.FindById(arg.Id, QueryLevel.None);

            return(DTObject.CreateReusable("{id,name,storeKey}", file));
        }