private void UpdateChildrenDirNameRecurs(string OldDirPath, string NewDirPath, ILibraryDirs dir)
 {
     if ((dir != null) && (dir.FullPath.IndexOf(OldDirPath) == 0))
     {
         dir.FullPath = dir.FullPath.Replace(OldDirPath, NewDirPath);
         var children = EntityFactory.GetRepository<ILibraryDirs>().FindByProperty("ParentId", dir.Id.ToString());
         foreach (ILibraryDirs child in children)
         {
             UpdateChildrenDirNameRecurs(OldDirPath, NewDirPath, child);
         }
     }
 }
 private List<ILibraryDirs> GetAllDescendents(ILibraryDirs dirs)
 {
     var descendents = new List<ILibraryDirs>();
     var children = EntityFactory.GetRepository<ILibraryDirs>().FindByProperty("ParentId", dirs.Id.ToString());
     descendents.AddRange(children);
     foreach (ILibraryDirs child in children)
     {
         descendents.AddRange(GetAllDescendents(child));
     }
     return descendents;
 }
 private string BuildFullLibraryPath(string root, ILibraryDirs libraryDirs)
 {
     if ((libraryDirs != null) && !string.IsNullOrEmpty(libraryDirs.FullPath))
     {
         string dir = libraryDirs.FullPath;
         if (dir[0] == '\\')
         {
             dir = dir.Substring(1);
         }
         return Path.Combine(root, dir);
     }
     return root;
 }
 private string BuildFullLibraryPath(ILibraryDirs libraryDirs)
 {
     return BuildFullLibraryPath(Attachment.Rules.GetLibraryPath(), libraryDirs);
 }
 private void AddLibraryRecord(string fileName, int fileSize, ILibraryDirs libraryDirs)
 {
     var doc = EntityFactory.Create<ILibraryDocs>();
     doc.Directory = libraryDirs;
     doc.FileName = fileName;
     doc.Status = LibraryDocsStatus.Available;
     doc.RevisionDate = DateTime.Now.ToUniversalTime();
     doc.FileSize = fileSize;
     doc.Expires = false;
     doc.ExpireDate = new DateTime(2099, 1, 1).ToUniversalTime();
     doc.Flags = 0;
     doc.Save();
 }
 private static object GetReturnDirObj(ILibraryDirs dir)
 {
     return new
         {
             dir.Id,
             dir.DirectoryName,
             dir.FullPath,
             dir.ParentId
         };
 }