private bool SQLTransformation(XMLDoc xmlDoc) { bool retval = false; if (xmlDoc == null) { xmlDoc = new XMLDoc(); xmlDoc.InitialDirectory = LastDirectory; if (!xmlDoc.Open(dockPanel)) { xmlDoc.Close(); xmlDoc.Dispose(); this.toolStripStatusLabel1.Text = ""; } else { LastDirectory = xmlDoc.InitialDirectory; } } if (xmlDoc.IsDatabaseSchema) { string m_DialogTitle = "Save SQL File As..."; string m_DialogTypeFilter = "SQL files (*.sql)|*.sql|All files (*.*)|*.*"; string m_fileName = xmlDoc.FileName.ToLower().Replace("xml", "sql"); ArrayList arl = xmlDoc.ShowSaveFileDialog(m_fileName, m_DialogTitle, m_DialogTypeFilter); LastDirectory = xmlDoc.InitialDirectory; DialogResult dr = (DialogResult)arl[0]; if (dr == DialogResult.OK) { m_fileName = (string)arl[1]; AsyncTransformSQL trans = null; if (xmlDoc.IsDatabaseDiff) { trans = new AsyncTransformSQL(this, xmlDoc.FileName, m_fileName, AsyncTransformSQL.TransformType.Diff); trans.CompleteTransformSQL += new AsyncTransformSQL.CompleteTransformDelegate(trans_CompleteTransformSQL); } else { trans = new AsyncTransformSQL(this, xmlDoc.FileName, m_fileName, AsyncTransformSQL.TransformType.Create); trans.CompleteTransformSQL += new AsyncTransformSQL.CompleteTransformDelegate(trans_CompleteTransformSQL); } string work = "Processing XML Snapshot: " + xmlDoc.FileName + "..."; this.toolStripStatusLabel2.Text = string.Empty; this.toolStripStatusLabel1.Text = work; trans.Start(); retval = true; } else { this.toolStripStatusLabel1.Text = ""; } } return retval; }
private void xMLFileToolStripMenuItem_Click(object sender, EventArgs e) { // rehydrate DTS package from DTS XML file bool openNewFlag = true; if (dockPanel.ActiveDocument != null && typeof(XMLDoc).IsInstanceOfType(dockPanel.ActiveDocument.DockHandler.Form)) { XMLDoc xmlDoc = (XMLDoc)dockPanel.ActiveDocument.DockHandler.Form; if (xmlDoc.IsDTSPackage) { this.toolStripStatusLabel1.Text = "Generating DTS Package From: " + xmlDoc.TabText; xmlDoc.ReHydrateDTS(m_serverExplorer.Servers); openNewFlag = false; } else { openNewFlag = true; } } if (openNewFlag) // open new window { XMLDoc xmlDoc = new XMLDoc(); xmlDoc.InitialDirectory = LastDirectory; if (!xmlDoc.Open(dockPanel)) { xmlDoc.Close(); xmlDoc.Dispose(); return; } else { LastDirectory = xmlDoc.InitialDirectory; } if (xmlDoc.IsDTSPackage) { this.toolStripStatusLabel1.Text = "Generating DTS Package From: " + xmlDoc.TabText; xmlDoc.ReHydrateDTS(m_serverExplorer.Servers); } } }