Esempio n. 1
0
        /// <summary>
        /// Saves connection definition to external storage.
        /// </summary>
        /// <param name="connDef">Connection definition object to be saved.</param>
        /// <returns>Path to saved XML file containing connection definition.</returns>
        public string SaveConnectionDefinition(PFConnectionDefinition connDef)
        {
            string retval        = string.Empty;
            string pathToDefFile = Path.Combine(_connectionManager.ConnectionDefintionsLocation, connDef.DbPlatform.ToString(), connDef.ConnectionName + ".xml");

            if (File.Exists(pathToDefFile))
            {
                _msg.Length = 0;
                _msg.Append("Connection definition already exists at ");
                _msg.Append(pathToDefFile);
                _msg.Append(".\r\nDo you wish to overwrite the file?");
                DialogResult res = AppMessages.DisplayMessage(_msg.ToString(), "Save Connection ...", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (res != DialogResult.Yes)
                {
                    return(retval);
                }
            }
            retval = _connectionManager.SaveConnection(connDef);
            return(retval);
        }