Code:
if (username == "watson_c")
{
name.Visible = false;
changename.Visible = true;
changename.Value = "criteria here";
}
if (username == "watson_c")
{
name.Visible = false;
changename.Visible = true;
changename.Value = "criteria here";
}
DirectoryEntry entry = new DirectoryEntry("LDAP://OU=DAXCON,DC=hq,DC=local");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(samaccountname=" + username + ")";
search.PropertiesToLoad.Add("name");
search.PropertiesToLoad.Add("distinguishedName");
search.PropertiesToLoad.Add("mail");
search.PropertiesToLoad.Contains("manager");
foreach (SearchResult result in search.FindAll())
{
name.Text = result.Properties["name"][0].ToString();
email.Text = result.Properties["mail"][0].ToString();
string[] pieces = result.Properties["distinguishedName"][0].ToString().Split(',');
if (pieces[1] == "OU=11")
{
department.Text = "Bartonville";
depthead.Text = "Manager Name";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "OU=12")
{
department.Text = "Nebraska";
depthead.Text = "Manager Name";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "OU=13")
{
department.Text = "Sterling";
depthead.Text = "Manager Name";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "OU=20")
{
department.Text = "Southfield";
depthead.Text = "Manager Name";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "OU=30")
{
department.Text = "St. Louis";
depthead.Text = "Manager Name";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "OU=DAXCON")
{
department.Text = "No Office Listed";
depthead.Text = "None";
phone1.Text = "###";
phone2.Text = "###";
phone3.Text = "####";
}
if (pieces[1] == "CN=manager")
{
name.Visible = false;
changename.Visible = true;
changename.Value = ("distinguishedName");
}
}
entry.Close();
}
item13.Attributes.Add("onchange", "total()");
item14.Attributes.Add("onchange", "total()");
}
Comment