コード例 #1
0
        protected void gOAuthScopesDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e)
        {
            ScopeService scopeService = new ScopeService(OAuthContext);

            scopeService.Delete(scopeService.Get(e.RowKeyId));
            OAuthContext.SaveChanges();
            OAuthContext = new OAuthContext();
            gOAuthScopes_Bind(sender, e);
        }
コード例 #2
0
        protected void gOAuthScopes_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e)
        {
            ScopeService scopeService = new ScopeService(OAuthContext);
            Scope        scope        = scopeService.Get(e.RowKeyId);

            hfScopeId.Value       = scope.Id.ToString();
            tbIdentifier.Text     = scope.Identifier;
            tbDescription.Text    = scope.Description;
            cbScopeActive.Checked = scope.Active;

            gOAuthScopeEdit.Show();
        }
コード例 #3
0
        protected void gOAuthScopeEdit_SaveClick(object sender, EventArgs e)
        {
            ScopeService scopeService = new ScopeService(OAuthContext);
            Scope        scope        = null;

            if (hfScopeId.Value.AsIntegerOrNull().HasValue)
            {
                scope = scopeService.Get(hfScopeId.Value.AsInteger());
            }
            else
            {
                scope = new Scope();
                scopeService.Add(scope);
            }
            scope.Identifier  = tbIdentifier.Text;
            scope.Description = tbDescription.Text;
            scope.Active      = cbScopeActive.Checked;
            OAuthContext.SaveChanges();
            OAuthContext = new OAuthContext();
            gOAuthScopes_Bind(sender, e);
            gOAuthScopeEdit.Hide();
        }