I have a click_event and as you can see there are a number of functions with many more to come.
Is there an easier way of doing this rather than having 30 odd lines of functions or is this really the best way?
private void metroButton1_Click(object sender, EventArgs e)
{
foreach (MetroFramework.Controls.MetroTextBox item in groupBox1.Controls
.OfType<MetroFramework.Controls.MetroTextBox>())
{
item.Enabled = false;
}
if (searchUsernametxt.Text == "")
{
MessageBox.Show("Domain or Username has not been completed, Please try again!",
"Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
//ActiveDirectory.DomainValue = comboBox1.SelectedText.ToString() ;
if (ActiveDirectory.DoesUserExist(searchUsernametxt.Text) ==true)
{
ActiveDirectory.GetsamAccountName(searchUsernametxt.Text, samAccountNametxt);
ActiveDirectory.isUserEnabled(searchUsernametxt.Text, userenabledtxt);
ActiveDirectory.GetObjectGuid(searchUsernametxt.Text, GUIDtxt);
ActiveDirectory.GetObjectSID(searchUsernametxt.Text, SIDtxt);
ActiveDirectory.PasswordExpirationDate(searchUsernametxt.Text, passlstsettxt);
ActiveDirectory.LockoutCheck(searchUsernametxt.Text, metroCheckBox1);
ActiveDirectory.GetEmployeeID(searchUsernametxt.Text, employeeidtxt);
ActiveDirectory.GetAttributed(searchUsernametxt.Text, cusatt1txt, cusatt2,
cusatt3, cusatt4);
}
}
}