public static bool library_Deleted(this TM_FileStorage tmFileStorage, TM_Library tmLibrary) { "[xmlDB_DeleteGuidanceExplorer] deleting library with caption: {0}".info(tmLibrary.Caption); var pathToLibraryFolder = tmFileStorage.xmlDB_Path_Library_RootFolder(tmLibrary); // this is also the Library Root if (pathToLibraryFolder.notValid() || pathToLibraryFolder == tmFileStorage.path_XmlDatabase() || pathToLibraryFolder == tmFileStorage.Path_XmlLibraries) { "[xmlDB_DeleteGuidanceExplorer] [Stopping delete] Something is wrong with the pathToLibrary to delete : {0}" .error(pathToLibraryFolder); return false; } if (pathToLibraryFolder.contains(tmFileStorage.Path_XmlLibraries).isFalse()) { "[xmlDB_DeleteGuidanceExplorer] [Stopping delete] the pathToLibrary should contain tmDatabase.Path_XmlLibraries : {0}" .error(pathToLibraryFolder); return false; } // the checks above are important since the line below is a recursive folder delete (which can delete a LOT of content is pointed to the wrong folder) if (Files.deleteFolder(pathToLibraryFolder, true).isFalse()) { "[xmlDB_DeleteGuidanceExplorer] there was an error deleting the folder: {0}".error( pathToLibraryFolder); return false; } "[xmlDB_DeleteGuidanceExplorer] Library folder deleted OK: {0}".info(pathToLibraryFolder); tmFileStorage.reloadGuidanceExplorerObjects(); //reset these return true; }
public static guidanceExplorer guidanceExplorer(this TM_Library tmLibrary, TM_Xml_Database tmDatabase) { return(tmDatabase.xmlDB_GuidanceExplorer(tmLibrary.Id)); }
public static string xmlDB_Path_Library_RootFolder(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); return(tmDatabase.xmlDB_Path_Library_RootFolder(guidanceExplorer)); }
//public static string xmlDB_Path_Library_XmlFile(this TM_Xml_Database tmDatabase, string caption) public static string xmlDB_Path_Library_XmlFile(this TM_Xml_Database tmDatabase, TM_Library library) { return tmDatabase.xmlDB_Path_Library_XmlFile(library.Id); }
public static TM_Xml_Database delete_Library(this TM_Xml_Database tmDatabase, TM_Library library) { tmDatabase.xmlDB_DeleteGuidanceExplorer(library.Id); return tmDatabase; }
public static List<Folder_V3> tmFolders(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return tmDatabase.tmFolders(tmLibrary.Id); }
[ReadArticlesTitles] public static List <TeamMentor_Article> tmGuidanceItems(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return(tmDatabase.tmGuidanceItems(tmLibrary.Id)); }
public static Folder_V3 tmFolder(this TM_Library tmLibrary, Guid folderId, TM_Xml_Database tmDatabase) { return(tmDatabase.tmFolder(tmLibrary.Id, folderId)); }
public static string xmlDB_Path_Library_XmlFile(this TM_FileStorage tmFileStorage, TM_Library library) { if (library.isNull()) return null; return tmFileStorage.xmlDB_Path_Library_XmlFile(library.Id); }
public static string xmlDB_Path_Library_RootFolder(this TM_FileStorage tmFileStorage, TM_Library tmLibrary) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmFileStorage.tmXmlDatabase()); return tmFileStorage.xmlDB_Path_Library_RootFolder(guidanceExplorer); }
public static List <urn.microsoft.guidanceexplorer.View> xmlDB_Views_InLibraryRoot(this TM_Library tmLibrary, TM_Xml_Database tmDatabase) { try { return(tmLibrary.guidanceExplorer(tmDatabase).library.libraryStructure.view.toList()); } catch { return(new List <urn.microsoft.guidanceexplorer.View>()); } }
public static TM_Xml_Database delete_Library(this TM_Xml_Database tmDatabase, TM_Library library) { UserGroup.Editor.demand(); tmDatabase.xmlDB_DeleteGuidanceExplorer(library.Id); return tmDatabase; }
public static bool xmlDB_RemoveViewFromFolder(this TM_Xml_Database tmDatabase, TM_Library tmLibrary, Guid viewId ) { if (tmLibrary.isNull()) "in xmlDB_RemoveViewFromFolder provided tmLibrary was null".error(); else { var view = tmDatabase.xmlDB_View(viewId); if (view.notNull()) { view.Untyped.Remove(); tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase); return true; } /*var folder = tmLibrary.xmlDB_Folder(folderName, tmDatabase); if (folder.isNull()) "in xmlDB_RemoveViewFromFolder could not find folder '{0}' in library '{1}'".error(folderName, tmLibrary.Caption); else { var view = folder.xmlDB_View(viewId); if (view.isNull()) "in xmlDB_RemoveViewFromFolder could not find view '{0}' in folder '{1}'".error(viewId, folderName); else { folder.view.Remove(view); "in xmlDB_RemoveViewFromFolder removed view '{0}' from folder '{1}' in library '{2}'".info(view.caption, folderName, tmLibrary.Caption); tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase); return true; } }*/ } return false; }
public static bool xmlDB_RemoveView(this TM_Xml_Database tmDatabase, TM_Library tmLibrary, Guid viewId ) { UserRole.EditArticles.demand(); if (tmLibrary.isNull()) "in xmlDB_RemoveViewFromFolder provided tmLibrary was null".error(); else { var view = tmDatabase.xmlDB_View(viewId); if (view.notNull()) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); if (guidanceExplorer.library.libraryStructure.view.contains(view)) // the view was in the library root { guidanceExplorer.library.libraryStructure.view.remove(view); } else { foreach (var folder in tmDatabase.xmlDB_Folders_All(tmLibrary.Id)) { if (folder.view.contains(view)) folder.view.remove(view); } } tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase); return true; } } return false; }
public static List<TeamMentor_Article> tmGuidanceItems(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { UserRole.ReadArticlesTitles.demand(); return tmDatabase.tmGuidanceItems(tmLibrary.Id); }
[EditArticles] public static TM_Xml_Database delete_Library(this TM_Xml_Database tmDatabase, TM_Library library) { tmDatabase.xmlDB_DeleteGuidanceExplorer(library.Id); return(tmDatabase); }
public static List <Folder_V3> tmFolders(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return(tmDatabase.tmFolders(tmLibrary.Id)); }
[EditArticles] public static urn.microsoft.guidanceexplorer.Folder xmlDB_Add_Folder (this TM_Library tmLibrary, Guid parentFolderId, string folderCaption, TM_Xml_Database tmDatabase) { UserRole.EditArticles.demand(); try { var newFolder = new urn.microsoft.guidanceexplorer.Folder { caption = folderCaption, folderId = Guid.NewGuid().str() }; var guidanceExplorer= tmLibrary.guidanceExplorer(tmDatabase); if (parentFolderId == Guid.Empty) { //adding a folder to the library guidanceExplorer.library.libraryStructure.folder.Add(newFolder); } else { //adding a folder to folder var folder = tmDatabase.xmlDB_Folder(tmLibrary.Id, parentFolderId); if (folder == null) { "[xmlDB_Add_Folder] couldn't find parent folder (to add folder) with id: {0}".error(parentFolderId); return null; } folder.folder1.Add(newFolder); } guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase); return tmDatabase.xmlDB_Folder(tmLibrary.Id, newFolder.folderId.guid()); } catch(Exception ex) { ex.log(); return null; } }
public static List <View_V3> tmViews(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return(tmDatabase.tmViews(tmLibrary.Id)); }
public static IList<urn.microsoft.guidanceexplorer.Folder> xmlDB_Folders (this TM_Library tmLibrary, TM_Xml_Database tmDatabase) { return tmDatabase.xmlDB_Folders(tmLibrary.Id); }
[EditArticles] public static bool xmlDB_RemoveView(this TM_Xml_Database tmDatabase, TM_Library tmLibrary, Guid viewId) { if (tmLibrary.isNull()) { "in xmlDB_RemoveViewFromFolder provided tmLibrary was null".error(); } else { var view = tmDatabase.xmlDB_View(viewId); if (view.notNull()) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); if (guidanceExplorer.library.libraryStructure.view.contains(view)) // the view was in the library root { guidanceExplorer.library.libraryStructure.view.remove(view); } else { foreach (var folder in tmDatabase.xmlDB_Folders_All(tmLibrary.Id)) { if (folder.view.contains(view)) { folder.view.remove(view); } } } tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase); return(true); } } return(false); }
public static urn.microsoft.guidanceexplorer.Folder xmlDB_Folder (this TM_Library tmLibrary, string folderCaption, TM_Xml_Database tmDatabase) { return (from folder in tmLibrary.xmlDB_Folders(tmDatabase) where folder.caption == folderCaption select folder).first(); }
public static List<TeamMentor_Article> tmGuidanceItems(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return tmDatabase.tmGuidanceItems(tmLibrary.Id); }
//public static string xmlDB_Path_Library_XmlFile(this TM_Xml_Database tmDatabase, string caption) public static string xmlDB_Path_Library_XmlFile(this TM_Xml_Database tmDatabase, TM_Library library) { if (library.isNull()) { return(null); } return(tmDatabase.xmlDB_Path_Library_XmlFile(library.Id)); }
public static List<View_V3> tmViews(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { return tmDatabase.tmViews(tmLibrary.Id); }
public static string xmlDB_Path_Library_RootFolder(this TM_Xml_Database tmDatabase, TM_Library tmLibrary) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); return tmDatabase.xmlDB_Path_Library_RootFolder(guidanceExplorer); }