本文整理汇总了C#中DotNetNuke.Common.Lists.ListController类的典型用法代码示例。如果您正苦于以下问题:C# ListController类的具体用法?C# ListController怎么用?C# ListController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListController类属于DotNetNuke.Common.Lists命名空间,在下文中一共展示了ListController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public HttpResponseMessage Search(string q)
{
var portalId = PortalController.GetEffectivePortalId(PortalSettings.PortalId);
var controller = new ListController();
ListEntryInfo imageType = controller.GetListEntryInfo("DataType", "Image");
IList<SearchResult> results = new List<SearchResult>();
foreach (var definition in ProfileController.GetPropertyDefinitionsByPortal(portalId)
.Cast<ProfilePropertyDefinition>()
.Where(definition => definition.DataType != imageType.EntryID))
{
AddProperty(results, definition.PropertyName, q);
}
AddProperty(results, "Email", q);
AddProperty(results, "DisplayName", q);
AddProperty(results, "Username", q);
AddProperty(results, "Password", q);
AddProperty(results, "PasswordConfirm", q);
AddProperty(results, "PasswordQuestion", q);
AddProperty(results, "PasswordAnswer", q);
return Request.CreateResponse(HttpStatusCode.OK, results.OrderBy(sr => sr.id));
}
示例2: setAlarmType
public void setAlarmType()
{
ListController listController = new ListController();
IEnumerable<ListEntryInfo> listEntryInfoCol = null;
//AlarmType
//listEntryInfoCol = listController.GetListEntryInfoItems("AlarmRuleSet.AlarmType");
listEntryInfoCol = ListsTextLocalizedByListName("AlarmRuleSet.AlarmType");
string strAlarmType = "";
int i = 0;
int icount = listEntryInfoCol.Count();
foreach (ListEntryInfo item in listEntryInfoCol)
{
i += 1;
strAlarmType += item.EntryID.ToString() + ":";
//strAlarmType += item.SortOrder.ToString() + " " + item.Text;
if (i == icount)
{
strAlarmType += item.SortOrder.ToString() + " " + item.Text;
//strAlarmType += ":" + item.EntryID.ToString();
}
else
{
strAlarmType += item.SortOrder.ToString() + " " + item.Text + ";";
//strAlarmType += ":" + item.EntryID.ToString() + ";";
}
}
hidAlarmType.Value = strAlarmType;
}
示例3: CreateEditor
/// <Summary>CreateEditor creates the control collection.</Summary>
protected override void CreateEditor()
{
CategoryDataField = "PropertyCategory";
EditorDataField = "DataType";
NameDataField = "PropertyName";
RequiredDataField = "Required";
ValidationExpressionDataField = "ValidationExpression";
ValueDataField = "PropertyValue";
VisibleDataField = "Visible";
VisibilityDataField = "Visibility";
LengthDataField = "Length";
base.CreateEditor();
//We need to wire up the RegionControl to the CountryControl
foreach( FieldEditorControl editor in Fields )
{
if( editor.Editor is DNNRegionEditControl )
{
ListEntryInfo country = null;
foreach( FieldEditorControl checkEditor in Fields )
{
if( checkEditor.Editor is DNNCountryEditControl )
{
DNNCountryEditControl countryEdit = (DNNCountryEditControl)checkEditor.Editor;
ListController objListController = new ListController();
ListEntryInfoCollection countries = objListController.GetListEntryInfoCollection( "Country" );
foreach( ListEntryInfo checkCountry in countries )
{
if( checkCountry.Text == countryEdit.Value.ToString() )
{
country = checkCountry;
break;
}
}
}
}
//Create a ListAttribute for the Region
string countryKey;
if( country != null )
{
countryKey = "Country." + country.Value;
}
else
{
countryKey = "Country.Unknown";
}
object[] attributes;
attributes = new object[1];
attributes[0] = new ListAttribute( "Region", countryKey, ListBoundField.Text, ListBoundField.Text );
editor.Editor.CustomAttributes = attributes;
}
}
}
示例4: ListsTextLocalizedByListName
private IEnumerable<ListEntryInfo> ListsTextLocalizedByListName(string listname)
{
ListController listcontroller = new ListController();
IEnumerable<ListEntryInfo> listEntryInfoCol = null;
listEntryInfoCol = listcontroller.GetListEntryInfoItems(listname);
foreach (ListEntryInfo li in listEntryInfoCol)
{
li.Text = Localization.GetString(li.Text, "~/App_GlobalResources/List_" + listname + "." + (Page as DotNetNuke.Framework.PageBase).PageCulture.Name + ".resx");
}
return listEntryInfoCol;
}
示例5: DisplayDataType
private static string DisplayDataType(ProfilePropertyDefinition definition)
{
string cacheKey = string.Format("DisplayDataType:{0}", definition.DataType);
string strDataType = Convert.ToString(DataCache.GetCache(cacheKey)) + "";
if (strDataType == string.Empty)
{
var objListController = new ListController();
strDataType = objListController.GetListEntryInfo(definition.DataType).Value;
DataCache.SetCache(cacheKey, strDataType);
}
return strDataType;
}
示例6: DisplayDataType
public string DisplayDataType(AttributeDefinition definition)
{
string retValue = Null.NullString;
ListController objListController = new ListController();
ListEntryInfo definitionEntry = objListController.GetListEntryInfo(definition.DataType);
if ((definitionEntry != null))
{
retValue = definitionEntry.Value;
}
return retValue;
}
示例7: WhenIFillInTheProfilePropertyForm
public void WhenIFillInTheProfilePropertyForm(TechTalk.SpecFlow.Table table)
{
ProfilePropertiesPage.PropertyNameField.Value = table.Rows[0]["Value"];
ListEntryInfo dataType = new ListController().GetListEntryInfo("DataType", table.Rows[1]["Value"]);
ProfilePropertiesPage.DataTypeSelectList.SelectByValue(dataType.EntryID.ToString(CultureInfo.InvariantCulture));
ProfilePropertiesPage.PropertyCategoryField.Value = table.Rows[2]["Value"];
ProfilePropertiesPage.LengthTextField.Value = table.Rows[3]["Value"];
ProfilePropertiesPage.RequiredCheckBox.Checked = Boolean.Parse(table.Rows[4]["Value"]);
ProfilePropertiesPage.VisibleCheckBox.Checked = Boolean.Parse(table.Rows[5]["Value"]);
ProfilePropertiesPage.ReadOnlyCheckBox.Checked = Boolean.Parse(table.Rows[6]["Value"]);
}
示例8: BindTree
private void BindTree()
{
var ctlLists = new ListController();
var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
var indexLookup = new Hashtable();
listTree.Nodes.Clear();
foreach (ListInfo list in colLists)
{
String filteredNode;
if (list.DisplayName.Contains(":"))
{
var finalPeriod = list.DisplayName.LastIndexOf(".", StringComparison.InvariantCulture);
filteredNode = list.DisplayName.Substring(finalPeriod + 1);
}
else
{
filteredNode = list.DisplayName;
}
var node = new DnnTreeNode { Text = filteredNode };
{
node.Value = list.Key;
node.ToolTip = String.Format(LocalizeString("NoEntries"), list.EntryCount);
node.ImageUrl = IconController.IconURL("Folder");
}
if (list.Level == 0)
{
listTree.Nodes.Add(node);
}
else
{
if (indexLookup[list.ParentList] != null)
{
var parentNode = (DnnTreeNode) indexLookup[list.ParentList];
parentNode.Nodes.Add(node);
}
}
//Add index key here to find it later, should suggest with Joe to add it to DNNTree
if (indexLookup[list.Key] == null)
{
indexLookup.Add(list.Key, node);
}
}
}
示例9: GetDependency
/// -----------------------------------------------------------------------------
/// <summary>
/// The GetDependency method instantiates (and returns) the relevant Dependency
/// </summary>
/// <param name="dependencyNav">The manifest (XPathNavigator) for the dependency</param>
/// -----------------------------------------------------------------------------
public static IDependency GetDependency(XPathNavigator dependencyNav)
{
IDependency dependency = null;
string dependencyType = Util.ReadAttribute(dependencyNav, "type");
switch (dependencyType.ToLowerInvariant())
{
case "coreversion":
dependency = new CoreVersionDependency();
break;
case "package":
dependency = new PackageDependency();
break;
case "managedpackage":
dependency = new ManagedPackageDependency();
break;
case "permission":
dependency = new PermissionsDependency();
break;
case "type":
dependency = new TypeDependency();
break;
default:
//Dependency type is defined in the List
var listController = new ListController();
ListEntryInfo entry = listController.GetListEntryInfo("Dependency", dependencyType);
if (entry != null && !string.IsNullOrEmpty(entry.Text))
{
//The class for the Installer is specified in the Text property
dependency = (DependencyBase)Reflection.CreateObject(entry.Text, "Dependency_" + entry.Value);
}
break;
}
if (dependency == null)
{
//Could not create dependency, show generic error message
dependency = new InvalidDependency(Util.INSTALL_Dependencies);
}
//Read Manifest
dependency.ReadManifest(dependencyNav);
return dependency;
}
示例10: FoundBannedPassword
public bool FoundBannedPassword(string inputString)
{
const string listName = "BannedPasswords";
var listController = new ListController();
PortalSettings settings = PortalController.GetCurrentPortalSettings();
IEnumerable<ListEntryInfo> listEntryHostInfos = listController.GetListEntryInfoItems(listName, "", Null.NullInteger);
IEnumerable<ListEntryInfo> listEntryPortalInfos = listController.GetListEntryInfoItems(listName + "-" + settings.PortalId, "", settings.PortalId);
IEnumerable<ListEntryInfo> query2 = listEntryHostInfos.Where(test => test.Text == inputString);
IEnumerable<ListEntryInfo> query3 = listEntryPortalInfos.Where(test => test.Text == inputString);
if (query2.Any() || query3.Any())
{
return true;
}
return false;
}
示例11: Search
public ActionResult Search(string q)
{
try
{
var portalId = PortalController.GetEffectivePortalId(PortalSettings.PortalId);
var controller = new ListController();
var textType = controller.GetListEntryInfo("DataType", "Text");
var regionType = controller.GetListEntryInfo("DataType", "Region");
var countryType = controller.GetListEntryInfo("DataType", "Country");
IList<SearchResult> results = new List<SearchResult>();
foreach (var definition in ProfileController.GetPropertyDefinitionsByPortal(portalId)
.Cast<ProfilePropertyDefinition>()
.Where(definition => definition.DataType == textType.EntryID
|| definition.DataType == regionType.EntryID
|| definition.DataType == countryType.EntryID))
{
AddProperty(results, definition.PropertyName, q);
}
AddProperty(results, "Email", q);
AddProperty(results, "DisplayName", q);
AddProperty(results, "Username", q);
AddProperty(results, "Password", q);
AddProperty(results, "PasswordConfirm", q);
AddProperty(results, "PasswordQuestion", q);
AddProperty(results, "PasswordAnswer", q);
return Json(results.OrderBy(sr => sr.id), JsonRequestBehavior.AllowGet);
}
catch (Exception exc)
{
DnnLog.Error(exc);
return Json(null, JsonRequestBehavior.AllowGet);
}
}
示例12: OnItemChanged
void OnItemChanged(object sender, PropertyEditorEventArgs e)
{
var regionContainer = ControlUtilities.FindControl<Control>(Parent, "Region", true);
if (regionContainer != null)
{
var regionControl = ControlUtilities.FindFirstDescendent<DNNRegionEditControl>(regionContainer);
if (regionControl != null)
{
var listController = new ListController();
var countries = listController.GetListEntryInfoItems("Country");
foreach (var checkCountry in countries)
{
if (checkCountry.Text == e.StringValue)
{
var attributes = new object[1];
attributes[0] = new ListAttribute("Region", "Country." + checkCountry.Value, ListBoundField.Text, ListBoundField.Text);
regionControl.CustomAttributes = attributes;
break;
}
}
}
}
}
示例13: BindTree
private void BindTree()
{
var ctlLists = new ListController();
var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
var indexLookup = new Hashtable();
listTree.Nodes.Clear();
foreach (ListInfo list in colLists)
{
var node = new DnnTreeNode { Text = list.DisplayName.Replace(list.ParentList + ".", "") };
{
node.Value = list.Key;
node.ToolTip = String.Format(LocalizeString("NoEntries"), list.EntryCount);
node.ImageUrl = IconController.IconURL("Folder");
}
if (list.Level == 0)
{
listTree.Nodes.Add(node);
}
else
{
if (indexLookup[list.ParentList] != null)
{
var parentNode = (DnnTreeNode) indexLookup[list.ParentList];
parentNode.Nodes.Add(node);
}
}
//Add index key here to find it later, should suggest with Joe to add it to DNNTree
if (indexLookup[list.Key] == null)
{
indexLookup.Add(list.Key, node);
}
}
}
示例14: GetList
private ListInfo GetList(string key, bool update)
{
var ctlLists = new ListController();
int index = key.IndexOf(":", StringComparison.Ordinal);
string listName = key.Substring(index + 1);
string parentKey = Null.NullString;
if (index > 0)
{
parentKey = key.Substring(0, index);
}
if (update)
{
ListName = listName;
ParentKey = parentKey;
}
return ctlLists.GetListInfo(listName, parentKey, ListPortalID);
}
示例15: UpgradeToVersion530
private static void UpgradeToVersion530()
{
//update languages module
int moduleDefId = GetModuleDefinition("Languages", "Languages");
RemoveModuleControl(moduleDefId, "");
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Languages/languageEnabler.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0, "", true);
AddModuleControl(moduleDefId, "Editor", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);
//Add new View Profile module
moduleDefId = AddModuleDefinition("ViewProfile", "", "ViewProfile", false, false);
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/ViewProfile/ViewProfile.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.View, 0);
AddModuleControl(moduleDefId, "Settings", "Settings", "DesktopModules/Admin/ViewProfile/Settings.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.Edit, 0);
//Add new Sitemap settings module
moduleDefId = AddModuleDefinition("Sitemap", "", "Sitemap", false, false);
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Sitemap/SitemapSettings.ascx", "~/images/icon_analytics_32px.gif", SecurityAccessLevel.View, 0);
AddAdminPages("Search Engine Sitemap", "Configure the sitemap for submission to common search engines.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, moduleDefId, "Search Engine Sitemap", "~/images/icon_analytics_32px.gif");
//Add new Photo Profile field to Host
var listController = new ListController();
Dictionary<string, ListEntryInfo> dataTypes = listController.GetListEntryInfoDictionary("DataType");
var properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger);
ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, UserVisibilityMode.AllUsers, dataTypes);
string installTemplateFile = string.Format("{0}Template\\UserProfile.page.template", Globals.InstallMapPath);
string hostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath);
if (File.Exists(installTemplateFile))
{
if (!File.Exists(hostTemplateFile))
{
File.Copy(installTemplateFile, hostTemplateFile);
}
}
if (File.Exists(hostTemplateFile))
{
ArrayList portals = PortalController.Instance.GetPortals();
foreach (PortalInfo portal in portals)
{
properties = ProfileController.GetPropertyDefinitionsByPortal(portal.PortalID);
//Add new Photo Profile field to Portal
ProfileController.AddDefaultDefinition(portal.PortalID, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, UserVisibilityMode.AllUsers, dataTypes);
//Rename old Default Page template
string defaultPageTemplatePath = string.Format("{0}Templates\\Default.page.template", portal.HomeDirectoryMapPath);
if (File.Exists(defaultPageTemplatePath))
{
File.Move(defaultPageTemplatePath, String.Format("{0}Templates\\Default_old.page.template", portal.HomeDirectoryMapPath));
}
//Update Default profile template in every portal
PortalController.Instance.CopyPageTemplate("Default.page.template", portal.HomeDirectoryMapPath);
//Add User profile template to every portal
PortalController.Instance.CopyPageTemplate("UserProfile.page.template", portal.HomeDirectoryMapPath);
//Synchronize the Templates folder to ensure the templates are accessible
FolderManager.Instance.Synchronize(portal.PortalID, "Templates/", false, true);
var xmlDoc = new XmlDocument();
try
{
// open the XML file
xmlDoc.Load(hostTemplateFile);
}
catch (Exception ex)
{
Exceptions.Exceptions.LogException(ex);
}
XmlNode userTabNode = xmlDoc.SelectSingleNode("//portal/tabs/tab");
if (userTabNode != null)
{
string tabName = XmlUtils.GetNodeValue(userTabNode.CreateNavigator(), "name");
var userTab = TabController.Instance.GetTabByName(tabName, portal.PortalID) ?? TabController.DeserializeTab(userTabNode, null, portal.PortalID, PortalTemplateModuleAction.Merge);
//Update SiteSettings to point to the new page
if (portal.UserTabId > Null.NullInteger)
{
portal.RegisterTabId = portal.UserTabId;
}
else
{
portal.UserTabId = userTab.TabID;
}
}
PortalController.Instance.UpdatePortalInfo(portal);
//Add Users folder to every portal
string usersFolder = string.Format("{0}Users\\", portal.HomeDirectoryMapPath);
if (!Directory.Exists(usersFolder))
{
//Create Users folder
Directory.CreateDirectory(usersFolder);
//Synchronize the Users folder to ensure the user folder is accessible
//.........这里部分代码省略.........