日期:2014-05-20 浏览次数:20830 次
List<int> callTypes = new List<int> { 2, 3 };
var query = from data in ds.Tables[0].AsEnumerable()
where callTypes.Contains(data.Field<int>("CallType"))
group data by new { t1 = data.Field<int>("Ent_ID"), t2 = data.Field<string>("SDate") } into m
select new
{
Ent_ID = m.Key.t1,
SDate = m.Key.t2,
CallAll = m.Select(x => x.Field<string>("CallCode")).Distinct().Count()
};
foreach (var item in query) //这里就报错了。。。
{
WriteSysLog(item.Ent_ID + "..." + item.SDate + "..." + item.CallAll);
}
var query_Trs_Suc = from data in ds.Tables[0].AsEnumerable()
let ToLen = data.Field<int>("TotalLen")
where data.Field<int>("CallType") == 2 && data.Field<string>("Called").Length > 5
&& ToLen>0
group data by new { t1 = data.Field<int>("Ent_ID"), t2 = data.Field<string>("SDate") } into m
select new
{
Ent_ID = m.Key.t1,
SDate = m.Key.t2,
CallIn_TRS_Suc = m.Select(x => x.Field<string>("CallCode")).Distinct().Count()
};
foreach (var item_trs_suc in query_Trs_Suc)
{
WriteSysLog(item_trs_suc.Ent_ID + "..." + item_trs_suc.SDate + "..." + item_trs_suc.CallIn_TRS_Suc);
}