Ejemplo n.º 1
0
        public void CreateOrganizationList()
        {
            try
            {
                //create a placeholder entry - uses the most common 5 character password (seed list is 6 characters and above)
                const string listName       = "ClientOrganizations";
                var          listController = new ListController();
                var          entry          = new ListEntryInfo();
                {
                    entry.DefinitionID = -1;
                    entry.ParentID     = 0;
                    entry.Level        = 0;
                    entry.PortalID     = this.PortalId;
                    entry.ListName     = listName;
                    entry.Value        = "Main Location";
                    entry.Text         = "Main Location";
                    entry.SystemList   = false;
                    entry.SortOrder    = 1;
                }

                listController.AddListEntry(entry);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 2
0
        public void CreateList()
        {
            try
            {
                //create a placeholder entry for Inventory Reporting Type
                const string listName       = "InventoryReportingType";
                var          listController = new ListController();
                var          entry          = new ListEntryInfo();
                {
                    entry.DefinitionID = -1;
                    entry.ParentID     = 0;
                    entry.Level        = 0;
                    entry.PortalID     = this.PortalId;
                    entry.ListName     = listName;
                    entry.Value        = "USDA";
                    entry.Text         = "USDA";
                    entry.SystemList   = false;
                    entry.SortOrder    = 1;
                }

                listController.AddListEntry(entry);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 3
0
        private void AddDashboardControlInstaller()
        {
            var           listController = new ListController();
            ListEntryInfo entry          = listController.GetListEntryInfo("Installer", DashboardInstallerName);

            if (entry == null)
            {
                listController.AddListEntry(new ListEntryInfo()
                {
                    ListName = "Installer",
                    Value    = DashboardInstallerName,
                    Text     = DashboardInstallerType
                });
            }
        }
Ejemplo n.º 4
0
        public ActionResult UpdateListEntry(UpdateListEntryRequest request)
        {
            ActionResult actionResult = new ActionResult();

            try
            {
                int pid = request.PortalId ?? PortalSettings.PortalId;
                if (!UserInfo.IsSuperUser && pid != PortalSettings.PortalId)
                {
                    actionResult.AddError(HttpStatusCode.Unauthorized.ToString(), Components.Constants.AuthFailureMessage);
                }

                if (actionResult.IsSuccess)
                {
                    ListController listController = new ListController();
                    ListEntryInfo  entry          = new ListEntryInfo
                    {
                        DefinitionID = Null.NullInteger,
                        PortalID     = pid,
                        ListName     = request.ListName,
                        Value        = request.Value,
                        Text         = request.Text,
                        SortOrder    = request.EnableSortOrder ? 1 : 0
                    };

                    if (request.EntryId.HasValue)
                    {
                        entry.EntryID = request.EntryId.Value;
                        listController.UpdateListEntry(entry);
                    }
                    else
                    {
                        listController.AddListEntry(entry);
                    }
                    actionResult.Data = new { Managers.MemberProfileManager.GetListInfo(request.ListName, PortalSettings.PortalId).Data.Entries };
                }
            }
            catch (Exception exc)
            {
                actionResult.AddError(HttpStatusCode.InternalServerError.ToString(), exc.Message);
            }
            return(actionResult);
        }
Ejemplo n.º 5
0
        /// <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 listName       = string.IsNullOrEmpty(ListName) ? txtEntryName.Text : (!string.IsNullOrEmpty(ParentKey) ? ParentKey + ":" : string.Empty) + ListName;
            var entry          = new ListEntryInfo();

            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID     = ListPortalID;
                entry.ListName     = listName;
                entry.Value        = entryValue;
                entry.Text         = entryText;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                case "update":
                    entry.ListName  = ListName;
                    entry.ParentKey = SelectedList.ParentKey;
                    entry.EntryID   = int.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)
                            {
                                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
                    {
                        Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        Mode = "AddEntry";
                    }
                    else
                    {
                        DataBind();
                    }

                    break;

                case "savelist":
                    if (ddlSelectParent.SelectedIndex != -1)
                    {
                        int           parentID    = int.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
                    {
                        entry.SortOrder = 0;
                    }

                    if (listController.AddListEntry(entry) == Null.NullInteger)                             //entry already found in database
                    {
                        Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    else
                    {
                        SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;
                        Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                    }
                    break;
                }
            }
        }