Exemplo n.º 1
0
        public static FileObject ConvertToFileObject(FileObjectDataContext db, FileObjectSQL fos)
        {
            FileObject fo = new FileObject(fos.Id, fos.Name, fos.Size, fos.Type, fos.Extension, fos.UpdateAt, fos.Thumbnail, fos.DownloadUrl, fos.MimeType);
            fo.SpotId = fos.SpotId;
            if (fos.ProfileName != null && fos.ProfileId != null && fos.ProfileEmail != null && fos.ProfilePhoneNumber != null)
            {
                fo.Owner = new ProfileObject();
                fo.Owner.Id = fos.ProfileId;
                fo.Owner.Email = fos.ProfileEmail;
                fo.Owner.Name = fos.ProfileName;
                fo.Owner.PhoneNumber = fos.ProfilePhoneNumber;
            }

            fo.FileList = GetChildList(db, fos.Id);
            return fo;
        }
Exemplo n.º 2
0
 public static FileObject ConvertToFileObject(FileObjectSQL fos)
 {
     FileObject fo = new FileObject(fos.Id, fos.Name, fos.Size, fos.Type, fos.Extension, fos.UpdateAt, fos.Thumbnail, fos.DownloadUrl, fos.MimeType);
     fo.SpotId = fos.SpotId;
     if (fos.ProfileName != null && fos.ProfileId != null && fos.ProfileEmail != null && fos.ProfilePhoneNumber != null)
     {
         fo.Owner = new ProfileObject();
         fo.Owner.Id = fos.ProfileId;
         fo.Owner.Email = fos.ProfileEmail;
         fo.Owner.Name = fos.ProfileName;
         fo.Owner.PhoneNumber = fos.ProfilePhoneNumber;
     }
     if (fo.Type.Equals(FileObject.FileObjectType.FOLDER))
         fo.FileList = new List<FileObject>();
     return fo;
 }
Exemplo n.º 3
0
 public static void ConvertToFileObjectSQL(List<FileObjectSQL> list, FileObject fo, string parentId, int level)
 {
     if (list == null) System.Diagnostics.Debugger.Break();
     FileObjectSQL fos = new FileObjectSQL();
     fos.Id = fo.Id;
     fos.Name = fo.Name;
     fos.Size = fo.Size;
     fos.Type = fo.Type;
     fos.Extension = fo.Extension;
     fos.UpdateAt = fo.UpdateAt;
     fos.Thumbnail = fo.Thumbnail;
     fos.DownloadUrl = fo.DownloadUrl;
     fos.MimeType = fo.MimeType;
     fos.ParentId = parentId;
     fos.Level = level;
     if (fo.Owner != null)
     {
         fos.ProfileId = fo.Owner.Id;
         fos.ProfileEmail = fo.Owner.Email;
         fos.ProfilePhoneNumber = fo.Owner.PhoneNumber;
         fos.ProfileName = fo.Owner.Name;
     }
     fos.SpotId = fo.SpotId;
     list.Add(fos);
     if (fo.FileList != null)
     {
         level++;
         for (var i = 0; i < fo.FileList.Count; i++)
         {
             ConvertToFileObjectSQL(list, fo.FileList[i], fo.Id, level);
         }
     }
 }