private List <InvestorDetail> QueryGroupData(List <InvestorDetail> beforePaging)
        {
            var summaryData =
                beforePaging.Where(d => d.CategoryId != 0).GroupBy(d => d.CategoryId)
                .Zip(Utils.Infinite(1), (dg, no) => new { dg, no })
                .Select(d =>
            {
                var data = new InvestorDetail()
                {
                    Project = new ProjectDetail()
                    {
                        Index           = d.no.ToString(),
                        Category        = CategoryIdTitleMap[d.dg.Key],
                        FinancingAmount = d.dg.Sum(t => t.Project.FinancingAmount)
                    },
                    InvestValue = d.dg.Sum(t => t.InvestValue)
                };
                data.UnInvestValue = (decimal)(data.Project.FinancingAmount - data.InvestValue);
                return(data);
            }).ToList();
            var totalData = new InvestorDetail()
            {
                Project = new ProjectDetail()
                {
                    Index           = null,
                    Category        = "总计",
                    FinancingAmount = summaryData.Sum(t => t.Project.FinancingAmount)
                },
                InvestValue = summaryData.Sum(t => t.InvestValue)
            };

            totalData.UnInvestValue = (decimal)(totalData.Project.FinancingAmount - totalData.InvestValue);
            summaryData.Add(totalData);
            return(summaryData);
        }
Example #2
0
 public void CreateInvestor(InvestorDetail mode)
 {
     using (var context = _dbContextInvestor.Create())
     {
         context.InvestorDetail.Add(new Entities.InvestorDetail()
         {
             CreatedOn = DateTime.Now
         }
                                    );
         context.SaveChanges();
     }
 }