public static void ShowTriggerDetail( System.Windows.Forms.Form oParent, Guid DBID, string VersionID, string TriggerName) { SQLAutoDocLib.BLL.Trigger_Factory oFactory = new SQLAutoDocLib.BLL.Trigger_Factory(); SQLAutoDocLib.BLL.Trigger oTrigger = oFactory.GetTriggerByName(DBID: DBID, TriggerName: TriggerName, VersionID: VersionID); StringReader oReader = new StringReader(oTrigger.Configuration); XPathDocument oMyDoc = new XPathDocument(oReader); XslCompiledTransform oProcessor = new XslCompiledTransform(); string sXSL = GetResourceTextFile(oParent, "SQLAutoDoc.xsl.trigger.xsl"); oProcessor.Load(XmlReader.Create(new StringReader(sXSL))); StringBuilder oBuffer = new StringBuilder(); StringWriter oSWriter = new StringWriter(oBuffer); oProcessor.Transform( XmlReader.Create(new StringReader(oTrigger.Configuration)), null, oSWriter); SetFormFields( oParent: oParent, VersionID: VersionID, Name: TriggerName, Desc: oTrigger.Description, FirstDate: oTrigger.FindFirstVersion, LastDate: oTrigger.FindLastVersion, HTML: oSWriter.ToString()); oSWriter.Flush(); oSWriter.Dispose(); Application.DoEvents(); }
private void ShowDesc() { string VersionID = cmbVersion.SelectedValue.ToString(); TreeNode CurrentNode = tvwObject.SelectedNode; if (CurrentNode.Parent != null) { if (CurrentNode.Parent.Name == SQLAutoDocLib.UTIL.Constants.TABLENODE) { SQLAutoDocLib.BLL.Table_Factory oFactory = new SQLAutoDocLib.BLL.Table_Factory(); SQLAutoDocLib.BLL.Table oTable = oFactory.GetTableByName(DBID: m_DBID, TableName: CurrentNode.Name, VersionID: VersionID); frmDesc oForm = new frmDesc( ObjectName: CurrentNode.Name, ObjectDesc: oTable.Description, ObjectType: SQLAutoDocLib.UTIL.ObjectType.Table); if (oForm.ShowDialog() == DialogResult.OK) { oTable.Load(); oTable.Description = oForm.Desc; oTable.Save(); txtDesc.Text = oForm.Desc; } } else if (CurrentNode.Parent.Name == SQLAutoDocLib.UTIL.Constants.VIEWNODE) { SQLAutoDocLib.BLL.View_Factory oFactory = new SQLAutoDocLib.BLL.View_Factory(); SQLAutoDocLib.BLL.View oView = oFactory.GetViewByName(DBID: m_DBID, ViewName: CurrentNode.Name, VersionID: VersionID); frmDesc oForm = new frmDesc( ObjectName: CurrentNode.Name, ObjectDesc: oView.Description, ObjectType: SQLAutoDocLib.UTIL.ObjectType.View); if (oForm.ShowDialog() == DialogResult.OK) { oView.Load(); oView.Description = oForm.Desc; oView.Save(); txtDesc.Text = oForm.Desc; } } else if (CurrentNode.Parent.Name == SQLAutoDocLib.UTIL.Constants.TRIGGERNODE) { SQLAutoDocLib.BLL.Trigger_Factory oFactory = new SQLAutoDocLib.BLL.Trigger_Factory(); SQLAutoDocLib.BLL.Trigger oTrigger = oFactory.GetTriggerByName(DBID: m_DBID, TriggerName: CurrentNode.Name, VersionID: VersionID); frmDesc oForm = new frmDesc( ObjectName: CurrentNode.Name, ObjectDesc: oTrigger.Description, ObjectType: SQLAutoDocLib.UTIL.ObjectType.Trigger); if (oForm.ShowDialog() == DialogResult.OK) { oTrigger.Load(); oTrigger.Description = oForm.Desc; oTrigger.Save(); txtDesc.Text = oForm.Desc; } } else if (CurrentNode.Parent.Name == SQLAutoDocLib.UTIL.Constants.PROCEDURENODE) { SQLAutoDocLib.BLL.Procedure_Factory oFactory = new SQLAutoDocLib.BLL.Procedure_Factory(); SQLAutoDocLib.BLL.Procedure oProcedure = oFactory.GetProcedureByName(DBID: m_DBID, ProcedureName: CurrentNode.Name, VersionID: VersionID); frmDesc oForm = new frmDesc( ObjectName: CurrentNode.Name, ObjectDesc: oProcedure.Description, ObjectType: SQLAutoDocLib.UTIL.ObjectType.Procedure); if (oForm.ShowDialog() == DialogResult.OK) { oProcedure.Load(); oProcedure.Description = oForm.Desc; oProcedure.Save(); txtDesc.Text = oForm.Desc; } } else if (CurrentNode.Parent.Name == SQLAutoDocLib.UTIL.Constants.FUNCTIONNODE) { SQLAutoDocLib.BLL.Function_Factory oFactory = new SQLAutoDocLib.BLL.Function_Factory(); SQLAutoDocLib.BLL.Function oFunction = oFactory.GetFunctionByName(DBID: m_DBID, FunctionName: CurrentNode.Name, VersionID: VersionID); frmDesc oForm = new frmDesc( ObjectName: CurrentNode.Name, ObjectDesc: oFunction.Description, ObjectType: SQLAutoDocLib.UTIL.ObjectType.Function); if (oForm.ShowDialog() == DialogResult.OK) { oFunction.Load(); oFunction.Description = oForm.Desc; oFunction.Save(); txtDesc.Text = oForm.Desc; } } } }
private void SaveScript(string sFileName) { using (StreamWriter oSW = new StreamWriter(path: sFileName, append: false)) { oSW.WriteLine("/* VERSION: " + m_Version + " */"); foreach (ListViewItem oItem in lvwDifferences.Items) { if (oItem.Checked == true) { object oValue = oItem.Tag; string sTypeName = oValue.GetType().ToString(); if (oValue.GetType() == typeof(SQLAutoDocLib.BLL.Table)) { //This is a table SQLAutoDocLib.BLL.Table oTable = (SQLAutoDocLib.BLL.Table)oValue; if (oTable.CurrentlyExists == true) { oSW.WriteLine("/* ALTER */"); } else { oSW.WriteLine("/* CREATE */"); } SQLAutoDocLib.BLL.Table_Factory oFactory = new SQLAutoDocLib.BLL.Table_Factory(); oSW.WriteLine(oFactory.Reconstitute(oTable)); } else if (oValue.GetType() == typeof(SQLAutoDocLib.BLL.View)) { //This is a view SQLAutoDocLib.BLL.View oView = (SQLAutoDocLib.BLL.View)oValue; SQLAutoDocLib.BLL.View_Factory oFactory = new SQLAutoDocLib.BLL.View_Factory(); oSW.WriteLine(oFactory.Reconstitute(oView)); } else if (oValue.GetType() == typeof(SQLAutoDocLib.BLL.Function)) { //This is a function SQLAutoDocLib.BLL.Function oFunction = (SQLAutoDocLib.BLL.Function)oValue; SQLAutoDocLib.BLL.Function_Factory oFactory = new SQLAutoDocLib.BLL.Function_Factory(); oSW.WriteLine(oFactory.Reconstitute(oFunction)); } else if (oValue.GetType() == typeof(SQLAutoDocLib.BLL.Procedure)) { //This is a procedure SQLAutoDocLib.BLL.Procedure oProcedure = (SQLAutoDocLib.BLL.Procedure)oValue; SQLAutoDocLib.BLL.Procedure_Factory oFactory = new SQLAutoDocLib.BLL.Procedure_Factory(); oSW.WriteLine(oFactory.Reconstitute(oProcedure)); } else if (oValue.GetType() == typeof(SQLAutoDocLib.BLL.Trigger)) { //This is a trigger SQLAutoDocLib.BLL.Trigger oTrigger = (SQLAutoDocLib.BLL.Trigger)oValue; SQLAutoDocLib.BLL.Trigger_Factory oFactory = new SQLAutoDocLib.BLL.Trigger_Factory(); oSW.WriteLine(oFactory.Reconstitute(oTrigger)); } } } } }