private void ParseFacet(XmlReader xmlReader, PivotItem item) { PivotCollection cachedData = this.CachedCollectionData; String facetCategoryName = null; PivotFacetType facetType = null; while (xmlReader.Read()) { if (xmlReader.NodeType != XmlNodeType.Element) { continue; } if (xmlReader.LocalName == "Facet") { facetCategoryName = xmlReader.GetAttribute("Name"); PivotFacetCategory facetCategory = cachedData.FacetCategories[facetCategoryName]; facetType = facetCategory.Type; } else if ((facetType != null) && (xmlReader.LocalName == facetType.ToString())) { if (facetType == PivotFacetType.Link) { PivotLink link = new PivotLink(xmlReader.GetAttribute("Name"), xmlReader.GetAttribute("Href")); item.AddFacetValues(facetCategoryName, link); } else { String value = xmlReader.GetAttribute("Value"); item.AddFacetValues(facetCategoryName, facetType.ParseValue(value)); } } } }
private IEnumerable <Object> SplitJoinedValues(String joinedValue, PivotFacetType facetType) { foreach (String value in this.SplitJoinedStrings(joinedValue)) { yield return(facetType.ParseValue(value)); } }
private PivotFacetCategory CreateFacetCategory(OleDbDataReader dataReader) { String name = null; PivotFacetType type = null; for (int column = 0; column < dataReader.FieldCount; column++) { if (dataReader.IsDBNull(column)) { continue; } String columnName = dataReader.GetName(column).ToLowerInvariant(); String value = dataReader.GetValue(column).ToString(); if (columnName == OleDbSchemaConstants.FacetCategory.Name) { name = value; } else if (columnName == OleDbSchemaConstants.FacetCategory.Type) { type = PivotFacetType.Parse(value); } } if (name == null) { throw new InvalidDataException("Facet Categories data set is missing a Name column"); } if (type == null) { throw new InvalidDataException("Facet Categories data set is missing a Type column"); } return(new PivotFacetCategory(name, type)); }
public void AssertFacetTypesEqual(PivotFacetType expected, PivotFacetType actual) { if (expected == null && actual == null) { return; } AssertEqual(expected.GetType(), actual.GetType()); }
public void TestIdentifyNumber() { AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((byte)1)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((short)2)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((int)3)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((long)4)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((ushort)5)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((uint)6)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((ulong)7)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((float)8.8)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((double)9.9)); AssertEqual(PivotFacetType.Number, PivotFacetType.IdentifyType((decimal)10.10)); }
public void TestIdentifyLink() { AssertEqual(PivotFacetType.Link, PivotFacetType.IdentifyType(new PivotLink("alpha", "bravo"))); }
public void TestIdentifyDateTime() { AssertEqual(PivotFacetType.DateTime, PivotFacetType.IdentifyType(new DateTime(1776, 07, 04))); }
public void TestIdentifyLongString() { AssertEqual(PivotFacetType.LongString, PivotFacetType.IdentifyType("alpha bravo charlie delta echo")); }
public void TestIdentifyString() { AssertEqual(PivotFacetType.String, PivotFacetType.IdentifyType("alpha")); }
private PivotFacetCategory ParseFacetCategory(XmlReader xmlReader) { PivotFacetCategory facetCategory = null; while (xmlReader.Read()) { if (xmlReader.NodeType != XmlNodeType.Element) { continue; } if (xmlReader.LocalName == "FacetCategory") { String name = xmlReader.GetAttribute("Name"); String type = xmlReader.GetAttribute("Type"); facetCategory = new PivotFacetCategory(name, PivotFacetType.Parse(type)); String value = null; if ((value = xmlReader.GetAttribute("Format")) != null) { facetCategory.Format = value; } if ((value = xmlReader.GetAttribute("IsFilterVisible", PivotNamespace)) != null) { facetCategory.IsFilterVisible = Boolean.Parse(value); } if ((value = xmlReader.GetAttribute("IsMetaDataVisible", PivotNamespace)) != null) { facetCategory.IsMetaDataVisible = Boolean.Parse(value); } if ((value = xmlReader.GetAttribute("IsWordWheelVisible", PivotNamespace)) != null) { facetCategory.IsWordWheelVisible = Boolean.Parse(value); } } else if (xmlReader.LocalName == "SortOrder") { if (facetCategory == null) { continue; } String name = xmlReader.GetAttribute("Name"); facetCategory.SortOrder = new PivotFacetSortOrder(name); } else if (xmlReader.LocalName == "SortValue") { if (facetCategory == null) { continue; } if (facetCategory.SortOrder == null) { continue; } facetCategory.SortOrder.AddValue(xmlReader.GetAttribute("Value")); } } return(facetCategory); }