Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                SearchForm srch = new SearchForm(this.console, SearchForm.SearchMode.Group);
                srch.ShowDialog(this);

                //get list of groups from the search form.
                ListView.SelectedListViewItemCollection items = srch.lvMembers.SelectedItems;

                //first update the database, then get it from there.
                //for now only one item can be included
                if (items != null && items.Count > 0)
                {
                    _User.GroupId = ((GroupItem)items[0]).GroupView.GroupId;

                    UserStorageView[] users = new UserStorageView[1];
                    users[0] = this._User;

                    console.Manager.Admon_UpdateUsers(console.Credentials, users);
                }

                GetGroupMembershipData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error changing membership:" + ex.Message, "User Properties", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void btnAddPrm_Click(object sender, EventArgs e)
        {
            SearchForm srch = new SearchForm(this.console, SearchForm.SearchMode.Permission);
            srch.ShowDialog(this);

            //get list of users from the search form.
            ListView.SelectedListViewItemCollection items = srch.lvMembers.SelectedItems;

            //for now only one item can be included
            if (items!=null && items.Count>0)
                lvPrm.Items.Clear();

            foreach (ListViewItem li in items)
            {
                PermissionItem prm = new PermissionItem(li.Text);
                prm.ImageIndex = li.ImageIndex;
                prm.Permission = ((PermissionItem)li).Permission;

                //this loop should go only once: since only one item can be selected.
                lvPrm.Items.Add(prm);
            }

            UpdateNeeded = UpdateNeeded || (lvPrm.Items!=null && lvPrm.Items.Count>0);
            btnApply.Enabled = UpdateNeeded;
        }