예제 #1
0
        private  string  GetConnectionString()
        {
            try
            {
                
                if (!string.IsNullOrEmpty(_ExchangeConnectionString))
                {
                    return _ExchangeConnectionString;
                }

                string strConnectionString=string.Empty;
                if (BMCRegistryHelper.IsExchange())
                {
                    Logger.Debug("DataAdapter", "GetConnectionString", "Reading Exchange connection string ");
                    strConnectionString = DatabaseHelper.GetExchangeConnectionString();
                }
                else
                {
                    Logger.Debug("DataAdapter", "GetConnectionString", "Reading Enterprise connection string ");
                    strConnectionString = DatabaseHelper.GetEnterpriseConnectionString();

                }

                if (strConnectionString.ToUpper().Contains("SERVER"))
                    _ExchangeConnectionString = strConnectionString;
                else
                    throw new Exception("Error Decrypting Registry");

            }
            catch (Exception ex)
            {
                if (ex.Message == "Connectionstring Not Found.")
                    throw ex;
                else
                    ExceptionManager.Publish(ex);
            }
            return _ExchangeConnectionString;
        }