19 using erminas.SmartAPI.CMS.Converter;
21 namespace erminas.SmartAPI.CMS.Project.ContentClasses.Elements
25 bool IsUserDefinedTimeFormat(
string languageAbbreviation);
27 ILanguageDependentValue<ISystemLocale> Locale {
get; }
29 ILanguageDependentValue<IDateTimeFormat> TimeFormat {
get; }
31 ILanguageDependentValue<string> UserDefinedTimeFormat {
get; }
34 internal class LanguageDependendTimeFormat : LanguageDependentValue<IDateTimeFormat>
37 : base(parent, attribute)
46 if (!value.IsTimeFormat)
48 throw new ArgumentException(
string.Format(
49 "DateTimeFormat {1} with type id {0} is not a time format", value.TypeId, value.Name));
51 base[languageAbbreviation] = value;
56 internal class StandardFieldTime : StandardFieldNonDate, IStandardFieldTime
58 internal StandardFieldTime(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
62 public bool IsUserDefinedTimeFormat(
string languageAbbreviation)
64 return TimeFormat[languageAbbreviation] == DateTimeFormat.USER_DEFINED_TIME_FORMAT;
67 [RedDot(
"eltlcid", ConverterType = typeof (LocaleConverter))]
68 public ILanguageDependentValue<ISystemLocale> Locale
70 get {
return GetAttributeValue<ILanguageDependentValue<ISystemLocale>>(); }
73 [RedDot(
"eltformatno", ConverterType = typeof (DateTimeFormatConverter))]
74 public ILanguageDependentValue<IDateTimeFormat> TimeFormat
80 GetType().GetProperty(
"TimeFormat").GetCustomAttributes(typeof (RedDotAttribute),
false).Single();
81 return new LanguageDependendTimeFormat(
this, redDotAttribute);
85 [RedDot(
"eltformatting")]
86 public ILanguageDependentValue<string> UserDefinedTimeFormat
88 get {
return GetAttributeValue<ILanguageDependentValue<string>>(); }