CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Get Orders and Confirmations(receipt) grouped by store grouped by chain

123 Views
Copy Code Show/Hide Line Numbers
   1:  var result =
   2:      from order in dtx.Orders
   3:      join confirmation in dtx.Confirmations
   4:          on order.acctPoNumId equals confirmation.acctPoNumId into transactions
   5:          from transaction in transactions.DefaultIfEmpty()
   6:          join store in dtx.Stores
   7:              on transaction.indexOfStore equals store.storeIndex into xStores
   8:              from xstore in xStores
   9:              join chain in dtx.Chains
  10:                  on xstore.indexOfChain equals chain.chainIndex into xChains
  11:                  from xChain in xChains
  12:      where (xChain.chainNickName == chainNickName && order.entryTime.Value.Date == searchDate)
  13:      select new { xChain.chainNickName, a = order == null ? "--------" : order.fileName, b = transaction == null ? "--------" : transaction.fileName };
  14:   
  15:   
  16:  //ABC855.Chain.Store200.AcctPONum_001.txt ABC850.Chain.Store200.AcctPONum_001.txt
  17:  //ABC855.Chain.Store227.AcctPONum_001.txt ABC850.Chain.Store227.AcctPONum_001.txt
  18:  //ABC855.Chain.Store235.AcctPONum_001.txt ABC850.Chain.Store235.AcctPONum_001.txt
  19:  //ABC855.Chain.Store655.AcctPONum_001.txt ABC850.Chain.Store655.AcctPONum_001.txt
  20:  //ABC855.Chain.Store655.AcctPONum_002.txt ABC850.Chain.Store655.AcctPONum_001.txt
  21:  //
  22:  //The last line should appear as
  23:  //ABC855.Chain.Store655.AcctPONum_002.txt --------
  24:  //Because there is no 850 with AcctPoNum of 002
by PLangeberg
  November 06, 2009 @ 7:28pm
Tags:
Description:
Chains ( xyz corp) have
Stores (store1, store2, store3...) have
Transactions (orders, receipt)
There can be orders without receipts
There can be receipts without orders
Need a list of orderFilename with corresponding confirmationFilename matched by acctPoNumID
"-------" should be place holder for receipts if order has no recipt and vice versa for receipts with no orders.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate