Hi,
Anybody help me to convert below linq query in c# into VB.net
var revenueByStaff = from staffRevenue in cc_response.invoices
join staffList in staff_response.staff_members
on staffRevenue.staff_id equals staffList.staff_id
select new {first_name=staffList.first_name, last_name=staffList.last_name, staff_id=staffList.staff_id, amount=Convert.ToDecimal(staffRevenue.amount), currency_code=staffRevenue.currency_code, Month=Convert.ToDateTime(staffRevenue.date).Month};
var staffByMonth = from rs in revenueByStaff
group rs by new { rs.currency_code, rs.staff_id, rs.Month,rs.first_name,rs.last_name } into grp
select new { grp.Key, amount = grp.Sum(s => s.amount) };
var sm = staffByMonth.GroupBy(a => new { a.Key.first_name, a.Key.currency_code }).Select(g =>
{
var dict = new Dictionary<string, decimal>();
foreach (var i in g)
dict.Add(i.Key.Month.ToString(), i.amount);
return new { staff = g.Key, rpt = dict };
}).Select(a=> new Invoice{Name=a.staff.first_name,Currency=a.staff.currency_code,Month=a.rpt});
List<Invoice> ui =sm.ToList<Invoice>();
rptRevenueByStaff.DataSource = ui.OrderBy(o=>o.Name);
rptRevenueByStaff.DataBind();
i can able to convert first two statements but not possible the third.
Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/