Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C# by LINQ ( 6 years ago )
var query = (
from a in cx.PdAbility
from al in cx.PdAbilityLevel
join ppa in cx.PdPersonnelAbility on
new { aId = a.Id, al.Level, IsDeleted = false } equals
new { aId = ppa.PdAbilityId, Level = ppa.CurrentLevel, ppa.IsDeleted } into paaj
from ppa in paaj.DefaultIfEmpty()
where a.IsDeleted == false && al.IsDeleted == false
select new
{
abi = new
{
a.Id,
a.Code,
a.Name
},
abiLevel = new
{
al.Level
}
});
var tempRes2 = await query.ToListAsync();
var tempRes = tempRes2
.GroupBy(g => new { g.abi, g.abiLevel })
.Select(s => new { s.Key.abi, s.Key.abiLevel })
.ToList();
IList<PdAbilityGetPerCountByAbilityLevelDto> result =
tempRes.GroupBy(g => g.abi).Select(s => new PdAbilityGetPerCountByAbilityLevelDto()
{
PdAbilityCode = s.Key.Code,
PdAbilityName = s.Key.Name,
PdAbilityLevel = tempRes
.Where(w => w.abi.Id == s.Key.Id)
.GroupBy(g1 => new { g1.abiLevel })
.Select(s1 => new PdAbilityGapAnalysisResultLevel2()
{
Level = s1.Key.abiLevel.Level,
PerCount = s1.Count()
}).ToList()
}).ToList();
return result;
Revise this Paste