private bool ShouldIncludeAutoBoundItem(PDFDataItem item) { bool include = false; switch (this.AutoBindContent) { case DataAutoBindContent.None: include = false; break; //case DataAutoBindContent.Elements: // include = (item.NodeType == System.Xml.XmlNodeType.Element); // break; //case DataAutoBindContent.Attributes: // include = (item.NodeType == System.Xml.XmlNodeType.Attribute); // break; case DataAutoBindContent.All: include = (item.NodeType == System.Xml.XmlNodeType.Element || item.NodeType == System.Xml.XmlNodeType.Attribute); if (null != _excludedColumns && _excludedColumns.Length > 0 && Array.IndexOf(_excludedColumns, item.Name) > -1) { include = false; } break; default: break; } return(include); }
protected bool ShouldIncludeAutoBoundItem(PDFDataItem item) { switch (this.AutoBindContent) { case DataAutoBindContent.None: return(false); //case DataAutoBindContent.Elements: // return item.NodeType == System.Xml.XmlNodeType.Element; //case DataAutoBindContent.Attributes: // return item.NodeType == System.Xml.XmlNodeType.Attribute; case DataAutoBindContent.All: if (null != this._excludedColumns) { if (Array.IndexOf(this._excludedColumns, item.Name) > -1) { return(false); } } return(item.NodeType == System.Xml.XmlNodeType.Attribute || item.NodeType == System.Xml.XmlNodeType.Element); default: return(false); } }
/// <summary> /// Extracts a bunch of data items for the schema from the table columns /// </summary> /// <param name="path">the current path to the table</param> /// <param name="table">The data table to extract the columns for</param> /// <returns></returns> private static IEnumerable <PDFDataItem> GetTableColumnSchema(string path, System.Data.DataTable table) { List <PDFDataItem> all = new List <PDFDataItem>(); foreach (System.Data.DataColumn col in table.Columns) { if (col.ColumnMapping == System.Data.MappingType.Hidden) { //Do Nothing } else { PDFDataItem item = GetColumnDataItem(path, col); if (null != item) { all.Add(item); } } } return(all); }
private static PDFDataSchema DoPopulateDataSchema(DataSet dataset, PDFDataContext context) { string dsName = dataset.DataSetName; string dsXmlName = System.Xml.XmlConvert.EncodeLocalName(dsName); System.Data.DataTable[] tables = GetTopLevelTables(dataset); List <PDFDataItem> topItems = new List <PDFDataItem>(); foreach (System.Data.DataTable table in tables) { string tableName = table.TableName; string tableXmlName = System.Xml.XmlConvert.EncodeLocalName(tableName); string path = PDFDataSchema.CombineElementNames(dsXmlName, tableXmlName); PDFDataItemCollection columns = new PDFDataItemCollection(GetTableColumnSchema(path, table)); PDFDataItem topTable = new PDFDataItem(path, tableName, tableName, columns); topItems.Add(topTable); //TODO: Load child schemas } PDFDataSchema schema = new PDFDataSchema(dsName, new PDFDataItemCollection(topItems)); return(schema); }
/// <summary> /// Extracts a single schema data item for the provided data column /// </summary> /// <param name="path"></param> /// <param name="col"></param> /// <returns></returns> private static PDFDataItem GetColumnDataItem(string path, System.Data.DataColumn col) { string name = col.ColumnName; string relativePath = System.Xml.XmlConvert.EncodeLocalName(name); string title = string.IsNullOrEmpty(col.Caption) ? name : col.Caption; System.Xml.XmlNodeType nodetype; if (col.ColumnMapping == System.Data.MappingType.Hidden) { return(null); } else if (col.ColumnMapping == System.Data.MappingType.Attribute) { relativePath = "@" + relativePath; nodetype = System.Xml.XmlNodeType.Attribute; } else if (col.ColumnMapping == System.Data.MappingType.SimpleContent) { relativePath = "text()"; nodetype = System.Xml.XmlNodeType.Text; } else if (col.ColumnMapping == System.Data.MappingType.Element) { nodetype = System.Xml.XmlNodeType.Element; relativePath += "/text()"; } else { throw new ArgumentOutOfRangeException("col.ColumnMapping"); } string fullpath = PDFDataSchema.CombineElementNames(path, relativePath); PDFDataItem item = new PDFDataItem(fullpath, relativePath, name, title, nodetype, GetDataTypeFromSystemType(col)); return(item); }
protected override void ApplyAutoBindingMember(PDFDataItem item) { this._autobindItemPath = item.RelativePath; }
// // methods // protected override void ApplyAutoBindingMember(PDFDataItem item) { throw new NotSupportedException("AutoBinding onto a template column is not suported"); }
public override void SetDataSourceBindingItem(PDFDataItem item, PDFDataContext context) { this._autobindValue = item.RelativePath; this.DataBinding += PDFWithTextField_DataBinding; base.SetDataSourceBindingItem(item, context); }
protected abstract void ApplyAutoBindingMember(PDFDataItem item);
public virtual void SetDataSourceBindingItem(PDFDataItem item, PDFDataContext context) { this.ApplyAutoBindingMember(item); }
public virtual void SetDataSourceBindingItem(PDFDataItem item, PDFDataContext context) { }