获取不在两个日期范围之间的记录(开始和结束)
我有一个收集列表,其中最后付款是一个字段。我想在给定的开始日期和结束日期内使用付费和未付款过滤日期。
我所取得的成就是通过
var filterDate = paymentData
.Where(value => value.district != null && (Convert.ToDateTime(value.last_payment_date) >=
Convert.ToDateTime(startdate) && Convert.ToDateTime(value.last_payment_date) < Convert.ToDateTime(enddate))
).ToList();
上述代码获得所有付费客户的开始日期和结束日期,将过滤,并给我所有在 start 和 EndDate 中付费的客户。
但是,我的挑战是获得反向,这使所有未在开始和 enddate 中获得的客户。
我可以在linq中使用不表达吗?如何调整代码以使我相反?
I have a collection list with Lastpayment as a field. Using a date picker i want to filter by Paid and not paid within a given start date and end date.
what i have achieved is getting All paid customers with a start date and end date using
var filterDate = paymentData
.Where(value => value.district != null && (Convert.ToDateTime(value.last_payment_date) >=
Convert.ToDateTime(startdate) && Convert.ToDateTime(value.last_payment_date) < Convert.ToDateTime(enddate))
).ToList();
the above code will filter and give me all customers that have paid within a start and enddate.
However, my challenge is getting the Reverse which is getting all customers that have NOT PAID within a start and enddate.
Can i use a NOT IN expression in LINQ?. How can i adjust my code to give me the reverse ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论