If DateDiff(DateInterval.Day, moDoBooking.m_CurrentDay, moDoBooking.m_BaseDay) _
> DateDiff(DateInterval.Day, DateAdd(DateInterval.Day, _
Convert.ToDouble(moDoBooking.oBooking.oFacility.ADAYS), moDoBookin开发者_运维百科g.m_BaseDay), _
moDoBooking.m_BaseDay) Then
This condition won't satisfy with these values:
moDobooking.m_CurrentDay = 2/3/2011
moDobooking.m_BaseDay = 22/02/2011
moDoBooking.oBooking.oFacility.ADAYS = 1
You might say this is dead-easy but honestly it's late here and my head is not working at all! Could AnyOne tell me why is that?
I would expect your boolean condition to always return false.
Why? Because the difference in days between two days will always be less than the difference + 1.
I'm not sure what you are looking for but I suspect the sign is opposite what you expect because the values are negative. As someone previously mentioned your if statement is obfuscated. Do yourself a favor and create interim variables to hold the values and then compare. You need at least 3 more variables before it will become obvious what you are trying to do.
精彩评论