// Сохранение всех сборок в БД. public void Save(SQLResultStorage storage) { foreach (ResultAssembly assembly in assembliesToConvert) { storage.Save(assembly); } }
private void DBOptimizer_Load(object sender, EventArgs e) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string connection = config.AppSettings.Settings["SQLProvider"].Value; this.connectionStringTxt.Text = config.ConnectionStrings.ConnectionStrings[connection].ConnectionString; sqlStorage = new SQLResultStorage(new ConnectionStringSettings("temporaryconnection", this.connectionStringTxt.Text, "System.Data.SqlClient")); }
// Обработчики сообщений. private void connectionsBtn_Click(object sender, EventArgs e) { DataConnectionDialog connectionDlg = new DataConnectionDialog(); DataConnectionConfiguration dcs = new DataConnectionConfiguration(null); dcs.LoadConfiguration(connectionDlg); if (DataConnectionDialog.Show(connectionDlg) == DialogResult.OK) { this.connectionStringTxt.Text = connectionDlg.ConnectionString; } dcs.SaveConfiguration(connectionDlg); sqlStorage = new SQLResultStorage(new ConnectionStringSettings("temporaryconnection", this.connectionStringTxt.Text, "System.Data.SqlClient")); }
private void xmlToSql_Click(object sender, EventArgs e) { IResultStorage sqlStorage = new SQLResultStorage(new ConnectionStringSettings("a", this.sqlStorageConnTxt.Text, "System.Data.SqlClient")); IResultStorage xmlStorage = new XMLResultStorage(this.xmlStorageLocationTxt.Text); FreezeButtons(true); TransferData(xmlStorage, sqlStorage); FreezeButtons(false); }
private void fromFileSql_Click(object sender, EventArgs e) { try { SQLResultStorage sqlStorage = new SQLResultStorage(new ConnectionStringSettings("a", this.connectionStringTxt.Text, "System.Data.SqlClient")); FreezeButtons(true); ResultsFileConverter converter = new ResultsFileConverter(this.externalStoreLocationTxt.Text); converter.ReadRootDirectory(); converter.Save(sqlStorage); FreezeButtons(false); MessageBox.Show("Data transfer succeed.", "Success"); } catch (SystemException) { MessageBox.Show("Data transfer failed.", "Failed"); } }
// Инициализация обьекта для работы с хранилищем данных. protected override void InitStorage() { this.resultStorage = new SQLResultStorage(ConfigurationManager. ConnectionStrings[ConfigurationManager.AppSettings[ConfigurationManager. AppSettings["Storage"]]]); this.storage = (SQLResultStorage)this.resultStorage; }