Click here to Skip to main content
16,015,900 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a table that contains all employee data, it is a flat sql table. It contains General managers who manage managers, and managers who manage team leaders, who manage agents. I have an output on gridview which lists all agents under the GM, that is fine but what I need to do is limit the managers to view only the agents that are under his group. His group is usually composed of 5 team leaders who manage around 8 agents each.
I currently can output the the team leaders from their group on a gridview, the field I need is called Full_name. What I can't do is create a loop that can loop on the gridview full_name as that name is the supervisor_name on the agents record and it's that field that will pull the agents under the team leaders under the managers.
I am using linq to create the query that fills the gridview.
Your help is greatly appreciated.
Posted
Updated 28-Jun-11 16:33pm
v3

Hopefully you are using a stored procedure to retrieve the results, if not, you should be. In which case add a where clause to filter by the manager.
 
Share this answer
 
Comments
TonyJPerez 28-Jun-11 22:50pm    
.I am not using a stored procedure. I will post my query tomorrow from work, but basically I call the team leaders by filtering the manager's name as his name appears as supervisor on the team leaders records. I have updated my original post to correct the fields I need. I actually need the full_name field from my gridview as that name will be the supervisor_name on the agents records. So the where clause would be; where supervisor_name = full_name name from the gridview output, the table is the same table. I can output to a new gridview or dropdown box or a combobox as that output will be used to lookup info on another table regarding the employee.

thanks for your reply.
TonyJPerez 29-Jun-11 7:10am    
Here is the query I'm using:
Protected Sub allbymgr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles allbymgr.Click

Dim dC As New APDDataClassesDataContext()
Dim MG = From p In dC.ALLs_employees _
Where p.SUPERVISOR_NAME = lblfname.Text And _
p.EMPLOYMENT_STATUS = "A" _
Order By p.FULL_NAME _
Select p.FULL_NAME, p.LOCATION_NAME, p.EMPLOYMENT_STATUS, _
p.SUPERVISOR_NAME

GridView3.DataSource = MG
GridView3.DataBind()
I am not using a stored procedure. I will post my query tomorrow from work, but basically I call the team leaders by filtering the manager's name as his name appears as supervisor on the team leaders records. I have updated my original post to correct the fields I need. I actually need the full_name field from my gridview as that name will be the supervisor_name on the agents records. So the where clause would be; where supervisor_name = full_name name from the gridview output, the table is the same table. I can output to a new gridview or dropdown box or a combobox as that output will be used to lookup info on another table regarding the employee.

thanks for your reply.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900