Originally posted by RasputinDude
View Post
Have found a solution.
var query = (
from MyTable in InTable.AsEnumerable()
group MyTable by MyTable.Field<String>("ClientAccountId") into g
select new
{
Activity = OutputActivity,
GroupMember = OutputGroupMember,
BranchNo = OutputBranchNo,
EarmarkingID = "",
CounterpartyAcronym = GetClientMapping(ClientMapping, g.Key),
ProductType = OutputProductType,
StartDate = DateTime.Now,
EndDate = new DateTime?()
}
foreach (PropertyInfo p in type.GetProperties())
{
if (!_ordinalMap.ContainsKey(p.Name))
{
Type colType = p.PropertyType;
if ((colType.IsGenericType) && (colType.GetGenericTypeDefinition() == typeof(Nullable<>)))
{
colType = colType.GetGenericArguments()[0];
}
DataColumn dc = table.Columns.Contains(p.Name) ? table.Columns[p.Name]
: table.Columns.Add(p.Name, colType);
_ordinalMap.Add(p.Name, dc.Ordinal);
}
}


var query = (
from MyTable in InTable.AsEnumerable()
group MyTable by MyTable.Field<String>("ClientAccountId") into g
select new
{
Activity = OutputActivity,
GroupMember = OutputGroupMember,
BranchNo = OutputBranchNo,
EarmarkingID = "",
CounterpartyAcronym = GetClientMapping(ClientMapping, g.Key),
ProductType = OutputProductType,
StartDate = DateTime.Now,
EndDate = new DateTime?()
}


Leave a comment: