protected override void OnLoad(EventArgs e) { if(!IsPostBack) { BXHermitageUserSettings userSettings = new BXHermitageUserSettings(BXIdentity.Current.IsAuthenticated ? BXIdentity.Current.Id : 0); userSettings.Load(); this.displayPageEditorToolbarChbx.Checked = userSettings.EnablePageEditControl; } this.useByDefault.Visible = BXPrincipal.Current.IsCanOperate(BXRoleOperation.Operations.ProductSettingsManage); MasterTitle = Page.Title = GetMessage("PageTitle"); base.OnLoad(e); }
private void TrySave() { try { if(!BXIdentity.Current.IsAuthenticated) throw new InvalidOperationException("User is not authenticated!"); BXHermitageUserSettings userSettings = new BXHermitageUserSettings(this.useByDefault.Checked && BXPrincipal.Current.IsCanOperate(BXRoleOperation.Operations.ProductSettingsManage) ? 0 : BXIdentity.Current.Id); userSettings.Load(); userSettings.EnablePageEditControl = this.displayPageEditorToolbarChbx.Checked; userSettings.Save(); } catch(Exception ex) { this.errorMessage = ex.Message; } }