示例#1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            var newUserForm = new EditUserForm(_loggedInUser);

            if (newUserForm.ShowDialog(this) == DialogResult.OK)
            {
                var user = newUserForm.GetUser();
                Client.Instance.Send(new InsertUserReq()
                {
                    User = user, CreatorId = _loggedInUser.Id
                });
                RefreshUsersList();
            }
        }
示例#2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var editUserForm       = new EditUserForm(_loggedInUser, (User)listBoxUsers.SelectedItem);
            var previousGroupLevel = editUserForm.GetUser().GroupRole;

            if (editUserForm.ShowDialog(this) == DialogResult.OK)
            {
                var selectedIndex = listBoxUsers.SelectedIndex;
                var user          = editUserForm.GetUser();
                Client.Instance.Send(new UpdateUserReq()
                {
                    User = user, ForceDisconnect = previousGroupLevel >= user.GroupRole
                });

                RefreshUsersList();
                listBoxUsers.SelectedIndex = selectedIndex;
            }
        }