/// <summary>
        /// Instantiates a new instance of the DictionaryDataItem class
        /// specifying the text for the default user interface language ID.
        /// </summary>
        /// <param name="key">The variant name to consider.</param>
        /// <param name="text">The text to consider.</param>
        public static DictionaryDataItem CreateDictionary(string key, string text)
        {
            DictionaryDataItem dictionary = new DictionaryDataItem();

            dictionary.Set(key, text);

            return(dictionary);
        }
Esempio n. 2
0
 /// <summary>
 /// Instantiates a new instance of the TitledDataItem class considering the specified preffix name.
 /// </summary>
 /// <param name="name">The name of this instance.</param>
 /// <param name="title">The title of this instance.</param>
 /// <param name="namePreffix">The preffix of the name of this instance.</param>
 /// <param name="id">The ID to consider.</param>
 public TitledDataItem(
     string name,
     string title,
     string namePreffix = "",
     string id          = null)
     : base(name, namePreffix, id)
 {
     if (title != null)
     {
         Title = ItemFactory.CreateDictionary(title);
     }
 }
Esempio n. 3
0
        // --------------------------------------------------
        // CLONING
        // --------------------------------------------------

        #region Cloning

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Returns a cloned instance.</returns>
        public override object Clone(params string[] areas)
        {
            DictionaryDataItem item = base.Clone(areas) as DictionaryDataItem;

            item._availableKeys = new List <string>(_availableKeys);
            item._values        = new List <DataKeyValue>();
            foreach (DataKeyValue dataKeyValue in _values)
            {
                item.Add(dataKeyValue.Clone() as DataKeyValue);
            }

            return(item);
        }
Esempio n. 4
0
        // --------------------------------------------------
        // ACCESSORS
        // --------------------------------------------------

        #region Accessors

        /// <summary>
        /// Indicates whether this intance equals the specified dictionary.
        /// </summary>
        /// <param name="dictionary">The dictionar to consider.</param>
        /// <returns>Returns true if this instance equals the specified dictionary. False otherwise.</returns>
        public bool Equals(DictionaryDataItem dictionary)
        {
            if (dictionary == null || Values.Count != dictionary.Values.Count)
            {
                return(false);
            }

            var isEqual = true;

            foreach (var value in Values)
            {
                isEqual &= value.Content == dictionary[value.Key];
            }

            return(isEqual);
        }
Esempio n. 5
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        /// <param name="item">The item to consider.</param>
        /// <param name="specificationAreas">The specification areas to consider.</param>
        /// <param name="updateModes">The update modes to consider.</param>
        /// <returns>Log of the operation.</returns>
        /// <remarks>Put reference collections as null if you do not want to repair this instance.</remarks>
        public override IBdoLog Update <T1>(
            T1 item = default,
            string[] specificationAreas = null,
            UpdateModes[] updateModes   = null)
        {
            var log = new BdoLog();

            base.Update(item, specificationAreas, updateModes);

            if (item is TitledDataItem titledDataItem)
            {
                Title = ItemFactory.CreateDictionary(titledDataItem.Title);
            }

            return(log);
        }
Esempio n. 6
0
        /// <summary>
        /// Instantiates a new instance of the DescribedDataItem class considering the specified preffix name.
        /// </summary>
        /// <param name="name">The name of this instance.</param>
        /// <param name="title">The title of this instance.</param>
        /// <param name="description">The description of this instance.</param>
        /// <param name="namePreffix">The preffix of the name of this instance.</param>
        /// <param name="id">The ID to consider.</param>
        public DescribedDataItem(
            string name,
            string title,
            string description,
            string namePreffix = "",
            string id          = null)
            : base(name, namePreffix, id)
        {
            if (title != null)
            {
                Title = ItemFactory.CreateDictionary(title);
            }

            if (description != null)
            {
                Description = ItemFactory.CreateDictionary(description);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Sets the title text.
        /// </summary>
        /// <param name="key">The key to consider.</param>
        /// <param name="text">The text to consider.</param>
        public ITitledDataItem WithTitle(string key = "*", string text = "*")
        {
            (Title ?? (Title = new DictionaryDataItem())).Set(key, text);

            return(this);
        }
Esempio n. 8
0
        /// <summary>
        /// Adds the title text.
        /// </summary>
        /// <param name="key">The key to consider.</param>
        /// <param name="text">The text to consider.</param>
        public ITitledDataItem AddTitle(string key, string text)
        {
            (Title ?? (Title = new DictionaryDataItem())).Add(key, text);

            return(this);
        }
Esempio n. 9
0
        /// <summary>
        /// Adds the title text.
        /// </summary>
        /// <param name="key">The key to consider.</param>
        /// <param name="text">The text to consider.</param>
        public IDescribedDataItem AddDescription(string key, string text)
        {
            (Description ?? (Description = new DictionaryDataItem())).Add(key, text);

            return(this);
        }
Esempio n. 10
0
        /// <summary>
        /// Sets the title text.
        /// </summary>
        /// <param name="key">The key to consider.</param>
        /// <param name="text">The text to consider.</param>
        public IDescribedDataItem WithDescription(string key = "*", string text = "*")
        {
            (Description ?? (Description = new DictionaryDataItem())).Set(key, text);

            return(this);
        }