Example #1
0
        public void EditDatabase()
        {
            if (lstDatabases.SelectedItems.Count != 1)
            {
                return;
            }

            Connection c = (Connection)lstDatabases.SelectedItems[0];

            FormDatabase f = new FormDatabase
            {
                Host               = c.Host,
                Database           = c.Database,
                Username           = c.Username,
                Password           = c.Password,
                IntegratedSecurity = c.IntegratedSecurity,
            };

            if (f.ShowDialog() == DialogResult.OK)
            {
                c.Host               = f.Host;
                c.Database           = f.Database;
                c.Username           = f.Username;
                c.Password           = f.Password;
                c.IntegratedSecurity = f.IntegratedSecurity;
                settings.Save();
                RefreshForm();
            }
        }
Example #2
0
        public void AddDatabase()
        {
            FormDatabase f = new FormDatabase();

            if (f.ShowDialog() == DialogResult.OK)
            {
                Connection c = new Connection
                {
                    Host               = f.Host,
                    Database           = f.Database,
                    Username           = f.Username,
                    Password           = f.Password,
                    IntegratedSecurity = f.IntegratedSecurity,
                };
                settings.Databases.Add(c);
                settings.Save();
                RefreshForm();
            }
        }