Пример #1
0
        private static string GetConnection()
        {
            netConnect.Info info    = new netConnect.Info();
            string          DSNName = "BigM1DMStaging";
            string          setting = ConfigurationManager.AppSettings["Environment"];

            if (string.IsNullOrEmpty(setting))
            {
                setting = string.Empty;
            }
            else
            {
                if (!setting.EndsWith("."))
                {
                    setting += ".";
                }
            }
            string sAppName  = ConfigurationManager.AppSettings["NetConnect.ApplicationName"];
            string sCertName = ConfigurationManager.AppSettings[setting + "NetConnect." + DSNName + ".CertificateName"];

            if (sCertName == null)
            {
                sCertName = ConfigurationManager.AppSettings["NetConnect." + DSNName + ".CertificateName"];
                if (sCertName == null)
                {
                    sCertName = ConfigurationManager.AppSettings[setting + "NetConnect.CertificateName"];
                    if (sCertName == null)
                    {
                        sCertName = ConfigurationManager.AppSettings["NetConnect.CertificateName"];
                    }
                }
            }
            return(info.Get(DSNName, sAppName, sCertName, netConnect.ConnectTypeEnum.CONNECT_TYPE_NET));
        }
Пример #2
0
        /// <summary>
        /// Get the login information from Nimitz and update args for R
        /// </summary>
        private string[] GetConnectionLogin(string[] args)
        {
            netConnect.Info info      = new netConnect.Info();
            string          DSNName   = ConfigurationManager.AppSettings["DBServer"];
            string          setting   = ConfigurationManager.AppSettings["Environment"];
            string          sAppName  = ConfigurationManager.AppSettings["NetConnect.ApplicationName"];
            string          sCertName = ConfigurationManager.AppSettings[setting + ".NetConnect.CertificateName"]; //ConfigurationManager.AppSettings[setting + "NetConnect." + DSNName + ".CertificateName"];

            SqlConnectionStringBuilder conBuilder = new SqlConnectionStringBuilder(info.Get(DSNName
                                                                                            , sAppName
                                                                                            , sCertName
                                                                                            , netConnect.ConnectTypeEnum.CONNECT_TYPE_NET));

            string[] finalArgs = new string[args.Length + 2];
            finalArgs[0] = conBuilder.UserID;
            finalArgs[1] = conBuilder.Password;
            Array.Copy(args, 0, finalArgs, 2, args.Length);

            return(finalArgs);
        }