EchoTex_Payroll/Ease.Core/Utility/ConfigUtility.cs
2024-10-14 10:01:49 +06:00

99 lines
3.5 KiB
C#

/*
|-------------------------------------------------------------------------------|
| Copyright © Computer Ease Limited |
| Address: 1/9 Bloack-A Lalmatia, Dhaka-1207, Bangladesh |
| Email: info@celimited.com, cease@bol-online.com, web: www.celimited.com |
| Unauthorized copy or distribution is strictly prohibited |
| Author: S. M. Russel, Last modified date: 23/07/2012 |
|-------------------------------------------------------------------------------|
*/
using System;
using System.Configuration;
using System.Collections.Specialized;
namespace Ease.Core.Utility
{
#region Framework: Configuration related class
/// <summary>
/// Summary description for ConfigUtility.
/// </summary>
//public sealed class ConfigUtility
//{
// /// <summary>
// /// If section does not exist the return instance of NameValueCollection
// /// </summary>
// /// <param name="sectionName">A valid name of section</param>
// /// <returns>Return the NameValueCollection object</returns>
// public static NameValueCollection GetConfigSettings(string sectionName)
// {
// object configSection = null; //#### ConfigurationManager.GetSection(sectionName);
// if (configSection == null|| !(configSection is NameValueCollection))
// return new NameValueCollection();
// return (NameValueCollection)configSection;
// }
// /// <summary>
// /// If section does not exist return new instance of object rather than null
// /// </summary>
// /// <param name="sectionName">A valid section in the config file</param>
// /// <returns>Return a instatnce of system.object</returns>
// public static object GetConfig(string sectionName)
// {
// object configSection = null; //#### ConfigurationManager.GetSection(sectionName);
// if (configSection == null|| !(configSection is NameValueCollection))
// return new object();
// return configSection;
// }
// /// <summary>
// /// If key does not exist in appSettings section return empty string othewise actual value
// /// </summary>
// /// <param name="keyName">A valid key from the appSettings section</param>
// /// <returns>Return string if key exist in the appSettings section else empty string </returns>
// public static string GetAppSettings(string keyName)
// {
// string configValue = null; //#### ConfigurationManager.AppSettings[keyName];
// if (string.IsNullOrEmpty(configValue))
// return string.Empty;
// return configValue;
// }
// /// <summary>
// /// Returns the a string according to specified parameter
// /// </summary>
// /// <param name="sectionName">A valid name of section</param>
// /// <param name="key">A valid name of key of given section</param>
// /// <returns>Returns string if the key exist in the key else empty string</returns>
// public static string GetConfigSetting(string sectionName, string key)
// {
// NameValueCollection configSection = ConfigUtility.GetConfigSettings(sectionName);
// if (configSection == null || configSection.Count == 0 || configSection[key].Trim().Length<=0)
// return string.Empty;
// return configSection[key];
// }
// /// <summary>
// /// Set app settings
// /// </summary>
// /// <param name="key">Valid key</param>
// /// <param name="value">value</param>
// public static void SetAppSettings(string key, string value)
// {
// //#### ConfigurationManager.AppSettings.Set(key, value);
// }
// /// <summary>
// /// Hide the constructor
// /// </summary>
// private ConfigUtility(){}
//}
#endregion
}