Hi,
You will basically replace the following calls:
Code: C#
Directory.GetDirectories(parentDirectory);
with your own code that would read your database to get all employees for a given boss. For example, you can write some code like this:
Code: C#
Employee[] employees = GetEmployees(bossId);
foreach (Employee employee in employees)
{
EO.Web.TreeNode dirNode = new EO.Web.TreeNode(employee.Name);
......
}
The above code assumes that you already have an Employee class that contains all employee data, and a GetEmployees function that can get all employees for a given boss Id. If you do not already have those, you can simply call SqlCommand.ExecuteReader with a SELECT sql statement. The function returns an IDataReader for you and you will be able to loop through it like this:
Code: C#
SqlCommand cmd = new SqlCommand("select .....", cn);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string employeeName = reader["employeeName"];
EO.Web.TreeNode dirNode = new EO.Web.TreeNode(employeeName);
......
}
The above code assumes that you already have a SQL connection "cn", and the field name for employee name is "employeeName". Obviously you may need to change this accordingly.
In order for the code to work, you will need to store "bossId" in your TreeNode, you would usually store it into the TreeNode's Value property. This is similar to the sample code storing the path information into the node's Value property.
Hope this helps.
Thanks!