19 using erminas.SmartAPI.CMS.Converter;
21 namespace erminas.SmartAPI.CMS.Project.ContentClasses.Elements
25 ILanguageDependentValue<IDateTimeFormat> DateFormat {
get; }
27 ILanguageDependentReadValue<bool> IsUserDefinedDateFormat {
get; }
29 ILanguageDependentValue<ISystemLocale> Locale {
get; }
31 ILanguageDependentValue<string> UserDefinedDateFormat {
get;
set; }
34 internal class IsUserDefinedDateFromatValue : AbstractLanguageDependendReadValue<bool>
36 public IsUserDefinedDateFromatValue(IStandardFieldDate date) : base(date)
40 public override bool this[
string languageAbbreviation]
44 return ((IStandardFieldDate) Parent).DateFormat[languageAbbreviation] ==
50 internal class LanguageDependendDateFormat : LanguageDependentValue<IDateTimeFormat>
52 public LanguageDependendDateFormat(IPartialRedDotProjectObject parent, RedDotAttribute attribute)
53 : base(parent, attribute)
57 public override IDateTimeFormat
this[
string languageAbbreviation]
59 get {
return base[languageAbbreviation] ?? DateTimeFormat.USER_DEFINED_DATE_FORMAT; }
62 if (!value.IsDateFormat)
64 throw new ArgumentException(
string.Format(
65 "DateTimeFormat {1} with type id {0} is not a date format", value.TypeId, value.Name));
67 base[languageAbbreviation] = value;
72 internal class StandardFieldDate : StandardField, IStandardFieldDate
74 internal StandardFieldDate(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
78 [RedDot(
"eltformatno", ConverterType = typeof (DateTimeFormatConverter))]
79 public ILanguageDependentValue<IDateTimeFormat> DateFormat
83 return new LanguageDependendDateFormat(
this,
86 .GetProperty(
"DateFormat")
87 .GetCustomAttributes(typeof (RedDotAttribute),
false)
92 public ILanguageDependentReadValue<bool> IsUserDefinedDateFormat
94 get {
return new IsUserDefinedDateFromatValue(
this); }
97 [RedDot(
"eltlcid", ConverterType = typeof (LocaleConverter))]
98 public ILanguageDependentValue<ISystemLocale> Locale
100 get {
return GetAttributeValue<ILanguageDependentValue<ISystemLocale>>(); }
103 [RedDot(
"eltformatting")]
104 public ILanguageDependentValue<string> UserDefinedDateFormat
106 get {
return GetAttributeValue<ILanguageDependentValue<string>>(); }
107 set { SetAttributeValue(value); }