public void Update()
        {
            AGENT.DBDescriptionAgent_Factory oDescriptionFactory = new AGENT.DBDescriptionAgent_Factory(DBID: m_DBID);

            DescriptionUpdateBegin(DateTime.Now);

            TypeDescriptionUpdate(UTIL.Constants.FUNCTIONNODE.ToString(), DateTime.Now);
            using (SQLAutoDocLib.BLL.Function_Factory oFunction_Factory = new SQLAutoDocLib.BLL.Function_Factory())
                foreach (BLL.Function oFunction in oFunction_Factory.ListAllFunctionsInDatabase(DBID: m_DBID))
                {
                    oDescriptionFactory.UpdateFunctionDescription(
                        Name: oFunction.Name,
                        Description: oFunction.Description);
                }

            TypeDescriptionUpdate(UTIL.Constants.PROCEDURENODE.ToString(), DateTime.Now);
            using (SQLAutoDocLib.BLL.Procedure_Factory oProcedure_Factory = new SQLAutoDocLib.BLL.Procedure_Factory())
                foreach (BLL.Procedure oProcedure in oProcedure_Factory.ListAllProceduresInDatabase(DBID:m_DBID))
                {
                    oDescriptionFactory.UpdateProcedureDescription(
                        Name: oProcedure.Name,
                        Description: oProcedure.Description);
                }

            TypeDescriptionUpdate(UTIL.Constants.TABLENODE.ToString(), DateTime.Now);
            using (SQLAutoDocLib.BLL.Table_Factory oTable_Factory = new SQLAutoDocLib.BLL.Table_Factory())
                foreach (BLL.Table oTable in oTable_Factory.ListAllTablesInDatabase(DBID:m_DBID))
                {
                    oDescriptionFactory.UpdateTableDescription(
                        Name: oTable.Name,
                        Description: oTable.Description);
                }

            TypeDescriptionUpdate(UTIL.Constants.VIEWNODE.ToString(), DateTime.Now);
            using (SQLAutoDocLib.BLL.View_Factory oView_Factory = new SQLAutoDocLib.BLL.View_Factory())
                foreach (BLL.View oView in oView_Factory.ListAllViewsInDatabase(DBID:m_DBID))
                {
                    oDescriptionFactory.UpdateViewDescription(
                        Name: oView.Name,
                        Description: oView.Description);
                }

            /*
             * Can't update trigger descriptions at this time...
             * SQLAutoDocLib.BLL.Trigger_Factory oTrigger_Factory = new SQLAutoDocLib.BLL.Trigger_Factory();
             * oFunction_Factory.UpdateExtendedDescriptions(DBID: m_DBID);
             * Application.DoEvents();
             * */

            DescriptionUpdateEnd(DateTime.Now);
        }
Пример #2
0
        private void InitTree(string VersionID)
        {
            string sCurrentVersion = CurrentVersion();

            ClearTree();

            if (VersionID.Length > 0)
            {
                try
                {
                    TreeNode oDatabase = GetNodeByKey(tvwObject.Nodes, SQLAutoDocLib.UTIL.Constants.DATABASENODE);

                    //Add tables
                    SQLAutoDocLib.BLL.Table_Factory oTableFactory = new SQLAutoDocLib.BLL.Table_Factory();
                    List <SQLAutoDocLib.BLL.Table>  oTableList    = oTableFactory.ListAllTablesInDatabase(
                        DBID: m_DBID,
                        VersionID: sCurrentVersion,
                        ChangedOnly: false);

                    TreeNode oTablesNode = GetNodeByKey(oDatabase.Nodes, SQLAutoDocLib.UTIL.Constants.TABLENODE);
                    foreach (SQLAutoDocLib.BLL.Table oTable in oTableList)
                    {
                        if (chkShowChangesOnly.Checked == false || oTable.ChangedInLastScan == true)
                        {
                            TreeNode oTableNode = oTablesNode.Nodes.Add(oTable.Name, oTable.Name, imageIndex: (int)ImageKeys.table);
                            oTableNode.SelectedImageIndex = (int)ImageKeys.table_go;

                            if (oTable.ChangedInLastScan == true)
                            {
                                if (oTable.CurrentlyExists == false)
                                {
                                    oTableNode.ImageIndex        = (int)ImageKeys.table_delete;
                                    oTableNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                                else
                                {
                                    oTableNode.ImageIndex        = (int)ImageKeys.table_edit;
                                    oTableNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                            }
                        }
                    }

                    //Add views
                    SQLAutoDocLib.BLL.View_Factory oViewFactory = new SQLAutoDocLib.BLL.View_Factory();
                    List <SQLAutoDocLib.BLL.View>  oViewList    = oViewFactory.ListAllViewsInDatabase(
                        DBID: m_DBID,
                        VersionID: sCurrentVersion,
                        ChangedOnly: false);

                    TreeNode oViewsNode = GetNodeByKey(oDatabase.Nodes, SQLAutoDocLib.UTIL.Constants.VIEWNODE);
                    foreach (SQLAutoDocLib.BLL.View oView in oViewList)
                    {
                        if (chkShowChangesOnly.Checked == false || oView.ChangedInLastScan == true)
                        {
                            TreeNode oViewNode = oViewsNode.Nodes.Add(oView.Name, oView.Name, imageIndex: (int)ImageKeys.table);
                            oViewNode.SelectedImageIndex = (int)ImageKeys.table_go;

                            if (oView.ChangedInLastScan == true)
                            {
                                if (oView.CurrentlyExists == false)
                                {
                                    oViewNode.ImageIndex        = (int)ImageKeys.table_delete;
                                    oViewNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                                else
                                {
                                    oViewNode.ImageIndex        = (int)ImageKeys.table_edit;
                                    oViewNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                            }
                        }
                    }

                    //Add procs
                    SQLAutoDocLib.BLL.Procedure_Factory oProcFactory = new SQLAutoDocLib.BLL.Procedure_Factory();
                    List <SQLAutoDocLib.BLL.Procedure>  oProcList    = oProcFactory.ListAllProceduresInDatabase(
                        DBID: m_DBID,
                        VersionID: sCurrentVersion,
                        ChangedOnly: false);

                    TreeNode oProcsNode = GetNodeByKey(oDatabase.Nodes, SQLAutoDocLib.UTIL.Constants.PROCEDURENODE);
                    foreach (SQLAutoDocLib.BLL.Procedure oProc in oProcList)
                    {
                        if (chkShowChangesOnly.Checked == false || oProc.ChangedInLastScan == true)
                        {
                            TreeNode oProcNode = oProcsNode.Nodes.Add(oProc.Name, oProc.Name, imageIndex: (int)ImageKeys.table);
                            oProcNode.SelectedImageIndex = (int)ImageKeys.table_go;

                            if (oProc.ChangedInLastScan == true)
                            {
                                if (oProc.CurrentlyExists == false)
                                {
                                    oProcNode.ImageIndex        = (int)ImageKeys.table_delete;
                                    oProcNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                                else
                                {
                                    oProcNode.ImageIndex        = (int)ImageKeys.table_edit;
                                    oProcNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                            }
                        }
                    }

                    //Add functions
                    SQLAutoDocLib.BLL.Function_Factory oFunctionFactory = new SQLAutoDocLib.BLL.Function_Factory();
                    List <SQLAutoDocLib.BLL.Function>  oFunctionList    = oFunctionFactory.ListAllFunctionsInDatabase(
                        DBID: m_DBID,
                        VersionID: sCurrentVersion,
                        ChangedOnly: false);

                    TreeNode oFunctionsNode = GetNodeByKey(oDatabase.Nodes, SQLAutoDocLib.UTIL.Constants.FUNCTIONNODE);
                    foreach (SQLAutoDocLib.BLL.Function oFunction in oFunctionList)
                    {
                        if (chkShowChangesOnly.Checked == false || oFunction.ChangedInLastScan == true)
                        {
                            TreeNode oFunctionNode = oFunctionsNode.Nodes.Add(oFunction.Name, oFunction.Name, imageIndex: (int)ImageKeys.table);
                            oFunctionsNode.SelectedImageIndex = (int)ImageKeys.table_go;

                            if (oFunction.ChangedInLastScan == true)
                            {
                                if (oFunction.CurrentlyExists == false)
                                {
                                    oFunctionsNode.ImageIndex        = (int)ImageKeys.table_delete;
                                    oFunctionsNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                                else
                                {
                                    oFunctionsNode.ImageIndex       = (int)ImageKeys.table_edit;
                                    oFunctionNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                            }
                        }
                    }

                    //Add triggers
                    SQLAutoDocLib.BLL.Trigger_Factory oTriggerFactory = new SQLAutoDocLib.BLL.Trigger_Factory();
                    List <SQLAutoDocLib.BLL.Trigger>  oTriggerList    = oTriggerFactory.ListAllTriggersInDatabase(
                        DBID: m_DBID,
                        VersionID: sCurrentVersion,
                        ChangedOnly: false);

                    TreeNode oTriggersNode = GetNodeByKey(oDatabase.Nodes, SQLAutoDocLib.UTIL.Constants.TRIGGERNODE);
                    foreach (SQLAutoDocLib.BLL.Trigger oTrigger in oTriggerList)
                    {
                        if (chkShowChangesOnly.Checked == false || oTrigger.ChangedInLastScan == true)
                        {
                            TreeNode oTriggerNode = oTriggersNode.Nodes.Add(oTrigger.Name, oTrigger.Name, imageIndex: (int)ImageKeys.table);
                            oTriggersNode.SelectedImageIndex = (int)ImageKeys.table_go;

                            if (oTrigger.ChangedInLastScan == true)
                            {
                                if (oTrigger.CurrentlyExists == false)
                                {
                                    oTriggersNode.ImageIndex        = (int)ImageKeys.table_delete;
                                    oTriggersNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                                else
                                {
                                    oTriggersNode.ImageIndex        = (int)ImageKeys.table_edit;
                                    oTriggersNode.Parent.ImageIndex = (int)ImageKeys.table_edit;
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
Пример #3
0
        public void ShowVersion()
        {
            this.Show();
            this.TopMost = true;

            this.UseWaitCursor = true;

            lblVersion.Text = m_Version;

            //Add tables
            SQLAutoDocLib.BLL.Table_Factory oTableFactory = new SQLAutoDocLib.BLL.Table_Factory();
            List <SQLAutoDocLib.BLL.Table>  oTableList    = oTableFactory.ListAllTablesInDatabase(m_DBID, m_Version, ChangedOnly: true);

            foreach (SQLAutoDocLib.BLL.Table oTable in oTableList)
            {
                ListViewItem oItem = new ListViewItem(text: oTable.Name);
                oItem.Tag   = oTable;
                oItem.Group = lvwDifferences.Groups[0];
                lvwDifferences.Items.Add(oItem);
            }

            //Add views
            SQLAutoDocLib.BLL.View_Factory oViewFactory = new SQLAutoDocLib.BLL.View_Factory();
            List <SQLAutoDocLib.BLL.View>  oViewList    = oViewFactory.ListAllViewsInDatabase(m_DBID, m_Version, ChangedOnly: true);

            foreach (SQLAutoDocLib.BLL.View oView in oViewList)
            {
                ListViewItem oItem = new ListViewItem(text: oView.Name);
                oItem.Tag   = oView;
                oItem.Group = lvwDifferences.Groups[1];
                lvwDifferences.Items.Add(oItem);
            }

            //Add procs
            SQLAutoDocLib.BLL.Procedure_Factory oProcFactory = new SQLAutoDocLib.BLL.Procedure_Factory();
            List <SQLAutoDocLib.BLL.Procedure>  oProcList    = oProcFactory.ListAllProceduresInDatabase(m_DBID, m_Version, ChangedOnly: true);

            foreach (SQLAutoDocLib.BLL.Procedure oProc in oProcList)
            {
                ListViewItem oItem = new ListViewItem(text: oProc.Name);
                oItem.Tag   = oProc;
                oItem.Group = lvwDifferences.Groups[2];
                lvwDifferences.Items.Add(oItem);
            }

            //Add functions
            SQLAutoDocLib.BLL.Function_Factory oFunctionFactory = new SQLAutoDocLib.BLL.Function_Factory();
            List <SQLAutoDocLib.BLL.Function>  oFunctionList    = oFunctionFactory.ListAllFunctionsInDatabase(m_DBID, m_Version, ChangedOnly: true);

            foreach (SQLAutoDocLib.BLL.Function oFunction in oFunctionList)
            {
                ListViewItem oItem = new ListViewItem(text: oFunction.Name);
                oItem.Tag   = oFunction;
                oItem.Group = lvwDifferences.Groups[3];
                lvwDifferences.Items.Add(oItem);
            }

            //Add triggers
            SQLAutoDocLib.BLL.Trigger_Factory oTriggerFactory = new SQLAutoDocLib.BLL.Trigger_Factory();
            List <SQLAutoDocLib.BLL.Trigger>  oTriggerList    = oTriggerFactory.ListAllTriggersInDatabase(m_DBID, m_Version, ChangedOnly: true);

            foreach (SQLAutoDocLib.BLL.Trigger oTrigger in oTriggerList)
            {
                ListViewItem oItem = new ListViewItem(text: oTrigger.Name);
                oItem.Tag   = oTrigger;
                oItem.Group = lvwDifferences.Groups[4];
                lvwDifferences.Items.Add(oItem);
            }

            this.UseWaitCursor = false;
        }