Example #1
0
        private void onUserAdd(object sender, EventArgs e)
        {
            try
            {
                // does user belong to group ?
                foreach (object o in listboxUsers.Items)
                {
                    DCUser user = o as DCUser;
                    if (null != user && string.Equals(tbUserToAdd.Text, user.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        MessageBox.Show(string.Format("User '{0}' already member of group {1}!", user.Name));
                        return;
                    }
                }
                PLMPackServiceClient client = WCFClientSingleton.Instance.Client;
                // does user exist
                if (!client.UserExists(tbUserToAdd.Text))
                {
                    MessageBox.Show(string.Format("User '{0}' does not exist!"));
                    return;
                }
                // add user to group
                client.AddUserToCurrentGroup(tbUserToAdd.Text);

                tbUserToAdd.Text = string.Empty;
                FillUserList();
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }