//This will set the current connection string in the backend.xml file. public static void UpdateConnectionString(string newConnectionString) { var backEndDoc = GetXmlDoc.GetBackEndXmlDoc(DTO.Enums.BackEndOrFrontEndEnum.BackEnd); var backEndSettingsDoc = GetXmlDoc.GetSettingsDoc(DTO.Enums.BackEndOrFrontEndEnum.BackEnd); backEndDoc.SelectSingleNode("//ConnectionInfo").Attributes.GetNamedItem("ConnectionString").Value = newConnectionString; backEndSettingsDoc.SelectSingleNode("//ConnectionString").InnerText = newConnectionString; SaveXmlDoc.saveBackEndDoc(backEndDoc); SaveXmlDoc.saveBackEndSettingsDoc(backEndSettingsDoc); }
public static string GetCurrentConnectionString(DTO.Enums.BackEndOrFrontEndEnum whichEnd) { XmlDocument doc = null; string connString = ""; switch (whichEnd) { case AccessLauncher.DTO.Enums.BackEndOrFrontEndEnum.BackEnd: doc = GetXmlDoc.GetSettingsDoc(whichEnd); connString = doc.SelectSingleNode("//ConnectionString").InnerText; break; case AccessLauncher.DTO.Enums.BackEndOrFrontEndEnum.FrontEnd: doc = GetXmlDoc.GetBackEndXmlDoc(whichEnd); connString = doc.SelectSingleNode("//ConnectionInfo").Attributes.GetNamedItem("ConnectionString").Value; break; } return(connString); }
//This will locate the rollout directory. This is a key method in all forms of this application. //If the rollout directory doesn't exist or if it cannot locate the rollout directory, this will //raise an exception, which can be evaluated higher up in the call chain. public static string GetRolloutDirectoryPath(DTO.Enums.BackEndOrFrontEndEnum whichEnd) { try { var doc = GetXmlDoc.GetSettingsDoc(whichEnd); string rolloutDirectoryPath = doc.SelectSingleNode("//RolloutDirectory").InnerText; if (rolloutDirectoryPath.Length == 0 || String.IsNullOrEmpty(rolloutDirectoryPath)) { throw new DTO.Exceptions.CouldNotLocateRolloutDirectoryException(); } return(rolloutDirectoryPath); } catch (Exception) { if (!File.Exists(GetSettingsXMLPath(whichEnd))) { throw new DTO.Exceptions.BackEndSettingsNotFoundException(); } else { throw; } } }