日斋
日新月异

var attributeTotalValues = (from a in objValue
                                        group a by new
                                        {
                                            a.ProductTypeID,
                                            a.AttributeCode
                                        } into b
                                        select new
                                        {
                                            ProductTypeID = b.Key.ProductTypeID,
                                            AttributeCode = b.Key.AttributeCode,
                                            TotalAttributeValue = b.Sum(a => a.AttributeValue.ToDecimal())
                                        });

 

var objValue = (from a in LinqMetaData.PMExtendAttribute
                            join b in LinqMetaData.PMProjectProductUnit on
                            new { RefRecordID = a.RefRecordID, RefTable = a.RefTable, RecordStatus = a.RecordStatus }
                            equals new { RefRecordID = b.ProjectProductUnitID, RefTable = "PM_ProjectProductUnit", RecordStatus = "Active" }
                            where b.RecordStatus != "Inactive" && b.ProjectID == intProjectID && ids.Contains(b.ProjectProductUnitID)
                            select new
                            {
                                ProductTypeID = b.ProductTypeID,
                                ProjectProductUnitID = b.ProjectProductUnitID,
                                AttributeCode = a.AttributeCode,
                                AttributeValue = a.AttributeValue
                            });

posted on 2011-10-10 16:28  李承隆  阅读(964)  评论(0编辑  收藏  举报