using System;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.InteropServices; 

namespace Municipalidad.Utils {
	
	public enum eConnectionString
	{
		Tesoreria, 
		AyudaSocial,
		Personal,
		Seguridad,
		Menumed,
		Biometrica,
		Contabilidad,
		DatosDBFTesoreria,
		Sitma,
		AvanceSocial,
		CartasRespaldo,
		DerechosAseo,
		Remuneraciones,
		Empresa
	}

	/// <summary>
	/// 
	/// </summary>
	public class UtilsConnectionManager
	{
		// Fields
		private static eConnectionString _enumstrConn;
		private static string _connectionString;		

		/// <summary>
		/// 
		/// </summary>
		/// <param name="enStrconn"></param>
		public static string GetConnection(eConnectionString enStrconn)
		{
			if(!enStrconn.Equals(_enumstrConn) || _connectionString == null)
			{
				_enumstrConn = enStrconn;				
				
				NameValueCollection config = (NameValueCollection)ConfigurationSettings.GetConfig("connectionString/strings");
				
				_connectionString = config[enStrconn.ToString()].ToString();
				//_connectionString = UtilsEncDesc.Desencriptar(_connectionString,"IlustreMunicipalidaddeMaipu"); 
			}

			return _connectionString;
		}
	}
}