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


C# ListController.UpdateListEntry方法代码示例

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


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

示例1: UpgradeToVersion550

        private static void UpgradeToVersion550()
        {
            //update languages module
            int moduleDefId = GetModuleDefinition("Languages", "Languages");
            AddModuleControl(moduleDefId, "TranslationStatus", "", "DesktopModules/Admin/Languages/TranslationStatus.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0);

            //due to an error in 5.3.0 we need to recheck and readd Application_Start_FirstRequest
            AddEventQueueApplicationStartFirstRequest();

            // check if UserProfile page template exists in Host folder and if not, copy it from Install folder
            string installTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.InstallMapPath);
            if (File.Exists(installTemplateFile))
            {
                string hostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath);
                if (!File.Exists(hostTemplateFile))
                {
                    File.Copy(installTemplateFile, hostTemplateFile);
                }
            }

            //Fix the permission for User Folders
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                foreach (FolderInfo folder in FolderManager.Instance.GetFolders(portal.PortalID))
                {
                    if (folder.FolderPath.StartsWith("Users/"))
                    {
                        foreach (PermissionInfo permission in PermissionController.GetPermissionsByFolder())
                        {
                            if (permission.PermissionKey.ToUpper() == "READ")
                            {
                                //Add All Users Read Access to the folder
                                int roleId = Int32.Parse(Globals.glbRoleAllUsers);
                                if (!folder.FolderPermissions.Contains(permission.PermissionKey, folder.FolderID, roleId, Null.NullInteger))
                                {
                                    var folderPermission = new FolderPermissionInfo(permission) { FolderID = folder.FolderID, UserID = Null.NullInteger, RoleID = roleId, AllowAccess = true };

                                    folder.FolderPermissions.Add(folderPermission);
                                }
                            }
                        }

                        FolderPermissionController.SaveFolderPermissions(folder);
                    }
                }
                //Remove user page template from portal if it exists (from 5.3)
                if (File.Exists(string.Format("{0}Templates\\UserProfile.page.template", portal.HomeDirectoryMapPath)))
                {
                    File.Delete(string.Format("{0}Templates\\UserProfile.page.template", portal.HomeDirectoryMapPath));
                }
            }

            //DNN-12894 -   Country Code for "United Kingdom" is incorrect
            var listController = new ListController();
            var listItem = listController.GetListEntryInfo("Country", "UK");
            if (listItem != null)
            {
                listItem.Value = "GB";
                listController.UpdateListEntry(listItem);
            }


            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                //fix issue where portal default language may be disabled
                string defaultLanguage = portal.DefaultLanguage;
                if (!IsLanguageEnabled(portal.PortalID, defaultLanguage))
                {
                    Locale language = LocaleController.Instance.GetLocale(defaultLanguage);
                    Localization.Localization.AddLanguageToPortal(portal.PortalID, language.LanguageId, true);
                }
                //preemptively create any missing localization records rather than relying on dynamic creation
                foreach (Locale locale in LocaleController.Instance.GetLocales(portal.PortalID).Values)
                {
                    DataProvider.Instance().EnsureLocalizationExists(portal.PortalID, locale.Code);
                }
            }
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:78,代码来源:Upgrade.cs

示例2: 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

示例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>
        /// <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

示例4: LeadItemsGridView_RowCommand

        /// <summary>Handles the <see cref="GridView.RowCommand"/> event of the <see cref="LeadItemsGridView"/> control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="CommandEventArgs"/> instance containing the event data.</param>
        private void LeadItemsGridView_RowCommand(object sender, CommandEventArgs e)
        {
            if (!this.Page.IsValid || e == null)
            {
                return;
            }

            int rowIndex;
            if (!int.TryParse(e.CommandArgument.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out rowIndex))
            {
                return;
            }

            if (!string.Equals("Save", e.CommandName, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var leadId = this.GetLeadItemId(rowIndex);
            if (!leadId.HasValue)
            {
                return;
            }

            var lists = new ListController();
            var leadItem = lists.GetListEntryInfo(leadId.Value);
            var newLeadText = this.GetLeadItemText(rowIndex);
            var oldLeadText = leadItem.Text;

            if (string.Equals(newLeadText, oldLeadText, StringComparison.CurrentCultureIgnoreCase) || lists.GetListEntryInfo(Utility.LeadListName, newLeadText) == null)
            {
                leadItem.Value = newLeadText;
                leadItem.Text = newLeadText;
                lists.UpdateListEntry(leadItem);
                this.LeadItemsGridView.EditIndex = -1;
                this.BindLeadItems();
            }
            else
            {
                this.cvLeadEdit.IsValid = false;
            }
        }
开发者ID:fujinguyen,项目名称:Engage-Employment,代码行数:45,代码来源:JobDetailOptions.ascx.cs

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