• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Taxonomy.TermController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotNetNuke.Entities.Content.Taxonomy.TermController的典型用法代码示例。如果您正苦于以下问题:C# TermController类的具体用法?C# TermController怎么用?C# TermController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TermController类属于DotNetNuke.Entities.Content.Taxonomy命名空间,在下文中一共展示了TermController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Update

        public static string Update (DnnComboBox comboWorkingHours, string workingHours, bool addToVocabulary)
        {
            workingHours = workingHours.Trim ();
            var workingHoursNonEmpty = !string.IsNullOrWhiteSpace (workingHours);

            if (comboWorkingHours.SelectedIndex <= 0 || workingHoursNonEmpty)
            {
                // REVIEW: Shouldn't we try to add term after updating main item?
                if (addToVocabulary && workingHoursNonEmpty)
                {
                    // try add new term to University_WorkingHours vocabulary
                    var vocCtrl = new VocabularyController ();
                    var voc = vocCtrl.GetVocabularies ().SingleOrDefault (v => v.Name == "University_WorkingHours");
                    if (voc != null)
                    {
                        var termCtrl = new TermController ();
                        termCtrl.AddTerm (new Term (workingHours, "", voc.VocabularyId)); 
                        vocCtrl.ClearVocabularyCache ();
                    }
                }

                return workingHours;
            }

            // else: get working hours from a combo
            return comboWorkingHours.SelectedItem.Text;
        }
开发者ID:hassangas2003,项目名称:R7.University,代码行数:27,代码来源:WorkingHoursLogic.cs


示例2: TermController_AddTerm_Throws_On_Null_Term

        public void TermController_AddTerm_Throws_On_Null_Term()
        {
            //Arrange
            var mockDataService = new Mock<IDataService>();
            var termController = new TermController(mockDataService.Object);

            //Act, Arrange
            Assert.Throws<ArgumentNullException>(() => termController.AddTerm(null));
        }
开发者ID:biganth,项目名称:Curt,代码行数:9,代码来源:TermControllerTests.cs


示例3: Init

 public static void Init (PortalModuleBase module, DnnComboBox comboWorkingHours)
 {
     // fill working hours terms
     var termCtrl = new TermController ();
     var workingHours = termCtrl.GetTermsByVocabulary ("University_WorkingHours").ToList ();
     workingHours.Insert (0, new Term (Localization.GetString ("NotSelected.Text", module.LocalResourceFile)));
     comboWorkingHours.DataSource = workingHours;
     comboWorkingHours.DataBind ();
 }
开发者ID:hassangas2003,项目名称:R7.University,代码行数:9,代码来源:WorkingHoursLogic.cs


示例4: TermController_AddTerm_Throws_On_Invalid_Term

        public void TermController_AddTerm_Throws_On_Invalid_Term()
        {
            //Arrange
            var mockDataService = new Mock<IDataService>();
            var termController = new TermController(mockDataService.Object);

            Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId);
            term.Name = Constants.TERM_InValidName;

            //Act, Arrange
            Assert.Throws<ArgumentException>(() => termController.AddTerm(term));
        }
开发者ID:biganth,项目名称:Curt,代码行数:12,代码来源:TermControllerTests.cs


示例5: Exist

		public HttpResponseMessage Exist(int vocabularyId, int termId, int parentId, string termName)
		{
			var exists = false;

			var controller = new TermController();
			var vocabulary = new VocabularyController().GetVocabularies().FirstOrDefault(v => v.VocabularyId == vocabularyId);
			if (vocabulary != null && !string.IsNullOrEmpty(termName))
			{
				var terms = controller.GetTermsByVocabulary(vocabularyId);
				exists = terms.Any(t => t.Name.Equals(termName.Trim(), StringComparison.InvariantCultureIgnoreCase) && t.TermId != termId && (parentId < 0 || t.ParentTermId == parentId));
			}

			return Request.CreateResponse(HttpStatusCode.OK, exists);
		}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:14,代码来源:ServicesController.cs


示例6: TermController_AddTermToContent_Should_Call_DataService_If_Valid_Params

        public void TermController_AddTermToContent_Should_Call_DataService_If_Valid_Params()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            ContentItem content = ContentTestHelper.CreateValidContentItem();
            Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId);

            // Act
            termController.AddTermToContent(term, content);

            // Assert
            mockDataService.Verify(ds => ds.AddTermToContent(term, content));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:15,代码来源:TermControllerTests.cs


示例7: Search

		public HttpResponseMessage Search(int vocabularyId, int termId, int parentId, string termName)
		{
			IList<SearchResult> results = new List<SearchResult>();

			var controller = new TermController();
			var vocabulary = new VocabularyController().GetVocabularies().FirstOrDefault(v => v.VocabularyId == vocabularyId);
			if (vocabulary != null && !string.IsNullOrEmpty(termName))
			{
				var terms = controller.GetTermsByVocabulary(vocabularyId);
				var relatedTerms = terms.Where(t => t.Name.ToLowerInvariant().Contains(termName.Trim().ToLowerInvariant()) && t.TermId != termId && (parentId < 0 || t.ParentTermId == parentId));

				foreach (Term term in relatedTerms)
				{
					results.Add(new SearchResult(){label = term.Name, value = term.Name});
				}
			}

			return Request.CreateResponse(HttpStatusCode.OK, results);
		}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:19,代码来源:ServicesController.cs


示例8: OnInit

		/// <summary>
		/// Handles Init event for a control.
		/// </summary>
		/// <param name="e">Event args.</param>
		protected override void OnInit (EventArgs e)
		{
			base.OnInit (e);

			// set url for Cancel link
			linkCancel.NavigateUrl = Globals.NavigateURL ();

			// add confirmation dialog to delete button
			buttonDelete.Attributes.Add ("onClick", "javascript:return confirm('" + Localization.GetString ("DeleteItem") + "');");

			// parse QueryString
			itemId = Utils.ParseToNullableInt (Request.QueryString ["division_id"]);
		
			// fill divisions dropdown
            var divisions = DivisionController.GetObjects<DivisionInfo> ()
                // exclude current division
                .Where (d => (itemId == null || itemId != d.DivisionID)).OrderBy (dd => dd.Title).ToList ();

            // insert default item
            divisions.Insert (0, DivisionInfo.DefaultItem (LocalizeString ("NotSelected.Text")));

            // bind divisions to the tree
            treeParentDivisions.DataSource = divisions;
            treeParentDivisions.DataBind ();

			// init working hours
			WorkingHoursLogic.Init (this, comboWorkingHours);
			
			// Fill terms list
			// TODO: Org. structure vocabulary name must be set in settings
			var termCtrl = new TermController ();
			var terms = termCtrl.GetTermsByVocabulary ("University_Structure").ToList (); 

			// add default term, 
			// TermId = Null.NullInteger is set in cstor
			terms.Insert (0, new Term (Localization.GetString ("NotSelected.Text", LocalResourceFile)));

            // bind terms to the tree
            treeDivisionTerms.DataSource = terms;
            treeDivisionTerms.DataBind ();
		}
开发者ID:gitter-badger,项目名称:R7.University,代码行数:45,代码来源:EditDivision.ascx.cs


示例9: DisplayDivision

		protected void DisplayDivision (DivisionInfo division)
		{
			// division title
			var divisionTitle = division.Title;

			// add division short title
			if (division.HasUniqueShortTitle)
			{
				divisionTitle += string.Format (" ({0})", division.ShortTitle);
			}

			// home page 
			int homeTabId;
			if (int.TryParse (division.HomePage, out homeTabId) && TabId != homeTabId)
			{
				// has home page, display as link 
				linkHomePage.Text = divisionTitle;
				linkHomePage.NavigateUrl = Globals.NavigateURL (homeTabId);
				labelTitle.Visible = false;
			}
			else
			{
				// no home page, display as label
				labelTitle.Text = divisionTitle;
				linkHomePage.Visible = false;
			}

			// link to division resources
			var displaySearchByTerm = false;
			if (division.DivisionTermID != null)
			{
				var termCtrl = new TermController ();
				var term = termCtrl.GetTerm (division.DivisionTermID.Value);
				if (term != null)
				{
					// NOTE: Add raw tag to Globals.NavigateURL to allow search work 
					// independently of current friendly urls settings
					// linkSearchByTerm.NavigateUrl = "/Default.aspx?tabid=" + PortalSettings.SearchTabId + "&tag=" + term.Name;
					linkSearchByTerm.NavigateUrl = Globals.NavigateURL (PortalSettings.SearchTabId) + "?tag=" + term.Name;
					displaySearchByTerm = true;
				}
			}

			if (!displaySearchByTerm)
				linkSearchByTerm.Visible = false;

			// WebSite
			if (!string.IsNullOrWhiteSpace (division.WebSite))
			{
				linkWebSite.NavigateUrl = division.FormatWebSiteUrl;
				linkWebSite.Text = division.FormatWebSiteLabel;
			}
			else
				linkWebSite.Visible = false;
				
			// email
			if (!string.IsNullOrWhiteSpace (division.Email))
			{
				linkEmail.Text = division.Email;
				linkEmail.NavigateUrl = "mailto:" + division.Email;
			}
			else
				linkEmail.Visible = false;

			// secondary email
			if (!string.IsNullOrWhiteSpace (division.SecondaryEmail))
			{
				linkSecondaryEmail.Text = division.SecondaryEmail;
				linkSecondaryEmail.NavigateUrl = "mailto:" + division.SecondaryEmail;
			}
			else
				linkSecondaryEmail.Visible = false;

			// phone
			if (!string.IsNullOrWhiteSpace (division.Phone))
				labelPhone.Text = division.Phone;
			else
				labelPhone.Visible = false;

			// fax
			if (!string.IsNullOrWhiteSpace (division.Fax))
				labelFax.Text = string.Format (Localization.GetString ("Fax.Format", LocalResourceFile), division.Fax);
			else
				labelFax.Visible = false;

			// location
			if (!string.IsNullOrWhiteSpace (division.Location))
				labelLocation.Text = division.Location;
			else
				labelLocation.Visible = false;

			// working hours
			if (!string.IsNullOrWhiteSpace (division.WorkingHours))
				labelWorkingHours.Text = division.WorkingHours;
			else
				labelWorkingHours.Visible = false;

			// document
			if (!string.IsNullOrWhiteSpace (division.DocumentUrl))
			{
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:R7.University,代码行数:101,代码来源:ViewDivision.ascx.cs


示例10: TermController_UpdateTerm_Throws_On_Negative_VocabularyId

        public void TermController_UpdateTerm_Throws_On_Negative_VocabularyId()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            Term term = ContentTestHelper.CreateValidSimpleTerm(Null.NullInteger);

            //Act, Arrange
            Assert.Throws<ArgumentException>(() => termController.UpdateTerm(term));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:11,代码来源:TermControllerTests.cs


示例11: TermController_UpdateTerm_Clears_Term_Cache_On_Valid_Term

        public void TermController_UpdateTerm_Clears_Term_Cache_On_Valid_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId);
            term.TermId = Constants.TERM_UpdateTermId;
            term.Name = Constants.TERM_UpdateName;
            term.Weight = Constants.TERM_UpdateWeight;

            //Act
            termController.UpdateTerm(term);

            //Assert
            mockCache.Verify(
                cache => cache.Remove(String.Format(Constants.TERM_CacheKey, Constants.VOCABULARY_ValidVocabularyId)));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:18,代码来源:TermControllerTests.cs


示例12: TermController_RemoveTermsFromContent_Should_Call_DataService_If_Valid_Params

        public void TermController_RemoveTermsFromContent_Should_Call_DataService_If_Valid_Params()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            ContentItem content = ContentTestHelper.CreateValidContentItem();

            // Act
            termController.RemoveTermsFromContent(content);

            // Assert
            mockDataService.Verify(ds => ds.RemoveTermsFromContent(content));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:14,代码来源:TermControllerTests.cs


示例13: TermController_GetTerm_Returns_Term_On_Valid_TermId

        public void TermController_GetTerm_Returns_Term_On_Valid_TermId()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            mockDataService.Setup(ds => ds.GetTerm(Constants.TERM_ValidTermId))
                .Returns(MockHelper.CreateValidTermReader());

            TermController termController = new TermController(mockDataService.Object);

            //Act
            Term term = termController.GetTerm(Constants.TERM_ValidTermId);

            //Assert
            Assert.AreEqual(Constants.TERM_ValidTermId, term.TermId);
            Assert.AreEqual(Constants.TERM_ValidName, term.Name);
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:16,代码来源:TermControllerTests.cs


示例14: TermController_AddTerm_Sets_Valid_Id_On_Valid_Term_If_Term_Is_Simple_Term

        public void TermController_AddTerm_Sets_Valid_Id_On_Valid_Term_If_Term_Is_Simple_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);
            mockDataService.Setup(ds => ds.AddSimpleTerm(It.IsAny<Term>(), It.IsAny<int>()))
                .Returns(Constants.TERM_AddTermId);

            Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId);

            //Act
            termController.AddTerm(term);

            //Assert
            Assert.AreEqual(Constants.TERM_AddTermId, term.TermId);
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:16,代码来源:TermControllerTests.cs


示例15: TermController_AddTerm_Returns_Valid_Id_On_Valid_Term_If_Term_Is_Heirarchical_Term

        public void TermController_AddTerm_Returns_Valid_Id_On_Valid_Term_If_Term_Is_Heirarchical_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);
            mockDataService.Setup(ds => ds.AddHeirarchicalTerm(It.IsAny<Term>(), It.IsAny<int>()))
                .Returns(Constants.TERM_AddTermId);

            Term term = ContentTestHelper.CreateValidHeirarchicalTerm(Constants.VOCABULARY_HierarchyVocabularyId,
                                                                      Constants.TERM_ValidParentTermId);

            //Act
            int termId = termController.AddTerm(term);

            //Assert
            Assert.AreEqual(Constants.TERM_AddTermId, termId);
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:17,代码来源:TermControllerTests.cs


示例16: TermController_GetTerm_Calls_DataService

        public void TermController_GetTerm_Calls_DataService()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            mockDataService.Setup(ds => ds.GetTerm(Constants.TERM_ValidTermId))
                .Returns(MockHelper.CreateValidTermReader());
            TermController termController = new TermController(mockDataService.Object);

            //Act
            Term term = termController.GetTerm(Constants.TERM_ValidTermId);

            //Assert
            mockDataService.Verify(ds => ds.GetTerm(Constants.TERM_ValidTermId));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:14,代码来源:TermControllerTests.cs


示例17: TermController_GetTerm_Returns_Null_On_InValidTermId

        public void TermController_GetTerm_Returns_Null_On_InValidTermId()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            mockDataService.Setup(ds => ds.GetTerm(Constants.TERM_InValidTermId))
                .Returns(MockHelper.CreateEmptyTermReader());

            TermController termController = new TermController(mockDataService.Object);

            //Act
            Term term = termController.GetTerm(Constants.TERM_InValidTermId);

            //Assert
            Assert.IsNull(term);
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:15,代码来源:TermControllerTests.cs


示例18: TermController_AddTerm_Should_Call_DataService_AddSimpleTerm_If_Term_Is_Simple_Term

        public void TermController_AddTerm_Should_Call_DataService_AddSimpleTerm_If_Term_Is_Simple_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId);

            // Act
            int termId = termController.AddTerm(term);

            // Assert
            mockDataService.Verify(ds => ds.AddSimpleTerm(term, UserController.GetCurrentUserInfo().UserID));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:14,代码来源:TermControllerTests.cs


示例19: TermController_GetTerm_Throws_On_Negative_TermId

        public void TermController_GetTerm_Throws_On_Negative_TermId()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            //Act, Arrange
            Assert.Throws<ArgumentOutOfRangeException>(() => termController.GetTerm(Null.NullInteger));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:9,代码来源:TermControllerTests.cs


示例20: TermController_DeleteTerm_Clears_Term_Cache_On_Valid_Term

        public void TermController_DeleteTerm_Clears_Term_Cache_On_Valid_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            Term term = new Term(Constants.VOCABULARY_ValidVocabularyId) {TermId = Constants.TERM_DeleteTermId};

            //Act
            termController.DeleteTerm(term);

            //Assert
            mockCache.Verify(
                cache => cache.Remove(String.Format(Constants.TERM_CacheKey, Constants.VOCABULARY_ValidVocabularyId)));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:15,代码来源:TermControllerTests.cs



注:本文中的DotNetNuke.Entities.Content.Taxonomy.TermController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Modules.ModuleController类代码示例发布时间:2022-05-24
下一篇:
C# Content.ContentController类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap