Hi,
If I have a Server/Client application which uses WinSchedule & UltraDayView and it is operated in two different timezones..... how can I ignore the timezones???
Eg: Server Timezone = UTC +5 hours Client #1 Timezone = UTC +5 hours Client #2 Timezone = UTC +6 hours
When Client #1 makes an appointment at 8AM....it appears on Client#2 to be at 9AM. Obviously the appointments start/end time is relative to each Client computer..... but how can I stop this happening....
If they make an appointment at 8 at one location then I want it to appear at 8 at all locations REGARDLESS of timezone settings on thier computer?
Unfortunately.... unlike the "UltraWebInfo" there does not seem to be a TimezoneOffset setting.
Any ideas?
regardsAaron
See UltraCalendarInfo.DataBindingsForAppointments.DateMembersSerializationMode
Thanks for your previous post Brian.
I am having a massive problem though... :(
The Problem although it is not an exactly an Infragistics Issue... it is a very relevant problem for users of your controls (the scheduling controls)
The Problem
When you pass an object of the DataSet class to a remote Web service or to a Web service that is in a time zone that is different from the time zone of the calling application, the DateTime columns in a contained table are converted to the equivalent local time. The DateTime columns are converted because the System.Data.DataSet code adjusts to the equivalent local time according to the time zone of the remote computer. For example, if a value of 5:00 is passed from a client computer in Pacific Time to a Web service in Eastern Time, the value in the DataSet object changes to 8:00 in the receiving method of the Web service. This article describes how to work around this problem by passing the time zone information from the client application to the Web service and by adjusting the DateTime columns at the remote computer. The System.Data is the namespace that contains the DataSet class.
The Following article from Microsoft explains this in detail including a workaround. But I have READ and READ and READ this article but still don't know how to implement the workaround.
http://support.microsoft.com/default.aspx?scid=kb;en-us;842545
Unfortunately simply doing the following didn't help me :-(
Brian Fallon"]See UltraCalendarInfo.DataBindingsForAppointments.DateMembersSerializationMode
It seems to be default behaviour anyway. and doing a DateSerializationMode.SerializeDatesAsUniversalTime seemed to screw up the appointments completely.
Somewhere in your library of code... do you have an implementation of a workaround that will solve my problem?
Consider my environment as such
Database --> .NET Remoting --> {{{{{INTERNET}}}}}}} --> Client
The Dataset is created on the SERVER.... NOT on the client as the microsoft article seems to demonstrate.
Any help/advice is greatly appreciated!!!!!!!!!!!!!!!!!
Regards
Aaron
The general solution to this problem is to use the DateTimeKind functionality that was added with CLR2.0. Since you are pushing these DataSets out from the server, and thus have control over that data, you can make sure that all DateTime structs contained therein are marked as being expressed as universal time, i.e., the DateTimeKind is set to 'Utc'. One of the DateTime constructors takes this enumeration as a parameter, so instead of making the server data specific to a particular time zone, make it use universal time for all dates, and push the responsibility of converting those dates to local time down to the client. You would then want to use universal time for the WinSchedule date serialization as well.
Hi Brian,
The solution *I THINK* was to do the following
... ... ...
For Each col As DataColumn In dt.Columns If col.DataType Is GetType(System.DateTime) Then col.DateTimeMode = DataSetDateTime.Unspecified End If Next
Each time I create a datatable on the server... run through the following code and set each datacolumn DATETIMEMODE that has a datatype of DateTime to "UNSPECIFIED"
As intellisense shows.... When using this mode 'Serialization in this mode does not cause an offset"
In the Calinfo.DataBindingsForAppointments I left the DateSerializationMode = LocalTime and it all seems to work perfectly....
Is there anything wrong with what I have done?
RegardsAaron
Hi!!!!!!!!!
I m also having the same problem.When I save my data from one time zone.And then when I fetch saved data from some other time zone.Then it is converted to Local time.I want to prevent it.I want to load the original saved data regardless to the client time zone.Please help me.
I checked ur code to set the DateTimeMode as unspecified.But it is not working correctly.
Also please tell me the use of Calinfo.DataBindingsForAppointments??????????????????
Thanx in advance.
I don't know why you would still be having these issues.
Here are my subroutines which fix the problem.
' Returns an ADO.NET DataSet. 'Generic GETDATA. Returns Dataset Public Function GetDataSet(ByVal szSQL As String) As DataSet Try Dim sqlConn As SqlConnection = OpenDatabase() With sqlConn Dim SQLcommand As SqlCommand = New SqlCommand(szSQL, sqlConn) Dim adapter As SqlDataAdapter = New SqlDataAdapter(szSQL, sqlConn) Dim ds As DataSet = New DataSet Try adapter.Fill(ds) CloseDatabase(sqlConn) SetDateColumnsSerializationMode(ds) Return ds Catch ex As Exception Return Nothing Finally CloseDatabase(sqlConn) End Try End With Catch ex As Exception Return Nothing End Try End Function
Private Overloads Sub SetDateColumnsSerializationMode(ByRef ds As DataSet) Try If ds IsNot Nothing Then For Each dt As DataTable In ds.Tables SetDateColumnsSerializationMode(dt) Next Else Throw New Exception("Passed Dataset = NOTHING. Can't set date columns serialization on columns which do not exist.") End If Catch ex As Exception LogException(Ex) Throw Ex End Try End Sub
Private Overloads Sub SetDateColumnsSerializationMode(ByRef dt As DataTable) Try If dt IsNot Nothing Then For Each col As DataColumn In dt.Columns If col.DataType Is GetType(System.DateTime) Then col.DateTimeMode = DataSetDateTime.Unspecified End If Next End If Catch ex As Exception LogException(ex) Throw New Exception("Unable to set Date Column Serialization. Original Message = " & ex.Message, ex.InnerException) End Try End Sub
So as you can see... In my generic GetData routine... before the function returns the dataset it sets the DateTimeMode for each DateTime column in the dataset/datatable.
Copy and paste and see how you go.
As for your other question about how to use the DataBindingsForAppointments you should open up a NEW Thread, but before you do that have a quick search in the forum for posts that already exist relating to this very question and/or refer to the Database Demo and Documentation.
Thanks Aaron .
This solved my problem.
Thanks a lot.I spent many hours over this issue.Now with ur help I solved it.
Thanks again.