| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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
- {
- /// <summary>
- /// Reads the current configuration from the global config
- /// </summary>
- AppendixConfigurationSection GetCurrentConfiguration();
- #region ConfigItem
- /// <summary>
- /// Gets all configItems
- /// </summary>
- IList<ConfigItem> GetAllConfigItems();
- /// <summary>
- /// Gets a configItem by specified Id
- /// </summary>
- /// <param name="id">ConfigItem identifier.</param>
- ConfigItem GetConfigItemById(int id);
- /// <summary>
- /// Gets a configItem by specified name
- /// </summary>
- /// <param name="name">ConfigItem name.</param>
- ConfigItem GetConfigItemByName(string name);
- /// <summary>
- /// Gets all configItems to the specified ids
- /// </summary>
- IList<ConfigItem> GetConfigItemsByIds(int[] ids);
- /// <summary>
- /// Insert a configItem
- /// </summary>
- /// <param name="configItem">ConfigItem.</param>
- void InsertConfigItem(ConfigItem configItem);
- /// <summary>
- /// Update a configItem
- /// </summary>
- /// <param name="configItem">ConfigItem.</param>
- void UpdateConfigItem(ConfigItem configItem);
- /// <summary>
- /// Delete a configItem
- /// </summary>
- /// <param name="configItem">ConfigItem.</param>
- void DeleteConfigItem(ConfigItem configItem);
- #endregion
- #region UserConfigItem
- /// <summary>
- /// Gets all userConfigItems
- /// </summary>
- IList<UserConfigItem> GetAllUserConfigItems();
- /// <summary>
- /// Gets a userConfigItem by specified Id
- /// </summary>
- /// <param name="id">UserConfigItem identifier.</param>
- UserConfigItem GetUserConfigItemById(int id);
- /// <summary>
- /// Gets a userConfigItem by specified name and user id
- /// </summary>
- /// <param name="name">UserConfigItem name.</param>
- /// <param name="userId">User Id.</param>
- UserConfigItem GetUserConfigItemByNameAndUserId(string name, int userId);
- /// <summary>
- /// Insert or update a userConfigItem
- /// </summary>
- /// <param name="userConfigItem">UserConfigItem.</param>
- void InsertOrUpdateUserConfigItem(UserConfigItem userConfigItem);
- /// <summary>
- /// Delete a userConfigItem
- /// </summary>
- /// <param name="userConfigItem">UserConfigItem.</param>
- void DeleteUserConfigItem(UserConfigItem userConfigItem);
- #endregion
- #region Casting
- /// <summary>
- /// Trys to convert the config items value type and returns its actual value, otherwise NULL
- /// </summary>
- /// <typeparam name="T">The actual type.</typeparam>
- /// <param name="configItem">ConfigItem.</param>
- /// <param name="defaultValue">Value, when conversion fails.</param>
- T TryGetConfigItemValue<T>(ConfigItem configItem, T defaultValue);
- /// <summary>
- /// Trys to convert the config items value type and returns its actual value, otherwise NULL
- /// </summary>
- /// <typeparam name="T">The actual type.</typeparam>
- /// <param name="configItemName">ConfigItem name.</param>
- /// <param name="defaultValue">Value, when conversion fails.</param>
- T TryGetConfigItemValue<T>(string configItemName, T defaultValue);
- #endregion
- }
- }
|