public static TDSQueriesTree Instance()
        {
            if (_instance == null)
            {
                _instance = new TDSQueriesTree();
            }

            return _instance;
        }
Exemple #2
0
        public static TDSQueriesTree Instance()
        {
            if (_instance == null)
            {
                _instance = new TDSQueriesTree();
            }

            return(_instance);
        }
Exemple #3
0
        /// <summary>
        /// Walks through the default folder structure store in the DefaultQueriesTree.xml
        /// and replicates the structure for the current connection
        /// </summary>
        /// <param name="Structure"></param>
        /// <param name="Connection"></param>
        public void BuildTreeStructureForUserId(TDSQueriesTree initialQueryTree, MyZillaSettingsDataSet.ConnectionRow connectionRow)
        {
            foreach (TDSQueriesTree.FoldersRow folder in initialQueryTree.Folders.Rows)
            {
                CreateFolder(connectionRow, folder.Name, folder.LevelID, folder.ParentID);
            }
            _instance.Folders.AcceptChanges();

            RefreshTreePerUser(connectionRow);
        }
        private void InitializeData()
        {
            InitializeComponent();

            _connSettings = MyZillaSettingsDataSet.GetInstance();

            this.queryTree = ConfigItems.TDSQueriesTree.Instance();

            _asyncOpManager = AsyncOperationManagerList.GetInstance();
        }
Exemple #5
0
        public void LoadDefaultData(string applicationPath)
        {
            _appPath = applicationPath;
            string fileName        = applicationPath + Path.DirectorySeparatorChar + _fileName;
            string defaultFileName = Application.StartupPath + Path.DirectorySeparatorChar + _defaultFileName;

            try
            {
                if (File.Exists(fileName))
                {
                    _instance.ReadXml(fileName);
                }
                //if QueriesTree does not exist in the windows user application data folder
                //load the default values from the application folder
                else if (File.Exists(defaultFileName))
                {
                    TDSQueriesTree t = new TDSQueriesTree();
                    t.ReadXml(defaultFileName);
                    _instance.QueryTypes.Merge(t.QueryTypes);
                    _instance.QueryParameters.Merge(t.QueryParameters);

                    MyZillaSettingsDataSet         settings    = MyZillaSettingsDataSet.GetInstance();
                    TDSettings.ConnectionDataTable connections = settings.GetActiveConnections();

                    foreach (TDSettings.ConnectionRow connection  in connections)
                    {
                        CatalogueManager catalogues = CatalogueManager.Instance();
                        if (catalogues.GetCataloguesForConnection(connection.ConnectionId) != null)
                        {
                            BuildTreeStructureForUserId(t, connection);
                        }
                    }
                }
                else
                {
                    throw (new IOException("Default queries configuration [" + fileName + "] is missing!"));
                }
            }
            catch (IOException)
            {
                throw (new IOException("File " + fileName + " not exist."));
            }
        }
Exemple #6
0
        public void LoadDefaultDataForUserId(TreeView treeView, TDSettings.ConnectionRow connectionRow)
        {
            string defaultFileName = Application.StartupPath + Path.DirectorySeparatorChar + _defaultFileName;

            try
            {
                if (File.Exists(defaultFileName))
                {
                    TDSQueriesTree treeStructure = new TDSQueriesTree();
                    treeStructure.ReadXml(defaultFileName);
                    //treeStructure.WriteXml("c:\\test.xml");
                    BuildTreeStructureForUserId(treeStructure, connectionRow);
                }
            }
            catch (IOException)
            {
                throw (new IOException("File " + defaultFileName + " does not exist."));
            }
        }
        private void InitializeData()
        {
            InitializeComponent();

            _connSettings = MyZillaSettingsDataSet.GetInstance();

            this.queryTree = ConfigItems.TDSQueriesTree.Instance();

            _asyncOpManager = AsyncOperationManagerList.GetInstance();
        }
        private void AddQueryToTreeNode(TreeNode folderNode, TDSQueriesTree.QueriesRow queryRow)
        {
            TreeNode queryNode = new TreeNode();

            string queryName = String.Empty;

            string queryNodeLabelFormat = String.Concat(queryRow.Name, " ({0})");

            if (queryRow.BugsCount==-1)
                queryName = String.Format(queryNodeLabelFormat, '?');
            else
                queryName = String.Format(queryNodeLabelFormat, queryRow.BugsCount);

            queryNode = folderNode.Nodes.Add("query " + queryRow.ID.ToString(), queryName, "Query");
            queryNode.ToolTipText = queryRow.Description;

            queryNode.Tag = new NodeDescription(NodeType.Query, queryRow, queryNodeLabelFormat);
            queryNode.ImageIndex = 1;
            queryNode.SelectedImageIndex = 1;
        }
        public void LoadDefaultDataForUserId(TreeView treeView, TDSettings.ConnectionRow connectionRow)
        {
            string defaultFileName = Application.StartupPath + Path.DirectorySeparatorChar + _defaultFileName;

            try
            {
                if (File.Exists(defaultFileName))
                {
                    TDSQueriesTree treeStructure = new TDSQueriesTree();
                    treeStructure.ReadXml(defaultFileName);
                    //treeStructure.WriteXml("c:\\test.xml");
                    BuildTreeStructureForUserId(treeStructure, connectionRow );
                }
            }
            catch (IOException)
            {
                throw (new IOException("File " + defaultFileName + " does not exist."));
            }
        }
        public void LoadDefaultData(string applicationPath)
        {
            _appPath = applicationPath;
            string fileName = applicationPath + Path.DirectorySeparatorChar + _fileName;
            string defaultFileName = Application.StartupPath + Path.DirectorySeparatorChar + _defaultFileName;

            try
            {

                if (File.Exists(fileName))
                {
                    _instance.ReadXml(fileName);
                }
                //if QueriesTree does not exist in the windows user application data folder
                //load the default values from the application folder
                else if (File.Exists(defaultFileName))
                {
                    TDSQueriesTree t = new TDSQueriesTree();
                    t.ReadXml(defaultFileName);
                    _instance.QueryTypes.Merge( t.QueryTypes);
                    _instance.QueryParameters.Merge(t.QueryParameters);

                    MyZillaSettingsDataSet settings = MyZillaSettingsDataSet.GetInstance ();
                    TDSettings.ConnectionDataTable  connections  = settings.GetActiveConnections ();

                    foreach (TDSettings.ConnectionRow  connection  in connections )
                    {
                        CatalogueManager catalogues = CatalogueManager.Instance();
                        if (catalogues.GetCataloguesForConnection(connection.ConnectionId)!=null)
                            BuildTreeStructureForUserId(t, connection );
                    }

                }else
                    throw (new IOException("Default queries configuration [" + fileName + "] is missing!"));
            }
            catch (IOException)
            {
                throw (new IOException("File " + fileName + " not exist."));
            }
        }
        /// <summary>
        /// Walks through the default folder structure store in the DefaultQueriesTree.xml
        /// and replicates the structure for the current connection
        /// </summary>
        /// <param name="Structure"></param>
        /// <param name="Connection"></param>
        public void BuildTreeStructureForUserId(TDSQueriesTree initialQueryTree, MyZillaSettingsDataSet.ConnectionRow  connectionRow)
        {
            foreach (TDSQueriesTree.FoldersRow folder in initialQueryTree.Folders.Rows)
            {
                CreateFolder(connectionRow, folder.Name, folder.LevelID, folder.ParentID);
            }
            _instance.Folders.AcceptChanges();

            RefreshTreePerUser(connectionRow );
        }
 public void AddQueryToTree(TreeView treeView, TDSQueriesTree.QueriesRow queryRow)
 {
     TreeNode[] folderNodes = treeView.Nodes.Find("folder " + queryRow.FolderID, true);
     if (folderNodes.GetLength(0) == 1)
     {
         AddQueryToTreeNode(folderNodes[0], queryRow);
         folderNodes[0].Expand();
     }
 }
        public void AddParameterValuesForQuery(TDSQueriesTree.QueriesRow queryRow, NameValueCollection searchConfiguration)
        {
            DataRow[] parameters  = ParametersValues.Select("QueryID = " + queryRow.ID);
            for (int i = parameters.GetLength(0) - 1; i >= 0; i--)
                parameters[i].Delete();

            ParametersValues.AcceptChanges();

            for (int i = 0; i < searchConfiguration.Count; i++)
            {
                //compose QueryString based on the criteria selected in the interface
                for (int j = 0; j < searchConfiguration.GetValues(i).Length; j++)
                {
                    ParametersValuesRow qpValue = _instance.ParametersValues.NewParametersValuesRow();
                    qpValue.QueryID = queryRow.ID;
                    DataRow[] qpRows = _instance.QueryParameters.Select("Name = '" + searchConfiguration.GetKey(i) + "'");
                    if (qpRows.GetLength(0) == 1)
                    {
                        qpValue.ParameterID = Byte.Parse(qpRows[0][0].ToString());
                        qpValue.Value = searchConfiguration.GetValues(i)[j];

                        _instance.ParametersValues.Rows.Add(qpValue);
                    }
                }
            }
        }
Exemple #14
0
        public static void CreateNewResultsTab(List<MyZilla.BusinessEntities.Bug> bg, NameValueCollection SearchParams, TabControl _tabCtrl, TreeView TreeViewQueries, TDSQueriesTree.QueriesRow Query, bool ShowQueryCriteria, bool QueryCriteriaVisible, string QueryNodeKey)
        {
            try
            {
                string tabKey = QueryNodeKey;
                string tabHeaderText = "New Query";
                bool _executeQuery = true;

                if (Query != null)
                {
                    //the key of the tabs is Query ID
                    tabKey = "query " + Query.ID.ToString();
                    tabHeaderText = Query.Name + "-" + TreeViewQueries.SelectedNode.Parent.Text;
                }
                else
                {
                    if (bg != null)
                    {
                        //tabKey = "query -2";
                        tabHeaderText = "General search";
                    }
                    else
                        _executeQuery = false;
                }

                TabPage tabResults = _tabCtrl.TabPages[tabKey];

                UCResults bugsResults;
                if (tabResults == null)
                {
                    //_tabCtrl.TabPages.Add(tabKey, tabHeaderText + "*****");
                    //tabResults = _tabCtrl.TabPages[tabKey];
                    tabResults = new TabPage(tabHeaderText + "*****");
                    tabResults.Name = tabKey;
                    //tabResults.BackColor = System.Drawing.SystemColors.Window;

                    bugsResults = new UCResults(ConnectionId, bg, SearchParams, TreeViewQueries, ShowQueryCriteria, QueryCriteriaVisible, _executeQuery, QueryNodeKey);
                    tabResults.Controls.Add(bugsResults);

                    bugsResults.Dock = DockStyle.Fill;

                    bugsResults.ExecuteQueryCompleted += new UCResults.ExecuteQueryCompletedEventHandler(bugsResults_ExecuteQueryCompleted);
                    bugsResults.QueryNameChanged += new UCResults.QueryNameChangedEventHandler(bugsResults_QueryNameChanged);
                    bugsResults.Name = "ucResults";
                    _tabCtrl.TabPages.Add(tabResults);
                    Application.DoEvents();
                    _tabCtrl.SelectedTab = tabResults;
                    Application.DoEvents();

                    bugsResults.LoadAssignToContextMenu();

                    bugsResults.LoadBugs(null, null);
                }
                else
                {
                    Control[] resultCtrl = tabResults.Controls.Find("ucResults", true);

                    if (resultCtrl != null && resultCtrl.GetLength(0) == 1)
                    {
                        bugsResults = (UCResults)(resultCtrl[0]);

                        bugsResults.LoadBugs(bg, SearchParams);
                    }
                }

                tabResults.ToolTipText = GetTabResultsTooltip(TreeViewQueries.SelectedNode);
                tabResults.Tag = ConnectionId;
                _tabCtrl.SelectedTab = tabResults;
            }
            catch (Exception ex)
            {
                throw ex;

            }
        }