public class AgentObject { public int EmpNumber; public object stats; public AgentObject(int EmployeeNumber) { EmpNumber = EmployeeNumber; stats = AgentStats(EmpNumber); } protected virtual object AgentStats(int EmpNum) { Roboto.GetData empData = new Roboto.GetData(); DataTable dt = empData.Eligible("test"); var query = (from r in dt.AsEnumerable() where r.Field<string>("Employee_Number") == EmpNum.ToString() select new { Employee_Number = r["Employee_Number"], Full_Name = r["Full_Name"], Supervisor_Name = r["Supervisor_Name"], Awesomeness = r["Awesomeness"], Lameness = r["Lameness"] }).ToList(); return query; } }
foreach (var v in query) { for (int j = 0; j < aObject.Count(); j++) { aObject[j] = new SubmittedExceptions(Convert.ToInt32(v.Employee_Number)); } }
foreach (var v in aObject[x].stats) { lblEmployee_Number.txt = v.Full_Name; }