Beispiel #1
0
 public MLSValue(MultilingualString owner, MLSValue value)
 {
     this.Owner        = owner;
     this.LanguageCode = value.LanguageCode;
     this.Value        = value.Value;
     this.UpdatedTS    = DateTime.Now;
 }
 public MultilingualString(MLSValue mlsValue)
 {
     this.code = "";
     if (values == null)
     {
         values = new List <MLSValue>();
     }
     values.Add(mlsValue);
 }
        public static MultilingualString CreateMLS(String[] languageCodes, String[] texts)
        {
            MultilingualString mls = new MultilingualString();

            for (int i = 0; i < languageCodes.Length; i++)
            {
                MLSValue mlsValue = new MLSValue(mls, languageCodes[i], texts[i]);
                mls.Values.Add(mlsValue);
            }
            return(mls);
        }
        //[XmlIgnore]
        //public virtual Context Context { get; set; }

        public virtual void AddOrReplace(MLSValue mlsValue)
        {
            foreach (MLSValue v in values)
            {
                if (v.LanguageCode == mlsValue.LanguageCode)
                {
                    v.Value = mlsValue.Value;
                    return;
                }
            }
            Values.Add(mlsValue);
        }
        public MultilingualString(Dictionary <String, String> dic)
        {
            this.code   = "";
            this.Values = new List <MLSValue>();

            DateTime updatedTS = DateTime.Now;

            foreach (string lang in dic.Keys)
            {
                MLSValue valueTH = new MLSValue(this, lang, dic[lang]);
                this.Values.Add(valueTH);
            }
        }