代码:

DataTable dt = ClassWorkInfoBLL.GetStuWorkList(UserID, PageIndex, PageSize);
                var data = from item in dt.AsEnumerable()
                           group item by new { t1 = item.Field<string>("CreateDate") } into m
                           select new
                           {
                               CreateDate = Convert.ToDateTime(m.First().Field<string>("CreateDate")).ToString("yyyy年MM月dd日"),
                               data = from c in m
                                      select new
                                      {
                                          ID = c.Field<int>("ID"),
                                          Name = c.Field<string>("Name"),
                                          IcoKey = c.Field<string>("IcoKey"),
                                          PubDate = Convert.ToDateTime(c.Field<DateTime>("PubDate")).ToString("yyyy-MM-dd HH:mm:ss"),
                                          EndDate = Convert.ToDateTime(c.Field<DateTime>("EndDate")).ToString("yyyy-MM-dd HH:mm:ss"),
                                          Description = c.Field<string>("Description"),
                                          IsDone = c.Field<object>("IsDone"),//类型是:Int64;可能因为是64位系统?
                                          ClassID = c.Field<int>("ClassID"),
                                          TypeID = c.Field<int>("TypeID"),//作业类型 照片=1,视频=2;
                                      }
                           };

 

var res = query.GroupBy(x => new
{
x.Project,
x.BYear,
x.BMonth
}).Select(x => new
{
x.Key.Project,
x.Key.BYear,
x.Key.BMonth,
Amount = x.Sum(a => a.Amount)
});

相关文章:

  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
猜你喜欢
  • 2021-08-14
  • 2021-06-08
  • 2022-02-16
  • 2021-06-14
相关资源
相似解决方案