Inheritance: System.MarshalByRefObject
Exemple #1
0
 public static TM_Library tmLibrary(this urn.microsoft.guidanceexplorer.View viewToFind, TM_Xml_Database tmDatabase)
 {
     return((from tmLibrary in tmDatabase.tmLibraries()
             from view in tmLibrary.xmlDB_Views(tmDatabase)
             where view == viewToFind
             select tmLibrary).first());
 }
Exemple #2
0
/*		public static TM_Folder tmFolder(this string folder, Guid libraryId)
 *              {
 *                      return new TM_Folder()
 *                                              {
 *                                                      Id = Guid.Empty,
 *                                                      Name = folder,
 *                                                      Caption = null,
 *                                                      Library = libraryId
 *                                              };
 *              }
 *
 *              public static TM_Folder tmFolder(this urn.microsoft.guidanceexplorer.View view, Guid libraryId, string folder)
 *              {
 *                      return new TM_Folder()
 *                                              {
 *                                                      Id = view.id.guid(),
 *                                                      Name = folder,
 *                                                      Caption = view.caption,
 *                                                      Library = libraryId
 *                                              };
 *              }
 */

        public static View_V3 tmView(this urn.microsoft.guidanceexplorer.View view, Guid libraryId, Guid folderId)
        {
            var tmView = new View_V3()
            {
                libraryId = libraryId,
                folderId  = folderId,
                viewId    = view.id.guid(),
                caption   = view.caption,
                author    = view.author,
            };

            if (view.items.notNull())
            {
                foreach (var item in view.items.item)
                {
                    tmView.guidanceItems.add(item.guid());
                }
            }
            return(tmView);
        }
        public static urn.microsoft.guidanceexplorer.View xmlDB_UpdateView(this TM_Xml_Database tmDatabase, View tmView, List<Guid> guidanceItems)
        {
            ".... in  xmlDB_UpdateView".info();
            var tmLibrary = tmDatabase.tmLibrary(tmView.library.guid());
            if (tmLibrary.isNull())
            {
                "[TM_Xml_Database] in xmlDB_UpdateView, could not find library with id: {0}".error(tmView.library);
                return null;
            }
            /*var targetFolder = tmLibrary.xmlDB_Folder(tmView.parentFolder, tmDatabase);
            if (targetFolder.isNull())
            {
                "[TM_Xml_Database] in xmlDB_UpdateView, could not find target Folder with name: {0}".error(tmView.parentFolder);
                return null;
            }*/
            var targetView = tmDatabase.xmlDB_View(tmView.id.guid());
            if (targetView.isNull())
            {
                "[TM_Xml_Database] in xmlDB_UpdateView, could not find view with id: {0}".error(tmView.id);
                return null;
            }
            //"Updating view with caption {0} in folder {1} with id {2}".info(targetView.caption, targetFolder.caption, targetView.id);
            targetView.caption = tmView.caption;
            targetView.author = tmView.creator;

            //foreach(var guid in guidanceItems)

            tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase);
            return targetView;
            //existingView.creationDate = tmView.lastUpdate // should we also update this?
        }
 public static urn.microsoft.guidanceexplorer.View xmlDB_UpdateView(this TM_Xml_Database tmDatabase, View tmView)
 {
     return tmDatabase.xmlDB_UpdateView(tmView, new List<Guid>());
 }
        public static urn.microsoft.guidanceexplorer.View xmlDB_NewView(this TM_Xml_Database tmDatabase, Guid parentFolderId, View tmView)
        {
            var tmLibrary = tmDatabase.tmLibrary(tmView.library.guid());
            //var guidanceExplorer = tmDatabase.xmlDB_GuidanceExplorer(tmView.library.guid());
            if (tmLibrary.notNull())
            {
                if (parentFolderId == Guid.Empty)
                {
                    var guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase);
                    if (tmView.id == Guid.Empty.str())
                        tmView.id = Guid.NewGuid().str();
                    var view = tmView.view();
                    guidanceExplorer.library.libraryStructure.view.Add(view);
                    tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase);
                    return tmDatabase.xmlDB_View(tmView.id.guid());
                }
                else
                {
                    var folder = tmDatabase.xmlDB_Folder(tmLibrary.Id, parentFolderId);
                    if (folder.isNull())
                        return null;
                    //var folder = tmLibrary.xmlDB_Add_Folder(parentFolderId, tmView.parentFolder,tmDatabase);
            /*					var existingView = folder.xmlDB_View(tmView.caption);
                    if (existingView.notNull())
                    {
                        "[TM_Xml_Database] in xmlDB_NewView ,there was already a view called '{0}' in folder '{1}' so returning existing one".debug(tmView.caption,tmView.parentFolder);
                        return existingView;
                    }*/

                    if (tmView.id == Guid.Empty.str())
                        tmView.id = Guid.NewGuid().str();
                    var view = tmView.view();
                    folder.view.Add(view);
                    tmLibrary.xmlDB_Save_GuidanceExplorer(tmDatabase);
                    return folder.xmlDB_View(tmView.id.guid()); 					// I have to get the reference again since the object is different after the calls to xmlDB_Save_GuidanceExplorer
                }
            }
            return null;
        }
 public static urn.microsoft.guidanceexplorer.View xmlDB_NewView(this TM_Xml_Database tmDatabase, View tmView)
 {
     return tmDatabase.xmlDB_NewView(Guid.Empty,  tmView);
 }
 public static View_V3 newView(this TM_Xml_Database tmDatabase, Guid parentFolderId, View tmView)
 {
     var view = tmDatabase.xmlDB_NewView(parentFolderId, tmView);
     return tmDatabase.tmView(view.id.guid());
 }
 public bool UpdateView(View view)
 {
     return tmXmlDatabase.xmlDB_UpdateView(view).notNull();
 }
 public View_V3 CreateView(Guid folderId, View view)
 {
     return tmXmlDatabase.newView(folderId, view);
 }