internal static IReportComponent ParseXmlNode(XmlNode node, ref IReportComponent component) { string TypeOfComponent = node.Attributes["type"].Value; component.TypeOfComponent = Enum.TryParse(TypeOfComponent, out ReportComponentType reportTypComponent) ? reportTypComponent : ReportComponentType.Null; var func = parsingFunctions[component.TypeOfComponent]; return(func(component, node)); }
public static IReportComponent GetComponentFromXmlNode(XmlNode node) { string nameOfComponents = String.IsNullOrWhiteSpace(node.Name) ? "Null" : node.Name; string component = $"TestReport.Components.TestReportComponent{ nameOfComponents }, TestReportComponent{ nameOfComponents }, Version = 1.0.0.0, Culture = neutral"; Type componentType = Type.GetType(component); object type = Activator.CreateInstance(componentType); IReportComponent testreportComponent = type as IReportComponent; return(testreportComponent); }
/// <summary> /// Walks up the site tree to see if the controls is hosted in the specified type. /// </summary> /// <param name="parent">The current component being checked.</param> /// <param name="type">The type to look for.</param> /// <returns>True if the component is hosted in the specified type</returns> internal static bool IsHostInType(IReportComponent parent, Type type) { if (type == null) { throw new ArgumentNullException("type"); } if (parent == null) { return(false); } if (parent.GetType() == type) { return(true); } IReportComponent component = parent.Parent; return(component != null && IsHostInType(component, type)); }
public const int cmdidEditAction = 0xF020; //61472 /// <summary> /// Searches for the innermost data region contained the specified item /// </summary> public static DataRegion GetParentDataRegion(IReportComponent reportComponent) { if (reportComponent == null) { Debug.Assert(false, "Invalid report item"); return(null); } if (reportComponent is DataRegion) { return(reportComponent as DataRegion); } IReportComponentContainer parent = reportComponent.Parent; while (parent != null) { if (parent is DataRegion) { return(parent as DataRegion); } parent = parent.Parent; } Trace.TraceInformation("Failed to find a data region containing item"); return(null); }
public static void CheckIfExpressionIsBad(ExpressionInfo expression, List <ValidationEntry> entries, ValidationContext validationContext, string propertyName, IReportComponent ownerComponent) { // RULE: Globals!PageNumber & Globals!TotalPages can't be used outside pageheader or pagefooter if (ownerComponent != null && expression != null) { if (!IsHostInType(ownerComponent, typeof(PageHeaderFooter))) { if (expression.Expression.Contains("Globals!PageNumber") || expression.Expression.Contains("Globals!TotalPages")) { ReportItem ownerItem = ownerComponent as ReportItem; if (ownerItem != null) { string message = string.Format(Resources.InvalidUsingPageNumberReference, new object[] { propertyName, ownerItem.GetType().Name, ownerItem.Name }); entries.Add(new ValidationEntry(Severity.Error, message, new InvalidOperationException(message), ownerComponent)); } } } } }
private static IEnumerable <IReportComponent> Flat(this IReportComponent component) => component is IReportComponentContainer container
public static ComponentSettings GetSetting(IReportComponent component) { switch (component.) {