关于linq select join的问题

关于linq select join的问题,linq,Linq,我想列出所有尚未支付学费的学生 i、 当学生被点击时,按月份列出所有待支付的费用 这就是我到目前为止所做的。。 这些都是学生们积极参加的课程。 以下是学生支付给课程的款项记录。 现在我想列出每个学生的所有待付款 e、 g.课程的最后付款日期为2011年11月2日。如果现在的日期时间是5月,那么我想将未决金额显示为 月金额 三月一百日 二零零年四月 五月四日 这就是我试过的 foreach (var result in activeCourses) { //Show all the pe

我想列出所有尚未支付学费的学生 i、 当学生被点击时,按月份列出所有待支付的费用

这就是我到目前为止所做的。。 这些都是学生们积极参加的课程。

以下是学生支付给课程的款项记录。 现在我想列出每个学生的所有待付款 e、 g.课程的最后付款日期为2011年11月2日。如果现在的日期时间是5月,那么我想将未决金额显示为 月金额 三月一百日 二零零年四月 五月四日

这就是我试过的

foreach (var result in activeCourses)
{
    //Show all the pending paid coures from dateJoin till datetime.Now
    DateTime JoinedDate = Convert.ToDateTime(result.cus.Date);
    for (DateTime d = JoinedDate; d.Month <= DateTime.Now.Month; d = d.AddMonths(1))
    {
        Payment payment = new Payment();

        payment.Course.Id = result.c.Id;
        payment.Course.Name = result.c.Name;
        payment.Course.Fee = result.c.Fee;
        payment.CourseByStudent.CourseUserStatus.Date = result.cu.Date;
        payment.CourseByTutor.TutorId = result.t.TutorId;
        payment.User.Name = result.u.Name;

        payment.MonthId = d.Month;
        payment.MonthToPay = d.ToString("MMM");
        output.Add(payment);
    }
}

如果学生不支付任何课程费用,那么上述逻辑似乎并不有效,那么我必须检查自他第一次加入以来的未决付款。否则,我需要根据特定课程从付款表中的DateIssue检查待定付款。请告知,谢谢。我将使用相同的方法返回以显示延迟付款

  for (DateTime d = lastPaidDate.AddMonths(1); d.Month <= DateTime.Now.Month; d = d.AddMonths(1)) 

谢谢大家,我想我会继续使用上面的方法,使用DateTime d=lastPaidDate.AddMonths1;d、 月