DateTime field not accepting time


Author
Message
Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
We've created a scheduling application that stores a scheduled begin time and end time in the database. Both are System.DateTime values in .NET and datetime values in the database.

When updating the values, everything gets updated fine until I get to the begin time. If I set the value, the business object loses it's index and updates a different record with the correct date, but a midnight time.

For example, if StartTime is '2/25/2008 8:30 AM' and EndTime is '2/25/2008 2:00 PM' then after this:

if (CurrentScheduleDetailBO.NavigateToPrimaryKey(e.ScheduledEmployee.ScheduleDetailId, e.ScheduledEmployee.ScheduleId))

{
if (CurrentScheduledEmployeeBO.NavigateToPrimaryKey(e.ScheduledEmployee.EmployeeNumber, e.ScheduledEmployee.ScheduleId))
{

CurrentScheduleDetailBO.BeginMoment = startTime;
CurrentScheduleDetailBO.EndTime = endTime ;

// alternately, this does the same thing.
Runtime.
Static.CurrentScheduleDetailBO.CurrentRow["BeginMoment"] = startTime;
Runtime.
Static.CurrentScheduleDetailBO.CurrentRow["EndMoment"] = endTime ;

BeginMoment is '8/25/2008 12:00 AM' and the EndMoment is correct at '8/25/2008 2:00 PM'.

There are no triggers in the underlying datastore, nor are there any business rules that I can tell. EndMoment and every other datetime field I set is doing correctly. It's just the BeginMoment that is causing the problem.

____________________
Programmer/Analyst
Captain D's, LLC

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Set a break point in the Set of the property that represents the DateTime and step into it.  You should have the source code, so you can build the source in debug mode, and then you step into the Set you shold be able to see anything that SF is doing. 
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Hey...do you have a sort or filter set on the BO?  I see that you are changing the CurrentRow property directly as well...since you mentioned that the CurrentIndex is moving, the only way it would move when you set a value is if you have a filter or sort set and this is part of the filter or sort, so the index is going to move in this case.  If you remove the sort or filter, then try it, I am sure that the index will not move.  The only other way the index would move is if you have a Changed or Changing event that is being handled and moving the row position.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search