当前位置: 首页>>代码示例>>C#>>正文


C# ListController.AddListEntry方法代码示例

本文整理汇总了C#中DotNetNuke.Common.Lists.ListController.AddListEntry方法的典型用法代码示例。如果您正苦于以下问题:C# ListController.AddListEntry方法的具体用法?C# ListController.AddListEntry怎么用?C# ListController.AddListEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Common.Lists.ListController的用法示例。


在下文中一共展示了ListController.AddListEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpgradeToVersion710

        private static void UpgradeToVersion710()
        {
            //create a placeholder entry - uses the most common 5 character password (seed list is 6 characters and above)
            const string listName = "BannedPasswords";
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = Null.NullInteger;
                entry.ListName = listName;
                entry.Value = "12345";
                entry.Text = "Placeholder";
                entry.SystemList = false;
            }

            //add list to each portal and update primary alias
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                entry.PortalID = portal.PortalID;
                entry.SystemList = false;
                entry.ListName = listName + "-" + portal.PortalID;
                listController.AddListEntry(entry);

                var defaultAlias = PortalController.GetPortalSetting("DefaultPortalAlias", portal.PortalID, String.Empty);
                if (!String.IsNullOrEmpty(defaultAlias))
                {
                    foreach (var alias in PortalAliasController.Instance.GetPortalAliasesByPortalId(portal.PortalID).Where(alias => alias.HTTPAlias == defaultAlias))
                    {
                        alias.IsPrimary = true;
                        PortalAliasController.Instance.UpdatePortalAlias(alias);
                    }
                }
            }

            // Add File Content Type
            var typeController = new ContentTypeController();
            var contentTypeFile = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();

            if (contentTypeFile == null)
            {
                typeController.AddContentType(new ContentType { ContentType = "File" });
            }

            var fileContentType = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();


            //only perform following for an existing installation upgrading
            if (Globals.Status == Globals.UpgradeStatus.Upgrade)
            {
                UpdateFoldersForParentId();
                ImportDocumentLibraryCategories();
                ImportDocumentLibraryCategoryAssoc(fileContentType);
            }

            //Add 404 Log
            var logTypeInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 404 Page Not Found",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            LogController.Instance.AddLogType(logTypeInfo);

            //Add LogType
            var logTypeConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                KeepMostRecent = "100",
                NotificationThreshold = 1,
                NotificationThresholdTime = 1,
                NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                MailFromAddress = Null.NullString,
                MailToAddress = Null.NullString,
                LogTypePortalID = "*"
            };
            LogController.Instance.AddLogTypeConfigInfo(logTypeConf);

            UninstallPackage("DotNetNuke.SearchInput");

            //enable password strength meter for new installs only
            HostController.Instance.Update("EnableStrengthMeter", Globals.Status == Globals.UpgradeStatus.Install ? "Y" : "N");

            //Add IP filter log type
            var logTypeFilterInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 403.6 forbidden ip address rejected",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            LogController.Instance.AddLogType(logTypeFilterInfo);

            //Add LogType
            var logTypeFilterConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
//.........这里部分代码省略.........
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:101,代码来源:Upgrade.cs

示例2: UpgradeToVersion620

        private static void UpgradeToVersion620()
        {
            //add host (system) profanityfilter list
            const string listName = "ProfanityFilter";
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = Null.NullInteger;
                entry.ListName = listName;
                entry.Value = "ReplaceWithNothing";
                entry.Text = "FindThisText";
                entry.SystemList = true;
            }
            listController.AddListEntry(entry);

            //add same list to each portal
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                entry.PortalID = portal.PortalID;
                entry.SystemList = false;
                entry.ListName = listName + "-" + portal.PortalID;
                listController.AddListEntry(entry);

                //also create default social relationship entries for the portal
                RelationshipController.Instance.CreateDefaultRelationshipsForPortal(portal.PortalID);
            }

            //Convert old Messages to new schema
            ConvertOldMessages();

            //Replace old Messaging module on User Profile with new 
            ReplaceMessagingModule();

            //Move Photo Property to the end of the propert list.
            MovePhotoProperty();

            //Update Child Portal's Default Page
            UpdateChildPortalsDefaultPage();

            //Add core notification types
            AddCoreNotificationTypesFor620();

            //Console module should not be IPortable
            var consoleModule = DesktopModuleController.GetDesktopModuleByModuleName("Console", Null.NullInteger);
            consoleModule.SupportedFeatures = 0;
            consoleModule.BusinessControllerClass = "";
            DesktopModuleController.SaveDesktopModule(consoleModule, false, false);
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:49,代码来源:Upgrade.cs

示例3: OnSaveEntryClick

        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            String entryValue;
            String entryText;
            if (UserInfo.IsSuperUser)
            {
                entryValue = txtEntryValue.Text;
                entryText = txtEntryText.Text;
            }
            else
            {
                var ps = new PortalSecurity();

                entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting);
                entryText = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting);
            }
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = ListPortalID;
                entry.ListName = txtEntryName.Text;
                entry.Value = entryValue;
                entry.Text = entryText;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                    case "update":
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.EntryID = Int16.Parse(txtEntryID.Text);
                        bool canUpdate = true;
                        foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID))
                        {
                            if (entry.EntryID != curEntry.EntryID) //not the same item we are trying to update
                            {
                                if (entry.Value == curEntry.Value && entry.Text == curEntry.Text)
                                {
                                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                                    canUpdate = false;
                                    break;
                                }

                            }
                        }

                        if (canUpdate)
                        {
                            listController.UpdateListEntry(entry);
                            DataBind();
                        }
                        break;
                    case "saveentry":
                        if (SelectedList != null)
                        {
                            entry.ParentKey = SelectedList.ParentKey;
                            entry.ParentID = SelectedList.ParentID;
                            entry.Level = SelectedList.Level;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }

                        if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        }

                        DataBind();
                        break;
                    case "savelist":
                        if (ddlSelectParent.SelectedIndex != -1)
                        {
                            int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                            ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID);
                            entry.ParentID = parentID;
                            entry.DefinitionID = parentEntry.DefinitionID;
                            entry.Level = parentEntry.Level + 1;
                            entry.ParentKey = parentEntry.Key;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
//.........这里部分代码省略.........
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:101,代码来源:ListEntries.ascx.cs

示例4: CreatePortal


//.........这里部分代码省略.........
						adminUser.Profile.PreferredLocale = portal.DefaultLanguage;
						var portalSettings = new PortalSettings(portal);
						adminUser.Profile.PreferredTimeZone = portalSettings.TimeZone;
						UserController.UpdateUser(portal.PortalID, adminUser);
                        DesktopModuleController.AddDesktopModulesToPortal(portalId);
                        AddPortalAlias(portalId, portalAlias);

                        if (newPortalLocales != null)
                        {
                            foreach (Locale newPortalLocale in newPortalLocales.AllValues)
                            {
                                Localization.AddLanguageToPortal(portalId, newPortalLocale.LanguageId, false);
                            }
                        }

                        try
                        {
                            RelationshipController.Instance.CreateDefaultRelationshipsForPortal(portalId);
                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);                            
                        }

                        //add profanity list to new portal
                        try
                        {
                            const string listName = "ProfanityFilter";
                            var listController = new ListController();
                            var entry = new ListEntryInfo();
                            entry.PortalID = portalId;
                            entry.SystemList = false;
                            entry.ListName = listName + "-" + portalId;
                            listController.AddListEntry(entry);

                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                        }

                        //add banned password list to new portal
                        try
                        {
                            const string listName = "BannedPasswords";
                            var listController = new ListController();
                            var entry = new ListEntryInfo();
                            entry.PortalID = portalId;
                            entry.SystemList = false;
                            entry.ListName = listName + "-" + portalId;
                            listController.AddListEntry(entry);

                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                        }

                        // Add default workflows
                        try
                        {
                            ContentWorkflowController.Instance.CreateDefaultWorkflows(portalId);
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(ex);
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:67,代码来源:PortalController.cs

示例5: OnSaveEntryClick

        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        ///     [cnurse]  01/30/2007	Extracted to separte user control
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            var ctlLists = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = ListPortalID;
                entry.ListName = txtEntryName.Text;
                entry.Value = txtEntryValue.Text;
                entry.Text = txtEntryText.Text;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                    case "update":
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.EntryID = Int16.Parse(txtEntryID.Text);

                        ctlLists.UpdateListEntry(entry);

                        DataBind();
                        break;
                    case "saveentry":
                        if (SelectedList != null)
                        {
                            entry.ParentKey = SelectedList.ParentKey;
                            entry.ParentID = SelectedList.ParentID;
                            entry.Level = SelectedList.Level;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }
                        ctlLists.AddListEntry(entry);

                        DataBind();
                        break;
                    case "savelist":
                        if (ddlSelectParent.SelectedIndex != -1)
                        {
                            int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                            ListEntryInfo parentEntry = ctlLists.GetListEntryInfo(parentID);
                            entry.ParentID = parentID;
                            entry.DefinitionID = parentEntry.DefinitionID;
                            entry.Level = parentEntry.Level + 1;
                            entry.ParentKey = parentEntry.Key;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }
                        ctlLists.AddListEntry(entry);

                        SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;

                        Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                        break;
                }
            }
        }
开发者ID:patonomatic,项目名称:VUWTC,代码行数:84,代码来源:ListEntries.ascx.cs

示例6: cmdSaveEntry_Click

        /// <summary>
        /// Handles cmdSaveEntry.Click
        /// </summary>
        /// <remarks>
        /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void cmdSaveEntry_Click( object sender, EventArgs e )
        {
            ListController ctlLists = new ListController();
            ListEntryInfo entry = new ListEntryInfo();
            entry.ListName = txtEntryName.Text;
            entry.Value = txtEntryValue.Text;
            entry.Text = txtEntryText.Text;

            switch (cmdSaveEntry.CommandName.ToLower())
            {
                case "update":
                    entry.ParentKey = txtParentKey.Text;
                    entry.EntryID = Int16.Parse(txtEntryID.Text);

                    ctlLists.UpdateListEntry(entry);

                    InitList();
                    EnableView(true);
                    //BindListInfo()
                    BindGrid();

                    break;
                case "saveentry":
                    entry.ParentKey = txtParentKey.Text;
                    if (EnableSortOrder)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    ctlLists.AddListEntry(entry);

                    InitList();
                    BindListInfo();
                    BindTree();
                    BindGrid();

                    break;
                case "savelist":
                    string strKey = "";
                    string strText = "";
                    if (ddlSelectParent.SelectedIndex != -1)
                    {
                        strKey = ddlSelectParent.SelectedItem.Value;
                        strText = ddlSelectParent.SelectedItem.Text;
                        entry.ParentKey = strKey;
                        strKey += ":";
                        strText += ":";
                    }

                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    ctlLists.AddListEntry(entry);

                    strKey += this.txtEntryName.Text;
                    strText += this.txtEntryName.Text;

                    SelectedKey = strKey;
                    SelectedText = strText;

                    BindTree();
                    InitList();
                    BindListInfo();
                    BindGrid();
                    //Response.Redirect(NavigateURL(TabId))
                    break;
            }

        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:88,代码来源:ListEditor.ascx.cs


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