2007-12-14, 09:25 AM
Hi,
I think I found a (localisation) bug in ManualRecord.aspx.cs. My system is located in Germany thus the DateTime format differs from the English/American one. Setting up a manual recording fails with an error message (the error message is taken from ManualRecord2.aspx.cs, because I already implemented a workaround in ManualRecord.aspx.cs):
The German DateTime formats are dd.MM.yyyy and HH.mm respectively. Therefore I changed the lines 66 and 70 in ManualRecord.aspx.cs from
to
This works for me until the next update, but I hope C# provides a method to get the local defaults (as in the date picker for example) and so a more generic way to solve the problem.
Greetings
MediaDept
I think I found a (localisation) bug in ManualRecord.aspx.cs. My system is located in Germany thus the DateTime format differs from the English/American one. Setting up a manual recording fails with an error message (the error message is taken from ManualRecord2.aspx.cs, because I already implemented a workaround in ManualRecord.aspx.cs):
Code:
Server Error in '/gbpvr' Application.
String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: String was not recognized as a valid DateTime.
Source Error:
Line 55:
Line 56: //Set the start time for for programme to record
Line 57: DateTime fullStartDate = System.Convert.ToDateTime(startDate.SelectedDate.ToString("MM/dd/yyyy") + " " + startTime.SelectedTime.ToString("hh:mm tt"));
Line 58: dummyPgm.setStartTime(fullStartDate);
Line 59:
Source File: c:\Program Files\devnz\gbpvr\web\ManualRecord2.aspx.cs Line: 57
Stack Trace:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2228162
System.DateTime.Parse(String s, IFormatProvider provider) +26
System.Convert.ToDateTime(String value) +86
gbweb.ManualRecord2.LinkButton1_Click(Object sender, EventArgs e) in c:\Program Files\devnz\gbpvr\web\ManualRecord2.aspx.cs:57
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +75
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +172
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4885
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
The German DateTime formats are dd.MM.yyyy and HH.mm respectively. Therefore I changed the lines 66 and 70 in ManualRecord.aspx.cs from
Code:
[66] DateTime fullStartDate = System.Convert.ToDateTime(startDate.SelectedDate.ToString("MM/dd/yyyy") + " " + startTime.SelectedTime.ToString("hh:mm tt"));
[...]
[70] DateTime fullEndDate = Convert.ToDateTime(startDate.SelectedDate.ToString("MM/dd/yyyy") + " " + endTime.SelectedTime.ToString("hh:mm tt"));
to
Code:
[66] DateTime fullStartDate = System.Convert.ToDateTime(startDate.SelectedDate.ToString("dd.MM.yyyy") + " " + startTime.SelectedTime.ToString("HH:mm"));
[...]
[70] DateTime fullEndDate = Convert.ToDateTime(startDate.SelectedDate.ToString("dd.MM.yyyy") + " " + endTime.SelectedTime.ToString("HH:mm"));
This works for me until the next update, but I hope C# provides a method to get the local defaults (as in the date picker for example) and so a more generic way to solve the problem.
Greetings
MediaDept