Exemple #1
0
 public static TM_GuidanceItem tmGuidanceItem(this GuidanceItem_V3 guidanceItemV3)
 {
     return(new TM_GuidanceItem()
     {
         Id = guidanceItemV3.guidanceItemId,
         Id_Original = guidanceItemV3.guidanceItemId_Original,
         Library = guidanceItemV3.libraryId,
         Author = guidanceItemV3.author,
         Category = guidanceItemV3.category,
         Priority = guidanceItemV3.priority,
         RuleType = guidanceItemV3.rule_Type,
         Status = guidanceItemV3.status,
         Technology = guidanceItemV3.technology,
         Title = guidanceItemV3.title,
         Topic = guidanceItemV3.topic,
         //			LastUpdate = guidanceItemV3.lastUpdate
     });
 }
Exemple #2
0
        public static Guid createGuidanceItem(this TM_Xml_Database tmDatabase, GuidanceItem_V3 guidanceItemV3)
        {
            if (guidanceItemV3.libraryId == Guid.Empty)
            {
                "[createGuidanceItem] no library provided for Guidance Item, stopping creation".error();
                return(Guid.Empty);
            }
            var guidanceItem = tmDatabase.xmlDB_NewGuidanceItem(guidanceItemV3.guidanceItemId,
                                                                guidanceItemV3.title,
                                                                guidanceItemV3.images,
                                                                //													guidanceItemV3.lastUpdate,
                                                                guidanceItemV3.topic,
                                                                guidanceItemV3.technology,
                                                                guidanceItemV3.category,
                                                                guidanceItemV3.rule_Type,
                                                                guidanceItemV3.priority,
                                                                guidanceItemV3.status,
                                                                guidanceItemV3.author,
                                                                guidanceItemV3.phase,
                                                                guidanceItemV3.htmlContent.sanitizeHtmlContent(),
                                                                guidanceItemV3.libraryId);

            return(guidanceItem.Metadata.Id);
        }
 [WebMethod(EnableSession = true)][EditArticles(SecurityAction.Demand)]   public Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     this.resetCache(); return(javascriptProxy.CreateGuidanceItem(guidanceItem));
 }
 public Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     return tmXmlDatabase.createGuidanceItem(guidanceItem);
 }
 public bool UpdateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     return tmXmlDatabase.createGuidanceItem(guidanceItem) != Guid.Empty;
 }
 public Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     this.resetCache(); return javascriptProxy.CreateGuidanceItem(guidanceItem);
 }
		public static Guid createGuidanceItem(this TM_Xml_Database tmDatabase, GuidanceItem_V3 guidanceItemV3)
		{
			if (guidanceItemV3.libraryId == Guid.Empty)
			{
				"[createGuidanceItem] no library provided for Guidance Item, stopping creation".error();
				return Guid.Empty;
			}
			var guidanceItem = tmDatabase.xmlDB_NewGuidanceItem(guidanceItemV3.guidanceItemId,
																guidanceItemV3.title, 
																guidanceItemV3.images,
			//													guidanceItemV3.lastUpdate,
																guidanceItemV3.topic,
																guidanceItemV3.technology,
																guidanceItemV3.category,
																guidanceItemV3.rule_Type,
																guidanceItemV3.priority,
																guidanceItemV3.status,
																guidanceItemV3.author,
																guidanceItemV3.phase,
																guidanceItemV3.htmlContent.sanitizeHtmlContent(),
																guidanceItemV3.libraryId);
			return guidanceItem.Metadata.Id;
		}
		[WebMethod(EnableSession = true)]	[EditArticles(SecurityAction.Demand)]	public Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem)						{ this.resetCache(); return javascriptProxy.CreateGuidanceItem(guidanceItem); 	}
        public Guid createTempGuidanceItem(Guid libraryIdGuid, string title, string images, DateTime lastUpdate, string topic, string technology, string category, string ruleType, string phase, string priority, string status, string author, string htmlContent)
        {
            var guidanceType = Guid.Empty; //  tmWebServices.GetGuidanceTypeByName("Guideline").id.guid();
            Guid creatorId = Guid.Empty;
            var creatorCaption = "guidanceLibrary"; 					     // we can use either one of these creator values
            var guidanceItem =  createTempGuidanceItem(libraryIdGuid, guidanceType, creatorId, creatorCaption, title, images, lastUpdate, topic, technology, category, ruleType, phase, priority, status, author, htmlContent);
            var guidanceItemV3 = new GuidanceItem_V3(guidanceItem);

            var newGuidanceItemId = tmWebServices.CreateGuidanceItem(guidanceItemV3);
            Assert.AreEqual(newGuidanceItemId, guidanceItemV3.guidanceItemId, "GuidanceItemId");
            "newGuidanceItemId : {0}".debug(newGuidanceItemId);
            Assert.That(newGuidanceItemId != Guid.Empty, "in createTempGuidanceItem, newGuidanceItemId was empty");
            return newGuidanceItemId;
        }
 //[Test]
 public void create_Libraries_Backup()
 {
     var libraryName = "temp_lib_createAndBackup";
     var newLibrary = tmWebServices.CreateLibrary(new Library() { caption = libraryName });
     Assert.That(newLibrary.notNull());
     var newGuidanceItem = new GuidanceItem_V3() { libraryId = newLibrary.libraryId };
     tmWebServices.CreateGuidanceItem(newGuidanceItem);
     var backupFile = tmXmlDatabase.xmlDB_Libraries_BackupLibrary(newLibrary.libraryId);
     Assert.IsTrue(backupFile.fileExists());
     var backedUpfiles = new zipUtils().getListOfFilesInZip(backupFile);
     Assert.AreEqual(backedUpfiles.size(), 2, "there should be two files backup-ed files");
     tmWebServices.DeleteLibrary(newLibrary.libraryId);
 }
 public bool UpdateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     this.resetCache();
                                                                                     var result = javascriptProxy.UpdateGuidanceItem(guidanceItem);
                                                                                     try
                                                                                     {
                                                                                         if (result)
                                                                                         {
                                                                                             new PagesHistory().logPageChange(guidanceItem.guidanceItemId,
                                                                                                                              currentUser.notNull()
                                                                                                                                 ? currentUser.UserName
                                                                                                                                 : "******",
                                                                                                                              sessionID,
                                                                                                                              guidanceItem.htmlContent);
                                                                                             return true;
                                                                                         }
                                                                                         return false;
                                                                                     }
                                                                                     catch(Exception ex)
                                                                                     {
                                                                                         "Error in new PagesHistory(): {0} \n\n {1}".error(ex.Message, ex.StackTrace);
                                                                                     }
                                                                                     return result;
 }
    	public void Create_Delete_Libraries_with_a_GuidanceItem()
    	{
    	
    		var originalName = "temp_lib_createLibraryWithGuidanceItemAndDelete";    

			var libraryPath_originalName  = tmXmlDatabase.xmlDB_LibraryPath(originalName);    
			var libraryPath_GuidanceItemsFolder = tmXmlDatabase.xmlDB_LibraryPath_GuidanceItems(originalName); 
			//Files.deleteFile(libraryPath_originalName);  //temp while developing  
			//Files.deleteFolder(libraryPath_GuidanceItemsFolder,true);
			 
			Assert.IsFalse(libraryPath_originalName.fileExists() 		, "libraryPath_originalName should not exists");
			Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists()  , "libraryPath_GuidanceItemsFolder should not exists");
			 
			//Create Library 
			var newLibrary = tmWebServices.CreateLibrary(new Library() { caption = originalName });
			Assert.IsTrue(libraryPath_originalName.fileExists() 		, "libraryPath_originalName should exist after creation");
			Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists()  , "libraryPath_GuidanceItemsFolder should not exists after library creation");
		
			
			//Create GuidanceItem
			var newGuidanceItem = new GuidanceItem_V3() 
											{
												libraryId = newLibrary.libraryId
											};								
			var guidanceItem = tmWebServices.CreateGuidanceItem(newGuidanceItem);
			
			Assert.AreNotEqual(guidanceItem, Guid.Empty, "guidance Item was not created");
			Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists()  , "libraryPath_GuidanceItemsFolder should exist after library creation");
			
		
			//Delete Library
			var deleteResult = tmWebServices.DeleteLibrary(newLibrary.libraryId);  
			Assert.IsTrue(deleteResult, "deleteResult");
			Assert.IsFalse(libraryPath_originalName.fileExists() , "libraryPath_originalName should not exist at the end");
			
			Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists()  , "libraryPath_GuidanceItemsFolder should not exist after delete");
    	}
 public bool UpdateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     return(tmXmlDatabase.createGuidanceItem(guidanceItem) != Guid.Empty);
 }
 public Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem)
 {
     return(tmXmlDatabase.createGuidanceItem(guidanceItem));
 }