예제 #1
0
 public static string GetDisplayFolder(this IDetailObject folderObject, Culture culture)
 {
     if (culture == null)
     {
         return(folderObject.DisplayFolder.TrimFolder());
     }
     return(folderObject.TranslatedDisplayFolders[culture]?.TrimFolder() ?? "");
 }
예제 #2
0
        public static IDetailObjectContainer GetContainer(this IDetailObject obj)
        {
            var tree = obj.Table.Handler.Tree;
            var path = ((tree.Culture == null || obj is Folder) ? obj.DisplayFolder : obj.TranslatedDisplayFolders[tree.Culture]).TrimFolder();

            if (string.IsNullOrEmpty(path))
            {
                return(obj.Table);
            }
            var    fullPath = obj.Table.Name.ConcatPath(path);
            Folder result;

            if (tree.FolderCache.TryGetValue(fullPath, out result))
            {
                return(result);
            }
            return(obj.Table);
        }
예제 #3
0
 public static void SetDisplayFolder(this IDetailObject folderObject, string newFolderName, Culture culture)
 {
     if (folderObject is Folder)
     {
         var folder = folderObject as Folder;
         folder.DisplayFolder = newFolderName;
     }
     else
     {
         if (culture == null)
         {
             folderObject.DisplayFolder = newFolderName;
         }
         else
         {
             folderObject.TranslatedDisplayFolders[culture] = newFolderName;
         }
     }
 }
예제 #4
0
        public static bool HasParent(this IDetailObject child, ITabularNamedObject parent, Culture culture)
        {
            string parentPath = GetFullPath(parent);

            return(child.Table.Name.ConcatPath(child.GetDisplayFolder(culture)) == parentPath);
        }
예제 #5
0
        public static bool HasAncestor(this IDetailObject child, ITabularNamedObject ancestor, Culture culture)
        {
            string ancestorPath = GetFullPath(ancestor);

            return((child.Table.Name.ConcatPath(child.GetDisplayFolder(culture)) + "\\").StartsWith(ancestorPath + "\\"));
        }