/// <summary> /// Navigate to a linked table. /// </summary> /// <param name="url">Url of the linked table.</param> public void NavigateTo(TableLink link) { // create new child DataTable var dt = new DataTable(_source, link.Name); // populate the new DataTable var url = string.Format("{0}/{1}", link.Url, link.Href); if (Top > 0 && link.Type.IndexOf("feed") > -1) { url += url.IndexOf('?') > -1 ? "&" : "?"; url += "$top=" + Top.ToString(); } dt._dt = new C1.Silverlight.Data.DataTable(); dt.GetTableRows(url); // add it to child table list and notify _childTables.Add(dt); OnPropertyChanged("DefaultView"); OnPropertyChanged("SourceUrl"); }
DataRow GetDataRow(XmlReader xr) { // get values, add columns var dct = new Dictionary <DataColumn, object>(); xr.Read(); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element) { if (xr.Name == "link") { var href = xr.GetAttribute("href"); var name = xr.GetAttribute("title"); var type = xr.GetAttribute("type"); if (!string.IsNullOrEmpty(href) && !string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(type)) { if (type.IndexOf("application/atom+xml;type=") > -1) { var col = GetDataColumn(name, typeof(TableLink)); dct[col] = new TableLink(name, _source.Url, href, type); } } } else if (xr.Name == "m:properties") { GetDataRowProperties(dct, xr.ReadSubtree()); } } } // build new row var newRow = _dt.NewRow(); foreach (var kv in dct) { newRow[kv.Key] = kv.Value != DBNull.Value ? kv.Value : null; } return(newRow); }
DataRow GetDataRow(XmlReader xr) { // get values, add columns var dct = new Dictionary<DataColumn, object>(); xr.Read(); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element) { if (xr.Name == "link") { var href = xr.GetAttribute("href"); var name = xr.GetAttribute("title"); var type = xr.GetAttribute("type"); if (!string.IsNullOrEmpty(href) && !string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(type)) { if (type.IndexOf("application/atom+xml;type=") > -1) { var col = GetDataColumn(name, typeof(TableLink)); dct[col] = new TableLink(name, _source.Url, href, type); } } } else if (xr.Name == "m:properties") { GetDataRowProperties(dct, xr.ReadSubtree()); } } } // build new row var newRow = _dt.NewRow(); foreach (var kv in dct) { newRow[kv.Key] = kv.Value != DBNull.Value ? kv.Value : null; } return newRow; }