示例#1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the Update Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	03/02/2006
        /// </history>
        /// -----------------------------------------------------------------------------
        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            string key     = Null.NullString;
            string setting = Null.NullString;

            foreach (FieldEditorControl settingsEditor in UserSettingsEditor.Fields)
            {
                if (settingsEditor.IsDirty)
                {
                    key     = settingsEditor.Editor.Name;
                    setting = Convert.ToString(settingsEditor.Editor.Value);
                    if (key == "Security_DisplayNameFormat")
                    {
                        //Update the DisplayName of all Users in the portal
                        var objUserController = new UserController();
                        objUserController.PortalId      = UserPortalID;
                        objUserController.DisplayFormat = setting;
                        var objThread = new Thread(objUserController.UpdateDisplayNames);
                        objThread.Start();
                    }
                    UpdateSetting(UserPortalID, key, setting);
                }
            }

            //Clear the UserSettings Cache
            DataCache.RemoveCache(UserController.SettingsKey(UserPortalID));

            Response.Redirect(ReturnURL, true);
        }
示例#2
0
        public override void UpdateSettings()
        {
            foreach (DnnFormItemBase item in settingsEditor.Items)
            {
                PortalController.UpdatePortalSetting(PortalId, item.DataField,
                                                     item.Value.GetType().IsEnum
                                                            ? Convert.ToInt32(item.Value).ToString(CultureInfo.InvariantCulture)
                                                            : item.Value.ToString()
                                                     );
            }

            //Clear the UserSettings Cache
            DataCache.RemoveCache(UserController.SettingsKey(PortalId));
        }
示例#3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the delete Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                var role = TestableRoleController.Instance.GetRole(PortalSettings.PortalId, r => r.RoleID == _roleID);

                TestableRoleController.Instance.DeleteRole(role);

                //Clear Roles Cache
                DataCache.RemoveCache("GetRoles");

                Response.Redirect(Globals.NavigateURL());
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
示例#4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the update Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [jlucarino]	2/23/2009	Added CreatedByUserID and LastModifiedByUserID
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnUpdateClick(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    float sglServiceFee       = 0;
                    var   intBillingPeriod    = Null.NullInteger;
                    var   strBillingFrequency = "N";

                    float sglTrialFee       = 0;
                    var   intTrialPeriod    = Null.NullInteger;
                    var   strTrialFrequency = "N";


                    if (cboBillingFrequency.SelectedItem.Value == "N" && !String.IsNullOrEmpty(txtServiceFee.Text))
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("IncompatibleFee", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }

                    if (!String.IsNullOrEmpty(txtServiceFee.Text) && cboBillingFrequency.SelectedItem.Value != "N")
                    {
                        sglServiceFee       = float.Parse(txtServiceFee.Text);
                        intBillingPeriod    = String.IsNullOrEmpty(txtBillingPeriod.Text) ? 1 : int.Parse(txtBillingPeriod.Text);
                        strBillingFrequency = cboBillingFrequency.SelectedItem.Value;
                    }

                    if (sglServiceFee != 0 && !String.IsNullOrEmpty(txtTrialFee.Text) && cboTrialFrequency.SelectedItem.Value != "N")
                    {
                        sglTrialFee       = float.Parse(txtTrialFee.Text);
                        intTrialPeriod    = string.IsNullOrEmpty(txtTrialPeriod.Text) ? 1 : int.Parse(txtTrialPeriod.Text);
                        strTrialFrequency = cboTrialFrequency.SelectedItem.Value;
                    }

                    var role = new RoleInfo
                    {
                        PortalID         = PortalId,
                        RoleID           = _roleID,
                        RoleGroupID      = int.Parse(cboRoleGroups.SelectedValue),
                        RoleName         = txtRoleName.Text,
                        Description      = txtDescription.Text,
                        ServiceFee       = sglServiceFee,
                        BillingPeriod    = intBillingPeriod,
                        BillingFrequency = strBillingFrequency,
                        TrialFee         = sglTrialFee,
                        TrialPeriod      = intTrialPeriod,
                        TrialFrequency   = strTrialFrequency,
                        IsPublic         = chkIsPublic.Checked,
                        AutoAssignment   = chkAutoAssignment.Checked,
                        SecurityMode     = (SecurityMode)Enum.Parse(typeof(SecurityMode), securityModeList.SelectedValue),
                        Status           = (RoleStatus)Enum.Parse(typeof(RoleStatus), statusList.SelectedValue),
                        RSVPCode         = txtRSVPCode.Text,
                        IconFile         = ctlIcon.Url
                    };

                    if (_roleID == -1)
                    {
                        if (TestableRoleController.Instance.GetRole(PortalId, r => r.RoleName == role.RoleName) == null)
                        {
                            TestableRoleController.Instance.AddRole(role, chkAssignToExistUsers.Checked);
                        }
                        else
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateRole", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        TestableRoleController.Instance.UpdateRole(role, chkAssignToExistUsers.Checked);
                    }

                    //Clear Roles Cache
                    DataCache.RemoveCache("GetRoles");

                    Response.Redirect(Globals.NavigateURL(string.Empty, "RoleGroupID=" + role.RoleGroupID));
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }