17 using System.Globalization;
19 using erminas.SmartAPI.CMS.Project.ContentClasses.Elements;
20 using erminas.SmartAPI.Utils;
22 namespace erminas.SmartAPI.CMS.Project.Pages.Elements
34 internal StandardFieldTime(
IProject project, XmlElement xmlElement) : base(project, xmlElement)
39 : base(project, guid, languageVariant)
43 public override void Commit()
48 Project.ExecuteRQL(
string.Format(SAVE_VALUE, Guid.ToRQLString(),
49 _value.Hours/24.0 + _value.Minutes/(24.0*60.0) +
50 _value.Seconds/(24.0*60.0*60.0), (int)
ElementType));
56 protected override TimeSpan FromString(
string value)
60 return DateTime.Parse(value, CultureInfo.InvariantCulture).TimeOfDay;
61 }
catch (FormatException e)
63 throw new ArgumentException(
string.Format(
"Invalid time value: {0}", value), e);
67 protected override TimeSpan FromXmlNodeValue(
string value)
69 return value.ToOADate().TimeOfDay;
72 protected override string GetXmlNodeValue()
74 if (Value ==
default(TimeSpan))
78 var date =
new DateTime(0, 0, Value.Days, Value.Hours, Value.Minutes, Value.Seconds);
79 return date.ToOADate().ToString(CultureInfo.InvariantCulture);
82 protected override void LoadWholeStandardField()