Exemplo n.º 1
0
        //		//This routine will build an Oracle connection string from the shared database password file
        public static string GetConnectionString(string databaseSetting, string userSetting)
        {
            string databaseName = "";
            string userID       = "";
            string password     = "";
            string connectionString;

            databaseName = ConfigurationManager.AppSettings.Get(databaseSetting);
            userID       = ConfigurationManager.AppSettings.Get(userSetting); //The user id is stored in the configuration file
            password     = SharedPassword.GetPassword(databaseName, userID);  //Retreive the password from the shared password database
            //this connectionstring is only for OracleClient style
            connectionString = "Data Source=" + databaseName + ";User ID=" + userID + ";Password="******"Provider=OraOLEDB.Oracle.1;Password="******";"+"Persist Security Info=True;User ID="+userID+";"+"Data Source="+databaseName+";Extended Properties=";  //Create the connection string dynamically
            return(connectionString.ToString());
        } //end of this method
Exemplo n.º 2
0
        // 03/07/2014 OCP 57515 RSNAP II: Jun Lee
        // Using Password Web Service, this routine returns the password for the database and user id passed
        public static string GetPassword(string databaseName, string userID)
        {
            return(SharedPassword.GetPassword(databaseName, userID));

            //string passwordResult = "";
            //string strDefaultPath = "";

            //strDefaultPath = GSA.R7BD.Utility.Utilities.getDrivePathByLetter("MSCTL32:");
            //strDefaultPath += "\\MSCTL32.TLB";
            //try {	//get it from xml file
            //    //passwordResult = SharedPassword.GetPassword(databaseName.Trim(), userID.Trim(), "d:\\components\\MSCTL32.TLB");
            //    passwordResult = SharedPassword.GetPassword(databaseName.Trim(), userID.Trim(), strDefaultPath);
            //    //if not found in XML file then get ftom SAN box
            //    if (passwordResult == "") {
            //        passwordResult = SharedPassword.GetPassword(databaseName.Trim(), userID.Trim());
            //    }
            //}
            //catch (System.Exception e) {
            //    Console.Write(e.Message);
            //}
            //return passwordResult;
        } //end of this method
Exemplo n.º 3
0
        //public static string GetWebNowUrl()
        //{
        //    string hostUrl = string.Empty;
        //    string username = string.Empty;
        //    string password = string.Empty;
        //    string database = string.Empty;

        //    try
        //    {
        //        hostUrl = getDrivePathByLetter("GSAWEBNOW:");
        //        database = getDBConfigValueByLetter("IMAGENOWDB:");
        //        username = getDBConfigValueByLetter("IMAGENOWUSER:"******"&username="******"&password="******"GSA.R7BD.Utility", "Utilities", "GetWebNowUrl", exp.Message.ToString());
        //    }
        //    return hostUrl;
        //}

        public static Dictionary <string, string> ImageNowServiceHelper(string dbName, string dbUser)
        {
            Dictionary <string, string> imageNowServiceHelper = new Dictionary <string, string>();
            string password = string.Empty;
            string database = string.Empty;
            string userName = string.Empty;

            try
            {
                database = getDBConfigValueByLetter(dbName);
                userName = getDBConfigValueByLetter(dbUser);
                if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(database))
                {
                    password = SharedPassword.GetPassword(database, userName);
                }
                imageNowServiceHelper.Add(userName, password);
            }
            catch (Exception exp)
            {
                GSA.R7BD.Utility.EventLog.AddWebErrors("GSA.R7BD.Utility", "Utilities", "ImageNowServiceHelper", exp.Message.ToString());
            }
            return(imageNowServiceHelper);
        }