예제 #1
0
        public ProfileSetup(DatabaseProfile profile)
        {
            InitializeComponent();

            //database settings
            _dbProfile         = profile;
            _strDefaultProfile = DatabaseConfiguration.DatabaseSettings.DefaultProfile;

            try
            {
                _dbTemp = new DBProfileTemp(profile);
                propProfile.SelectedObject = _dbTemp;
                if (_dbTemp.Name == _strDefaultProfile)
                {
                    _dbTemp.DefaultProfile = true;
                }
                else
                {
                    _dbTemp.DefaultProfile = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }
        }
예제 #2
0
        private bool ApplyChanges()
        {
            bool blnSave = true;

            try
            {
                if (propProfile.SelectedObject != null)
                {
                    DBProfileTemp dbTemp = (DBProfileTemp)propProfile.SelectedObject;

                    if (dbTemp.Name == string.Empty)
                    {
                        throw new DatabaseException("Invalid profile name.");
                    }

                    _dbProfile.Name             = dbTemp.Name;
                    _dbProfile.ConnectionString = dbTemp.ConnectionType.ConnectionStringBuilder.ConnectionString;
                    _dbProfile.Timeout          = dbTemp.Timeout;
                    _dbProfile.EnablePing       = dbTemp.EnablePing;
                    _dbProfile.PingTimeout      = dbTemp.PingTimeout;
                    _dbProfile.PingTTL          = dbTemp.PingTTL;
                    _dbProfile.ProviderType     = dbTemp.ProviderType;
                    if (dbTemp.DefaultProfile == true)
                    {
                        _strDefaultProfile = dbTemp.Name;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Apply Changes");
                blnSave = false;
            }

            return(blnSave);
        }