识别使用LINQ日期冲​​突 [英] Identifying Date Clashes using linq

查看:132
本文介绍了识别使用LINQ日期冲​​突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待,以确定使用LINQ那里有一个日期冲突行。我(在这个例子中)5列

I am looking to identify rows using linq where there is a date clash. I have (for this example) 5 columns

ID   ref_id   ref_Name   Borrow_Date  Return_Date
1    1343     Gate       13/09/2011   20/09/2011
2    1352     Door       20/09/2011   22/09/2011
3    1343     Gate       17/09/2011   21/09/2011

在这种情况下,我的'门'发生冲突是因为有人想借用它当别人也想借用它。

In this case my 'Gate' is clashing because someone wants to borrow it when someone else also wants to borrow it.

反正是有容易使用LINQ to确定日期范围的冲突?

Is there anyway to identify the date range clashes using linq easily?

推荐答案

虽然这当然是可能的,一旦他们发生数据库来识别这些冲突,岂不是更好,以prevent从借款第二人要借用时,它已安排的项目。在这种情况下,这将是检验一个简单的问题,以确保没有现有的行与1343一REF_ID有归期等于或大于新的要求借日期。

Although it is certainly possible to identify these clashes in the database once they have occurred, would it not be a better to prevent the second person from borrowing an item when it is already scheduled to be borrowed. In this case this would be a simple matter of testing to ensure no existing rows with a ref_id of 1343 have a return date equal to or greater then the new requested borrow date.

这篇关于识别使用LINQ日期冲​​突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆