Exemplo n.º 1
0
 void Handle(Input.Delete action)
 {
     // TODO: Warning user with Yes/No dialog
     Db.Transact(() => {
         SystemUserAdmin.DeleteSystemUserGroup(this.Data as Simplified.Ring3.SystemUserGroup);
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// EMailAddress
        /// </summary>
        //private Simplified.Ring3.EmailAddress EMailAddress {
        //    get {
        //        Simplified.Ring3.SystemUser user = this.Data as Simplified.Ring3.SystemUser;
        //        if (user == null) return null;
        //        return Db.SQL<Simplified.Ring3.EmailAddress>("SELECT o FROM Simplified.Ring3.EmailAddress o WHERE o.ToWhat=?", user).First;
        //    }
        //}

        #region View-model Handlers

        /// <summary>
        /// Delete user
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Delete action)
        {
            this.Message = null;
            var        transaction = this.Transaction;
            SystemUser user        = this.Data;
            SystemUser systemUser  = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(user))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            this.Data = null;
            // TODO: Warn user with Yes/No dialog
            transaction.Rollback();

            transaction.Scope(() =>
            {
                SystemUserAdmin.DeleteSystemUser(user);
            });

            transaction.Commit();

            this.RedirectUrl = "/UserAdmin/admin/users";
        }
Exemplo n.º 3
0
        void Handle(Input.Delete action)
        {
            SystemUser systemUser = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(this.Data))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            // TODO: Warning user with Yes/No dialog
            Db.Transact(() => {
                SystemUserAdmin.DeleteSystemUser(this.Data as Simplified.Ring3.SystemUser);
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// Delete System User Group
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Delete action)
        {
            // TODO: Warn user with Yes/No dialog
            var transaction = this.Transaction;

            transaction.Scope(() => {
                SystemUserAdmin.DeleteSystemUserGroup(this.Data as Simplified.Ring3.SystemUserGroup);
            });

            if (transaction.IsDirty)
            {
                transaction.Commit();
            }

            this.RedirectUrl = "/UserAdmin/admin/usergroups";
        }
Exemplo n.º 5
0
        /// <summary>
        /// Save event
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Save action)
        {
            this.AssurePropertiesMetadata();

            if (this.IsInvalid)
            {
                return;
            }

            try
            {
                SystemUserAdmin.AssignPerson(this.Data, this.FirstName, this.LastName);
                Transaction.Commit();
                this.RedirectUrl = "/UserAdmin/admin/users";
            }
            catch (Exception e)
            {
                this.Message = e.Message;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// AddUser operation invoked
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.AddUser action)
        {
            this.AssurePropertyMetadata_AddUserName("AddUserName$", this.AddUserName);
            if (this.AddUser_Feedback != null)
            {
                return;
            }

            Simplified.Ring3.SystemUser systemUser = Db.SQL <Simplified.Ring3.SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.Username=?", this.AddUserName).First;
            if (systemUser == null)
            {
                PropertyMetadataItem item = new PropertyMetadataItem();
                item.Message          = "User not found";
                item.ErrorLevel       = 1;
                item.PropertyName     = "AddUser$";
                this.AddUser_Feedback = item;
                return;
            }

            SystemUserAdmin.AddSystemUserToSystemUserGroup(systemUser, this.Data);
            this.AddUserName = string.Empty;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Remove a SystemUser from the group
 /// </summary>
 /// <param name="action"></param>
 void Handle(Input.Remove action)
 {
     Simplified.Ring3.SystemUserGroup group      = this.Parent.Parent.Data as Simplified.Ring3.SystemUserGroup;
     Simplified.Ring3.SystemUser      systemUser = this.Data as Simplified.Ring3.SystemUser;
     SystemUserAdmin.RemoveSystemUserFromSystemUserGroup(systemUser, group);
 }