var result = dm.Challan_Totals
.Join(dm.Challans,
ct => ct.Challan_No,
c => c.Challan_No,
(ct, c) => new { ct, c })
.Join(dm.Rates,
ctc => new
{
Type = ctc.ct.Type,
Own_Company = ctc.c.Own_Comany,
Parti_Name = ctc.c.Parti_Name
},
rt => new
{
Type = rt.Meterial_type,
Own_Company = rt.Company_Id,
Parti_Name = rt.Parti_Id
},
(ctc, rt) => new { ctc, rt })
.Where(x => x.ctc.ct.Challan_No == "2014CH 10002")
.Select(res => new
{
Challan_no = res.ctc.ct.Challan_No,
Type = res.ctc.ct.Type,
Measurment = res.ctc.ct.Measurement,
Rate1 = res.rt.Rate1,
Amount = (res.ctc.ct.Measurement) * ((double)res.rt.Rate1)
})
.ToList();