using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GreenTree.Nachtragsmanagement.Core.Configuration; using GreenTree.Nachtragsmanagement.Core.Domain.Config; namespace GreenTree.Nachtragsmanagement.Services.Configuration { public interface IConfigurationService { /// /// Reads the current configuration from the global config /// AppendixConfigurationSection GetCurrentConfiguration(); #region ConfigItem /// /// Gets all configItems /// IList GetAllConfigItems(); /// /// Gets a configItem by specified Id /// /// ConfigItem identifier. ConfigItem GetConfigItemById(int id); /// /// Gets a configItem by specified name /// /// ConfigItem name. ConfigItem GetConfigItemByName(string name); /// /// Gets all configItems to the specified ids /// IList GetConfigItemsByIds(int[] ids); /// /// Insert a configItem /// /// ConfigItem. void InsertConfigItem(ConfigItem configItem); /// /// Update a configItem /// /// ConfigItem. void UpdateConfigItem(ConfigItem configItem); /// /// Delete a configItem /// /// ConfigItem. void DeleteConfigItem(ConfigItem configItem); #endregion #region UserConfigItem /// /// Gets all userConfigItems /// IList GetAllUserConfigItems(); /// /// Gets a userConfigItem by specified Id /// /// UserConfigItem identifier. UserConfigItem GetUserConfigItemById(int id); /// /// Gets a userConfigItem by specified name and user id /// /// UserConfigItem name. /// User Id. UserConfigItem GetUserConfigItemByNameAndUserId(string name, int userId); /// /// Insert or update a userConfigItem /// /// UserConfigItem. void InsertOrUpdateUserConfigItem(UserConfigItem userConfigItem); /// /// Delete a userConfigItem /// /// UserConfigItem. void DeleteUserConfigItem(UserConfigItem userConfigItem); #endregion #region Casting /// /// Trys to convert the config items value type and returns its actual value, otherwise NULL /// /// The actual type. /// ConfigItem. /// Value, when conversion fails. T TryGetConfigItemValue(ConfigItem configItem, T defaultValue); /// /// Trys to convert the config items value type and returns its actual value, otherwise NULL /// /// The actual type. /// ConfigItem name. /// Value, when conversion fails. T TryGetConfigItemValue(string configItemName, T defaultValue); #endregion } }