开发者

How to write simple Where Clause for dynamic filtering in linq when we use groups in join

I have simple search page i want to filter the results.

var TransactionStats = from trans in context.ProductTransactionSet.Include("SPL")
    select new
    {
        trans.InvoiceNo,         
        ProductGroup = from tranline in trans.ProductTransactionLines
            group tranline by tranline.ProductTransaction.TransactionID
            into ProductGroupDetil
            select new
            {
              开发者_JAVA百科  TransactionDateTime = ProductGroupDetil.Select
                    (Content => Content.TransactionDateTime)
            }
    };

I want to use TransactionDateTime in where clause when required.

if (_FilterCrieteria.DateFrom.HasValue)
{
    TransactionStats.Where
    (
        a => a.ProductGroup.Where
            (
                dt => dt.DateofTransaction >= _FilterCrieteria.DateFrom &&
                    dt.DateofTransaction >= _FilterCrieteria.DateFrom
            )
    )
}

Can any one correct the syntax?


The third row in your second code block should probably read:

    TransactionStats = TransactionStats.Where
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜