Example #1
0
        private void addUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string   aUsername    = string.Empty;
            string   aPassword    = string.Empty;
            int      aSecurityLvl = 0;
            DateTime aEndDate     = DateTime.Now;
            string   aComment     = string.Empty;

            if (_AppClient != null)
            {
                AppTestGenericInputForm aInput = new AppTestGenericInputForm();

                aInput.Text = "Add User";
                aInput.SetItems(5);
                aInput.SetPrompt(0, "Username:"******"Password:"******"Security Level:");
                aInput.SetPrompt(3, "End Date:");
                aInput.SetPrompt(4, "Comment:");

                if (aInput.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        aUsername    = aInput.GetValue(0);
                        aPassword    = aInput.GetValue(1);
                        aSecurityLvl = int.Parse(aInput.GetValue(2));
                        aEndDate     = DateTime.Parse(aInput.GetValue(3));
                        aComment     = aInput.GetValue(4);

                        _AppClient.AddUser(_DefaultReceiver, aUsername, aPassword, aSecurityLvl, aEndDate, aComment);
                    }
                    catch (Exception ex)
                    {
                        uStatusError.Text = "Add user failed: " + ex.Message;
                    }
                }
            }
            else
            {
                uStatusError.Text = "Add user failed: Not connected.";
            }
        }