Esempio n. 1
0
        public override void LoadFor(DatabaseDocument databaseDocument)
        {
            var session = ApplicationModel.Current.Server.Value.DocumentStore.OpenAsyncSession(databaseDocument.Id);

            session.Advanced.LoadStartingWithAsync <AuthorizationUser>("Authorization/Users").
            ContinueOnSuccessInTheUIThread(data =>
            {
                AuthorizationUsers.Clear();
                foreach (var authorizationUser in data)
                {
                    AuthorizationUsers.Add(authorizationUser);
                }
                foreach (var authorizationUser in data)
                {
                    OriginalAuthorizationUsers.Add(authorizationUser);
                }
            });

            session.Advanced.LoadStartingWithAsync <AuthorizationRole>("Authorization/Roles").
            ContinueOnSuccessInTheUIThread(data =>
            {
                AuthorizationRoles.Clear();
                foreach (var authorizationRole in data)
                {
                    AuthorizationRoles.Add(authorizationRole);
                }
                foreach (var authorizationRole in data)
                {
                    OriginalAuthorizationRoles.Add(authorizationRole);
                }
            });
        }
        private void HandleSearchUsers()
        {
            var session = ApplicationModel.Current.Server.Value.DocumentStore.OpenAsyncSession(ApplicationModel.Current.Server.Value.SelectedDatabase.Value.Name);

            session.Advanced.LoadStartingWithAsync <AuthorizationUser>("Authorization/Users/" + SearchUsers).
            ContinueOnSuccessInTheUIThread(data =>
            {
                AuthorizationUsers.Clear();
                OriginalAuthorizationUsers.Clear();
                foreach (var authorizationUser in data)
                {
                    AuthorizationUsers.Add(authorizationUser);
                }
                foreach (var authorizationUser in data)
                {
                    OriginalAuthorizationUsers.Add(authorizationUser);
                }
            });
        }
        public override void LoadFor(DatabaseDocument _)
        {
            var session = ApplicationModel.Current.Server.Value.DocumentStore.OpenAsyncSession(ApplicationModel.Current.Server.Value.SelectedDatabase.Value.Name);

            session.Advanced.LoadStartingWithAsync <AuthorizationUser>("Authorization/Users").
            ContinueOnSuccessInTheUIThread(data =>
            {
                AuthorizationUsers.Clear();
                foreach (var authorizationUser in data)
                {
                    AuthorizationUsers.Add(authorizationUser);
                }
                foreach (var authorizationUser in data)
                {
                    OriginalAuthorizationUsers.Add(authorizationUser);
                }

                AuthorizationUsers.CollectionChanged += (sender, args) => HasUnsavedChanges = true;
            });

            session.Advanced.LoadStartingWithAsync <AuthorizationRole>("Authorization/Roles").
            ContinueOnSuccessInTheUIThread(data =>
            {
                AuthorizationRoles.Clear();
                foreach (var authorizationRole in data)
                {
                    AuthorizationRoles.Add(authorizationRole);
                }
                foreach (var authorizationRole in data)
                {
                    OriginalAuthorizationRoles.Add(authorizationRole);
                }

                AuthorizationRoles.CollectionChanged += (sender, args) => HasUnsavedChanges = true;
            });
        }