public List <GrantedAppsInfo> GrantedDBs()
        {
            var grantedDBs = new GrantedDBs.Builder(Client.Ticket, Token, Client.AccountDomain)
                             .SetWithEmbeddedTables(true).Build();
            var xml = grantedDBs.Post();

            GrantedAppsInfo grantedApps      = null;
            var             grantedAppsInfos = new List <GrantedAppsInfo>();

            foreach (XElement dbinfo in xml.Element("databases").Elements("dbinfo"))
            {
                if (!dbinfo.Element("dbname").Value.Contains(":"))
                {
                    var appName = dbinfo.Element("dbname").Value;
                    var appDbid = dbinfo.Element("dbid").Value;
                    grantedApps = new GrantedAppsInfo(appName, appDbid);
                    grantedAppsInfos.Add(grantedApps);
                }
                else
                {
                    var tableName = dbinfo.Element("dbname").Value;
                    var tableDbid = dbinfo.Element("dbid").Value;
                    grantedApps?.AddTable(tableName, tableDbid);
                }
            }
            return(grantedAppsInfos);
        }
Example #2
0
        public List <GrantedAppsInfo> GrantedDBs()
        {
            var grantedDBs = new GrantedDBs.Builder(Client.Ticket, Token, Client.AccountDomain)
                             .SetWithEmbeddedTables(true).Build();
            var xml = grantedDBs.Post().CreateNavigator();

            var             dbinfoNodes      = xml.Select("/qdbapi/databases/dbinfo");
            GrantedAppsInfo grantedApps      = null;
            var             grantedAppsInfos = new List <GrantedAppsInfo>();

            foreach (XPathNavigator dbinfo in dbinfoNodes)
            {
                if (!dbinfo.SelectSingleNode("dbname").Value.Contains(":"))
                {
                    var appName = dbinfo.SelectSingleNode("dbname").Value;
                    var appDbid = dbinfo.SelectSingleNode("dbid").Value;
                    grantedApps = new GrantedAppsInfo(appName, appDbid);
                    grantedAppsInfos.Add(grantedApps);
                }
                else
                {
                    var tableName = dbinfo.SelectSingleNode("dbname").Value;
                    var tableDbid = dbinfo.SelectSingleNode("dbid").Value;
                    if (grantedApps != null)
                    {
                        grantedApps.AddTable(tableName, tableDbid);
                    }
                }
            }
            return(grantedAppsInfos);
        }
        public List<GrantedAppsInfo> GrantedDBs()
        {
            var grantedDBs = new GrantedDBs.Builder(Client.Ticket, Token, Client.AccountDomain)
                .SetWithEmbeddedTables(true).Build();
            var xml = grantedDBs.Post().CreateNavigator();

            var dbinfoNodes = xml.Select("/qdbapi/databases/dbinfo");
            GrantedAppsInfo grantedApps = null;
            var grantedAppsInfos = new List<GrantedAppsInfo>();
            foreach (XPathNavigator dbinfo in dbinfoNodes)
            {
                if (!dbinfo.SelectSingleNode("dbname").Value.Contains(":"))
                {
                    var appName = dbinfo.SelectSingleNode("dbname").Value;
                    var appDbid = dbinfo.SelectSingleNode("dbid").Value;
                    grantedApps = new GrantedAppsInfo(appName, appDbid);
                    grantedAppsInfos.Add(grantedApps);
                }
                else
                {
                    var tableName = dbinfo.SelectSingleNode("dbname").Value;
                    var tableDbid = dbinfo.SelectSingleNode("dbid").Value;
                    if (grantedApps != null) grantedApps.AddTable(tableName, tableDbid);
                }
            }
            return grantedAppsInfos;
        }