/// <summary> /// To get the connection of the database. /// </summary> /// <param name="databaseId"></param> /// <param name="pcrId"></param> /// <returns></returns> public static CGI4VB.OnboardingConnectionInfo GetOnboardingDbConnection(string databaseId = null, string pcrId = "") { try { PCRConnection onboardingPCR = new PCRConnection(ConfigurationManager.AppSettings["PCRAppPath"]); CGI4VB.OnboardingConnectionInfo dbc; if (String.IsNullOrEmpty(pcrId)) { dbc = onboardingPCR.GetOnboardingDBConnections(databaseId); } else { dbc = onboardingPCR.GetOnboardingDBConnections(databaseId, pcrId); } if (dbc != null) { return(dbc); } else { throw new Exception("Unable to get database connection."); } } catch (Exception ex) { throw new Exception("Unable to get database connection."); } }
public static DbConnection GetMasterDbConnection() { try { PCRConnection onboardingPCR = new PCRConnection(ConfigurationManager.AppSettings["PCRAppPath"]); DbConnection dbc; dbc = onboardingPCR.GetOnboardingMasterDBConnection(); if (dbc == null) { throw new Exception("Unable to get database connection."); } return(dbc); } catch (Exception ex) { throw new Exception("Unable to get database connection."); } }