Exemple #1
0
        public static string GetConnectionString()
        {
            var xk = new KryptoLib.X509Krypto();

            return(xk.GetKTextConnectionString("MicrosoftMgmtSvcCmpContext",
                                               "MicrosoftMgmtSvcCmpContextPassword"));
        }
Exemple #2
0
 public static string GetConnectionString()
 {
     using (var xk = new KryptoLib.X509Krypto())
     {
         return(xk.GetKTextConnectionString("CMPContext",
                                            "CMPContextPassword"));
     }
 }
Exemple #3
0
 private string GetCmpContextConnectionStringFromConfig()
 {
     try
     {
         var xk = new KryptoLib.X509Krypto(null);
         return(xk.GetKTextConnectionString("CMPContext", "CMPContextPassword"));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Exemple #4
0
        //********************************************************************
        ///
        /// <summary>
        /// Ugly code, does not belong here. Belongs in a lib. Should remove
        /// this when we solve the big 'method not returning' bug
        /// </summary>
        /// <returns></returns>
        ///
        //********************************************************************

        private string GetCmpContextConnectionStringFromConfig()
        {
            try
            {
                var xk = new KryptoLib.X509Krypto(null);
                return(xk.GetKTextConnectionString("CMPContext", "CMPContextPassword"));
            }
            catch (Exception ex)
            {
                if (null != _eventLog)
                {
                    _eventLog.WriteEntry("Exception when reading CMPContext connection string : " +
                                         ex.Message, EventLogEntryType.Error, 100, 100);
                }

                return(null);
            }
        }
Exemple #5
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        ///
        //*********************************************************************

        void InitCmpContextConnectionString()
        {
            try
            {
                var XK = new KryptoLib.X509Krypto(null);
                Controllers.VmDeploymentsController.cmpDbConnectionString =
                    XK.GetKTextConnectionString("CMPContext", "CMPContextPassword");
                Controllers.VmMigrationsController.cmpDbConnectionString =
                    Controllers.VmDeploymentsController.cmpDbConnectionString;
            }
            catch (Exception ex)
            {
                if (null != _EventLog)
                {
                    _EventLog.WriteEntry("Exception when reading CMPContext connection string : " +
                                         ex.Message, EventLogEntryType.Error, 100, 100);
                }
            }
        }
Exemple #6
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        ///
        //*********************************************************************

        private void GetDbConnectionString()
        {
            try
            {
                var xk = new KryptoLib.X509Krypto(null);
                _cmpDbConnectionString = xk.GetKTextConnectionString(
                    "CMPContext", "CMPContextPassword");

                if (null == _cmpDbConnectionString)
                {
                    if (null != _eventLog)
                    {
                        _eventLog.WriteEntry(
                            "Startup Exception: Unable to get DB connection string. Check the .config file 'CMPContext' and 'CMPContextPassword' keys",
                            EventLogEntryType.Error, 10, 10);
                    }
                    return;
                }

                if (null != _eventLog)
                {
                    _eventLog.WriteEntry("CMP DB Connection string : " +
                                         GetClippenConnectionString(_cmpDbConnectionString),
                                         EventLogEntryType.Information, 1, 1);
                }
            }
            catch (Exception ex)
            {
                if (null != _eventLog)
                {
                    _eventLog.WriteEntry(
                        "Startup Exception: Exception in GetDbConnectionString() CMP : " +
                        CmpInterfaceModel.Utilities.UnwindExceptionMessages(ex),
                        EventLogEntryType.Error, 10, 10);
                }
            }
        }
Exemple #7
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        ///
        //*********************************************************************

        private void GetDbConnectionString()
        {
            try
            {
                var xk = new KryptoLib.X509Krypto(null);
                _cmpDbConnectionString = xk.GetKTextConnectionString(
                    "CMPContext", "CMPContextPassword");

                if (null == _cmpDbConnectionString)
                {
                    if (null != _eventLog)
                    {
                        _eventLog.WriteEntry(
                            "Startup Exception: Unable to get DB connection string. Check the .config file 'CMPContext' and 'CMPContextPassword' keys",
                            EventLogEntryType.Error, 10, 10);
                    }
                    return;
                }

                if (null != _eventLog)
                {
                    _eventLog.WriteEntry("CMP DB Connection string : " +
                                         GetClippenConnectionString(_cmpDbConnectionString),
                                         EventLogEntryType.Information, 1, 1);
                }
            }
            catch (Exception ex)
            {
                if (null != _eventLog)
                {
                    _eventLog.WriteEntry(
                        "Startup Exception: Exception in GetDbConnectionString() CMP : " +
                        CmpInterfaceModel.Utilities.UnwindExceptionMessages(ex),
                        EventLogEntryType.Error, 10, 10);
                }
            }

            //*** Uncomment for AFTS support ***

            /*try
             * {
             *  var xk = new KryptoLib.X509Krypto(null);
             *  _aftsDbConnectionString = xk.GetKTextConnectionString(
             *      "AzureFileTransferContext", "AzureFileTransferContextPassword");
             *
             *  if (null == _aftsDbConnectionString)
             *  {
             *      if (null != _eventLog)
             *          _eventLog.WriteEntry(
             *              "Startup Exception: Unable to get AFTS DB connection string. Check the .config file 'AzureFileTransferContext' and 'AzureFileTransferContextPassword' keys",
             *              EventLogEntryType.Error, 10, 10);
             *      return;
             *  }
             *
             *  if (null != _eventLog)
             *      _eventLog.WriteEntry("AFTS DB Connection string : " +
             *          GetClippenConnectionString(_cmpDbConnectionString),
             *          EventLogEntryType.Information, 1, 1);
             * }
             * catch (Exception ex)
             * {
             *  if (null != _eventLog)
             *      _eventLog.WriteEntry(
             *          "Startup Exception: Exception in GetDbConnectionString() AFTS : " +
             *          CmpInterfaceModel.Utilities.UnwindExceptionMessages(ex),
             *          EventLogEntryType.Error, 10, 10);
             * }*/
        }