C#,list Set multiple GroupBy

Source: Internet
Author: User

1 Raw data

2 notation

varData1 = _m.getpurchase_title (MasterID). FirstOrDefault ();//Table Header                varData2 = _m.getpurchasedt (MasterID);//Detail                varresult =New{Purno=data1. MasterID, ProviderName=data1. Providename, Remark=data1. Remark, Sumcount=Data1.preqty, Summoney=data1. Omoney, Detail_style= Data2. GroupBy (M = m.style). Select (g =New{style=G.key, Detail_sku= G.select (n =N). GroupBy (x=New{x.stylename, X.serialno, X.attribname, X.clrname, X.oprice}). Select (t=New{Preqty= T.sum (b =b.preqty), Oprice=T.key.oprice, Omoney= T.sum (b =B.omoney), StyleName=T.key.stylename, Serialno=T.key.serialno, Attribname=T.key.attribname, Clrname=T.key.clrname, Size= T.select (v = v). GroupBy (z = z.sizename). Select (k = K.key +":"+ k.sum (L =l.preqty). ToString () )})};

3 Effect:

{            "errmsg":"OK",            "Purno":"B201709270000019",            "ProviderName":"external 4q-37615 Linzhi",            "Remark":"This is a very cool remark.",            "Sumcount": -,            "Summoney":2400.00,            "Detail_style": [{                    "style":"10b73a33980",                    "Detail_sku": [{                        "Preqty":8,                        "Oprice":100.00,                        "Omoney":2400.00,                        "StyleName":"This is the name .",                        "Serialno":"Original number",                        "Attribname":"counter",                        "Clrname":"Scarlet",                        "Sizebname": ["36:10","37:10","38:20","l:30","xll:100"]                    }, {                        "Skucount":9,                        "Oprice":100.00,                        "Omoney":2400.00,                        "StyleName":"This is the name .",                        "Serialno":"Original number",                        "Attribname":"counter",                        "Clrname":"Green",                        "Sizebname": ["x:10","xx:10","xxl:20","l:30","xll:100"]                    }]                },                {                    "style":"20b73a33981",                    "Detail_sku": [{                        "Skucount":Ten,                        "Oprice":100.00,                        "Omoney":2400.00,                        "StyleName":"This is the name .",                        "Serialno":"Original number",                        "Attribname":"counter",                        "Clrname":"Color",                        "Sizebname": ["x:10","xx:10","xxl:20","l:30","xll:100"]                    }, {                        "Skucount": One,                        "Oprice":100.00,                        "Omoney":2400.00,                        "StyleName":"This is the name .",                        "Serialno":"Original number",                        "Attribname":"counter",                        "Clrname":"Color",                        "Sizebname": ["x:10","xx:10","xxl:20","l:30","xll:100"]                    }]                }            ]        }

C#,list Set multiple GroupBy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.