本文整理汇总了C#中DotNetNuke.Entities.Content.Taxonomy.TermController.GetTerm方法的典型用法代码示例。如果您正苦于以下问题:C# TermController.GetTerm方法的具体用法?C# TermController.GetTerm怎么用?C# TermController.GetTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Content.Taxonomy.TermController
的用法示例。
在下文中一共展示了TermController.GetTerm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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))
{
//.........这里部分代码省略.........
示例2: 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));
}
示例3: 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);
}
示例4: 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);
}
示例5: 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));
}