using System.Collections.Generic;
using System.Linq;
class program
{
static void Main(string[] args)
{
List<organization> lstOrg = new List<organization>();
List<department> lstDep = new List<department>();
List<location> lstLoca = new List<location>();
List<participant> lstPartip = new List<participant>();
var data = lstPartip.Join(lstOrg, (k => k.org_id), (k => k.org_id), (p, o) => new { p, o })
.Join(lstDep, (k => k.p.dep_id), (k => k.dep_id), (po, d) => new { po, d })
.Join(lstLoca, (k => k.po.p.loc_id), (k => k.loc_id), (pod, l) => new { pod, l })
.Select(k => new {
participant_name = k.pod.po.p.par_name
,org_name = k.pod.po.o.org_name
,location_name =k.l.loc_name
,department_name = k.pod.d.dep_name
}).ToList();
grid.datasource = data;
grid.databind();
}
}
public class organization
{
public int org_id { get; set; }
public string org_name { get; set; }
}
public class department
{
public int dep_id { get; set; }
public string dep_name { get; set; }
}
public class location
{
public int loc_id { get; set; }
public string loc_name { get; set; }
}
public class participant
{
public int par_id { get; set; }
public string par_name { get; set; }
public int org_id { get; set; }
public int dep_id { get; set; }
public int loc_id { get; set; }
}