Exemplo n.º 1
0
        /// <summary>
        /// Setup the dropdown if not done yet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void GroupUserComboBox_Enter(object sender, EventArgs e)
        {
            List <string> names;

            if (ItemNameComboBox.Properties.Items.Count > 0)
            {
                return;
            }

            if (!UsersOnly)
            {
                ItemNameComboBox.Properties.Items.Add("------------- GROUPS -------------");

                names = new List <string>();
                foreach (UserGroup ug in UserGroups.Items)
                {
                    names.Add(ug.ExternalName);
                }

                names.Sort();
                ItemNameComboBox.Properties.Items.AddRange(names);

                ItemNameComboBox.Properties.Items.Add("");
            }

            ItemNameComboBox.Properties.Items.Add("-------------- USERS --------------");

            names = SecurityUtil.GetAllUsers();
            ItemNameComboBox.Properties.Items.AddRange(names);

            return;
        }
Exemplo n.º 2
0
/// <summary>
/// Change owner
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void ChangeOwnerMenuItem_Click(object sender, EventArgs e)
        {
            {
                List <string> users    = SecurityUtil.GetAllUsers();
                string        prompt   = "Enter the user name of the person to transfer ownership of " + Lex.AddDoubleQuotes(Uo.Name) + " to:";
                string        newOwner = InputBoxMx.Show(prompt, "Change Owner", "", users, -1, -1);
                if (Lex.IsNullOrEmpty(newOwner))
                {
                    return;
                }

                string newUserName = SecurityUtil.GetInternalUserName(newOwner);
                if (Lex.IsNullOrEmpty(newUserName))
                {
                    return;
                }

                string result = UserObjectUtil.ChangeOwner(Uo.Id, newUserName);
                if (!Lex.IsNullOrEmpty(result))
                {
                    MessageBoxMx.Show(result);
                    DialogResult = DialogResult.Cancel;                     // close the dialog
                }
                return;
            }
        }