public static void initDBCredentials(SqlDataReader ForCredentials) { //__SageDSNs = ForCredentials["SageDSN"].ToString(); //__SageUsers = ForCredentials["SageUser"].ToString(); //__SageUserPasswords = ForCredentials["SagePWD"].ToString(); __SQLCredentialLocal = new SQLDBCredentials("Myserver", "Mydb", "user", "pwd"); __SQLCredentialReport = new SQLDBCredentials("Myserver", "Mydb", "user", "pwd"); __SQLCredentialORCS = new SQLDBCredentials("Myserver", "Mydb", "user", "pwd"); __SAGECredential = new SAGEDBCredentials("SageDSN", "SageUser", "SagePWD"); __PhoneServerUNC = "PhoneServerUNC"; }
public DBConnectionString(SQLDBCredentials SQLCredential) { if (SQLCredential == null || string.IsNullOrEmpty(SQLCredential.SQLServer) || string.IsNullOrEmpty(SQLCredential.SQLDBName) || string.IsNullOrEmpty(SQLCredential.UserName)) { throw new ArgumentException(Resources.ExceptionNullInvalidCredentials, "connectionString"); } connectionString = string.Format("UID={0};PWD={1};Server={2};Database={3};connection timeout=300", new string[] { SQLCredential.UserName, SQLCredential.UserPassword, SQLCredential.SQLServer, SQLCredential.SQLDBName }); if (string.IsNullOrEmpty(connectionString)) { throw new ArgumentException(Resources.ExceptionNullOrEmptyString, "connectionString"); } }
public static void InitializeDBObject(DataTable CountryTable) { CountryName = new Dictionary <string, string>(); SQLServers = new Dictionary <string, string>(); SQLDBs = new Dictionary <string, string>(); SQLDBUsers = new Dictionary <string, string>(); SQLDBUsersPasword = new Dictionary <string, string>(); foreach (DataRow drCountry in CountryTable.Rows) { CountryName.Add(drCountry["Code"].ToString(), drCountry["Name"].ToString()); SQLServers.Add(drCountry["Code"].ToString(), drCountry["ServerName"].ToString()); SQLDBs.Add(drCountry["Code"].ToString(), drCountry["DBName"].ToString()); SQLDBUsers.Add(drCountry["Code"].ToString(), drCountry["DBLoginName"].ToString()); SQLDBUsersPasword.Add(drCountry["Code"].ToString(), drCountry["DBLoginPWD"].ToString()); } CurrentCountry.CountryName = CountryName[CurrentCountry.CountryCode]; //IsSageCustomerFromSQLServer = false; __SQLCredentialLocal = new SQLDBCredentials(SQLServers[CurrentCountry.CountryCode], SQLDBs[CurrentCountry.CountryCode], SQLDBUsers[CurrentCountry.CountryCode], SQLDBUsersPasword[CurrentCountry.CountryCode]); }