Posts
33
Comments
186
Trackbacks
0
LINQ example with GroupBy clause on a property in object
//group all above policies by broker to send an email about "broker re-assignment'
var brokerPolicies = from pol in policy.ListData.AsEnumerable()
                     group pol by pol.Field<int>("intUserID") into grp
                     select new
                     {
                             brokerID = grp.Key,
                             listOfPolicies =  from x in grp.AsEnumerable()
                                               select new 
                                               {
                                                      list = String.Format("{0:00}-{1:000000}",x.Field<short>("intPolicySequence"), x.Field<int>("intPolicyNumber"))
                                                }
                     };
posted on Thursday, June 6, 2013 5:55 PM Print
Comments
Gravatar
# re: LINQ example with GroupBy clause on a property in object
Rishima Hazi
6/29/2015 12:32 PM
@Vipin, any hint on what's wrong with the below query?
---------------

return new ItemPricesViewModel()
{
Source = (from o in XpoSession.Query<PRICE>()
select new ItemPriceViewModel()
{
ID = o.ITEM_ID.ITEM_ID,
ItemCod = o.ITEM_ID.ITEM_COD,
ItemModifier = o.ITEM_MODIFIER_ID.ITEM_MODIFIER_COD,
ItemName = o.ITEM_ID.ITEM_COD,
ItemID = o.ITEM_ID.ITEM_ID,
ItemModifierID = o.ITEM_MODIFIER_ID.ITEM_MODIFIER_ID,
ItemPrices = (from d in o
where d.ITEM_ID.ITEM_ID == o.ITEM_ID.ITEM_ID && d.ITEM_MODIFIER_ID.ITEM_MODIFIER_ID == o.ITEM_MODIFIER_ID.ITEM_MODIFIER_ID
select new Price()
{
ID = o.PRICE_ID,
PriceList = o.PRICELIST_ID.PRICELIST_,
Price = o.PRICE_

}).ToList()
}).ToList()
};

-----------------



commodityonlinetips.in
Gravatar
# re: LINQ example with GroupBy clause on a property in object
technicalstock
4/6/2016 12:14 PM
hile we're looking at these numbers, I'd like to point out that these time differences are over 2 million requests and virtually no other operation going on. We're only testing
Gravatar
# re: LINQ example with GroupBy clause on a property in object
abolhassan amouzgac
12/5/2016 10:05 AM
Pain is a pesky part of being human, I've learned it feels like a stab wound to the heart, something I wish we could all do without, in our lives here. Pain is a sudden hurt that can't be escaped. http://indiavisitonline.in/complete-himachal-tour-package

Post Comment

Title *
Name *
Email
Comment *  
Verification