0
我想列出所有尚未付清课程费用的学生 ,即单击学生时,按月列出所有未决费用。linq选择加入的问题
这就是我迄今为止所做的...
这些都是学生的主动课程。
以下是学生付给他们课程的付款记录。
现在我想列出所有未付款的在线学生 例如最后一次付款是在2011年2月11日。如果日期时间现在是五月,那么我想展现的未付金额为
月数额
月100
月200
月400
这是我试过..
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);
}
}
上面给出的逻辑在学生没有为他的课程支付任何费用的情况下似乎没有效率,那么我必须检查自他第一次加入日期以来的待处理付款。 OtherWise我需要根据该特定的过程检查付款表中DateIssue的待定付款。请通知我们谢谢
好,我想我会继续做对(DateTime的d使用回上述方法= lastPaidDate.AddMonths(1); d.Month <= DateTime.Now.Month; d = d.AddMonths(1))。不管怎么说,还是要谢谢你。 – VeecoTech 2011-02-14 07:49:23