Exemple #1
0
        /// <summary>
        /// Show the result for selected class in both case Run Query/View Objects
        /// </summary>
        private void ShowObjectsForAClass()
        {
            try
            {
                queryBuilder = ((ViewBase.GetWindow(Constants.QUERYBUILDER)).Object) as QueryBuilder;

                listQueryAttributes = queryBuilder.GetSelectedAttributes();

                //Only Set BaseClass with current class
                if (toolStripButtonAssemblyView.Checked)
                {
                    Helper.BaseClass = dbAssemblyTreeView.SelectedNode.Parent != null
                                                                ? dbAssemblyTreeView.SelectedNode.Text
                                                                : Helper.ClassName;
                }
                else
                {
                    Helper.BaseClass = dbtreeviewObject.SelectedNode.Parent != null
                                                                ? dbtreeviewObject.SelectedNode.Text
                                                                : Helper.ClassName;
                }


                //Prepare query for View Objects
                omQuery = new OMQuery(Helper.BaseClass, DateTime.Now);

                if (Helper.HashTableBaseClass.Contains(Helper.BaseClass))
                {
                    omQuery.AttributeList = listQueryAttributes;
                }

                //Need to fectch attribute list in query result for same OMQuery
                if (Helper.OMResultedQuery.Contains(omQuery.BaseClass))
                {
                    Helper.OMResultedQuery[omQuery.BaseClass] = omQuery;
                }
                else
                {
                    Helper.OMResultedQuery.Add(omQuery.BaseClass, omQuery);
                }

                dbtreeviewObject.UpdateTreeNodeSelection(dbtreeviewObject.SelectedNode, toolStripButtonAssemblyView.Checked);



                ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationBuild);
                if (backgroundWorkerToRunQuery.IsBusy)
                {
                    backgroundWorkerToRunQuery.CancelAsync();
                }
                else
                {
                    backgroundWorkerToRunQuery.RunWorkerAsync();
                }

                isrunning = true;
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }
Exemple #2
0
        private void TreeView_OnContextMenuItemClicked(object sender, DBContextItemClickedEventArg e)
        {
            try
            {
                queryBuilder = ((ViewBase.GetWindow(Constants.QUERYBUILDER)).Object) as QueryBuilder;
                switch (e.Tag.ToString())
                {
                case Common.Constants.CONTEXT_MENU_SHOW_ALL_OBJECTS:
                    ShowAllObjects();
                    break;

                case Common.Constants.CONTEXT_MENU_ADD_TO_ATTRIBUTE:
                    if (queryBuilder != null)
                    {
                        AddToAttributeList(queryBuilder.DataGridViewAttributes, (TreeNode)e.Data);

                        ApplicationObject.ToolWindows.DTE.Windows.Item(Constants.QUERYBUILDER).Activate();
                    }
                    break;

                case Common.Constants.CONTEXT_MENU_EXPRESSION_GROUP:

                    string itmName   = ((ToolStripItem)e.Item).Name;
                    char[] splitChar = { '_' };
                    int    lastIndex = itmName.LastIndexOf("_");
                    int    index     = Convert.ToInt32(itmName.Split(splitChar, itmName.Length - lastIndex)[1].Split(splitChar)[1]);


                    DataGridViewGroup dgvGroup = (DataGridViewGroup)queryBuilder.TableLayoutPanelQueries.Controls[index];

                    dbDataGridView datagridObject = dgvGroup.DataGridViewQuery;
                    bool           rowAdded       = datagridObject.AddToQueryBuilder((TreeNode)e.Data, queryBuilder);
                    if (rowAdded)
                    {
                        queryBuilder = ((ViewBase.GetWindow(Constants.QUERYBUILDER)).Object) as QueryBuilder;
                        queryBuilder.EnableRunQuery = true;
                    }

                    ApplicationObject.ToolWindows.DTE.Windows.Item(Constants.QUERYBUILDER).Activate();
                    break;

                case "Rename":
                    dbtreeviewObject.LabelEdit = true;
                    dbtreeviewObject.SelectedNode.BeginEdit();
                    break;

                case "Delete Folder":
                    FavouriteFolder Fav = new FavouriteFolder(null, ((TreeNode)e.Data).Text);
                    dbInteraction.UpdateFavourite(dbInteraction.GetCurrentRecentConnection().ConnParam, Fav);
                    dbtreeviewObject.Nodes.Remove((TreeNode)e.Data);
                    break;

                case "Delete Class":
                    TreeNode tNode      = (TreeNode)e.Data;
                    TreeNode parentNode = ((TreeNode)e.Data).Parent;

                    if (tNode != null && parentNode != null)
                    {
                        Fav = new FavouriteFolder(null, tNode.Parent.Text);

                        parentNode.Nodes.Remove(tNode);
                        if (parentNode.Nodes.Count > 0)
                        {
                            List <string> lststr = new List <string>();
                            foreach (TreeNode tempNode in parentNode.Nodes)
                            {
                                lststr.Add(tempNode.Text);
                            }

                            Fav.ListClass = lststr;
                        }

                        dbInteraction.SaveFavourite(dbInteraction.GetCurrentRecentConnection().ConnParam, Fav);
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }