Ejemplo n.º 1
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."));
            }
        }
Ejemplo n.º 2
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."));
            }
        }
Ejemplo n.º 3
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."));
            }
        }
Ejemplo n.º 4
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."));
            }
        }