public UniversalBlock AddField(PrintElementLocation location, PrintElementItem element) { var block = new UniversalBlock(); switch (location) { case PrintElementLocation.ReportHead: this.ReportHead.Fields.Add(element); break; case PrintElementLocation.PageHead: this.PageHead.Fields.Add(element); break; case PrintElementLocation.PageFooter: this.PageFooter.Fields.Add(element); break; case PrintElementLocation.ReportFooter: this.ReportFooter.Fields.Add(element); break; } return(block); }
public static UniversalPrintSchema LoadFrom(Type type) { var temp = new UniversalPrintSchema(); var pList = type.GetPropertyExecutorList(2); foreach (var executorse in pList) { var prop = executorse.Value.TargetPropertyInfo; var elementAttr = prop.GetAttribute <PrintElementAttribute>(true); if (elementAttr != null) { if ( !prop.PropertyType.IsValueType && prop.PropertyType != typeof(string) && prop.PropertyType.IsClass && prop.PropertyType.IsIEnumerable() && elementAttr.DisplayText == "" && prop.PropertyType.IsAssignableFrom(typeof(DetailWithDynamicColumnsCollection <>)) ) { continue; } var printElement = new PrintElementItem(); printElement.BindingColumn = executorse.Key; printElement.DataType = prop.PropertyType; printElement.HeaderText = elementAttr.DisplayText; printElement.DisplayType = elementAttr.DisplayType; temp.AddField(elementAttr.Location, printElement); } else if (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition().IsAssignableFrom(typeof(DetailWithDynamicColumnsCollection <>))) { //var printElement = new PrintElementItem(); //printElement.DataType = prop.PropertyType; //printElement.DisplayType = PrintElementDisplayType.Auto; //printElement.BindingColumn = executorse.Key; //printElement.Name = executorse.Key; var attr = prop.GetAttribute <PrintElementDetailListAttribute>(true); if (attr == null) { continue; } temp.AddDetailTable(executorse.Key, attr.DetailName, prop); } } return(temp); }
private PrintElementItem buildFromAttribute(string bindingName, Type propertyInfo, PrintElementAttribute attr) { //var attr = propertyExecutor.Value.TargetPropertyInfo.GetAttribute<PrintElementAtrribute>(true); var pe = new PrintElementItem(); pe.BindingColumn = bindingName; // propertyExecutor.Key; pe.DataType = propertyInfo; // propertyExecutor.Value.TargetPropertyInfo.PropertyType; pe.HeaderText = attr.DisplayText; pe.DisplayType = attr.DisplayType; return(pe); }
public PrintElementItem Copy() { var pe = new PrintElementItem(); pe.BindingColumn = this.BindingColumn; pe.HeaderText = this.HeaderText; pe.Name = this.Name; pe.DataType = this.DataType; pe.Text = this.Text; pe.DisplayType = this.DisplayType; return(pe); }