private void btnExecute_Click(object sender, EventArgs e) { if (!btnExport.Enabled) { return; } if (_updated) { if (MsgBoxEx.Shout("Changes in the current database script will be saved<br />first? Continue with the exportation?", "Export Database Script", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1) != System.Windows.Forms.DialogResult.Yes) { return; } btnSave_Click(btnSave, new EventArgs()); if (_updated) { return; } } DatabaseScriptInfo _script = new DatabaseScriptInfo(_referenceno); _script.Execute(); try { InitializeInfo(); } catch { } }
private void btnExecuteScript_Click(object sender, EventArgs e) { if (!btnExecuteScript.Enabled) { return; } if (!grdScripts.Redraw) { return; } if (grdScripts.DataSource == null) { return; } if (grdScripts.RowSel < (grdScripts.Rows.Fixed)) { return; } string _referenceno = grdScripts[grdScripts.RowSel, "ReferenceNo"].ToString(); DatabaseScriptInfo _script = new DatabaseScriptInfo(_referenceno); DatabaseScriptExecutionResult _result = _script.Execute(); }
private void mnuExecuteScripts_Click(object sender, EventArgs e) { if (!mnuExecuteScripts.Enabled) { return; } OpenFileDialog _dialog = new OpenFileDialog(); _dialog.CheckFileExists = true; _dialog.CheckPathExists = true; _dialog.DefaultExt = SCMS.ScriptFileExtension; _dialog.Filter = "SCMS Database Script Files (*." + SCMS.ScriptFileExtension + ")|*." + SCMS.ScriptFileExtension; _dialog.Title = "Browse Database Script File"; string _filename = ""; if (_dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _filename = (_dialog.FileName); } _dialog.Dispose(); _dialog = null; Materia.RefreshAndManageCurrentProcess(); if (!string.IsNullOrEmpty(_filename.RLTrim())) { if (File.Exists(_filename)) { string _tempdir = Application.StartupPath + "\\Temp"; if (!Directory.Exists(_tempdir)) { try { Directory.CreateDirectory(_tempdir); } catch { } } if (Directory.Exists(_tempdir)) { FileInfo _file = new FileInfo(_filename); string _decrypted = _file.Decrypt(SCMS.EncryptionKey); string _tempfile = _tempdir + "\\" + Path.GetFileNameWithoutExtension(_filename) + ".xml"; FileInfo _xmlfile = Materia.WriteToFile(_tempfile, _decrypted, false); if (_xmlfile != null) { DataTable _table = SCMS.XmlToTable(_xmlfile.FullName); if (_table != null) { if (_table.TableName == "scripts") { if (_table.Rows.Count > 0) { DatabaseScriptInfo _script = new DatabaseScriptInfo(_table); DatabaseScriptExecutionResult _result = _script.Execute(); } else { MsgBoxEx.Shout("The specified file does not contain anyt releveant database script information.", "Execute Database Script"); } } else { MsgBoxEx.Shout("The specified file does not contain anyt releveant database script information.", "Execute Database Script"); } } else { MsgBoxEx.Alert("Failed to extract script information from the specified file.", "Execute Database Script"); } } else { MsgBoxEx.Alert("Failed to extract script information from the specified file.", "Execute Database Script"); } } else { MsgBoxEx.Alert("Failed to extract script information from the specified file.", "Execute Database Script"); } } } }
/// <summary> /// Creates a new instance of DatabaseScriptExecutionResult. /// </summary> /// <param name="script"></param> public DatabaseScriptExecutionResult(DatabaseScriptInfo script) { _databasescript = script; }