public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, bool filter) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { LoadFromXml(template.Xml, dashboard); foreach (ITypeWrapper typeWrapper in template.DashboardTypes) { ITypeWrapper wrapper = typeWrapper; if (dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { Type dashBoardObjectType = DashBoardObjectType(template, dashboard, typeWrapper); if (dashBoardObjectType != null) { ITypeWrapper wrapper1 = typeWrapper; var dataSource = dashboard.DataSources.First(ds => ds.Name.Equals(wrapper1.Caption)); dataSource.Data = GetObjects(objectSpace, dashBoardObjectType); } } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) dashboard.DataSources.Add(new DashboardObjectDataSource(typeWrapper.Caption, GetObjects(objectSpace, typeWrapper.Type))); } if (filter) Filter(template, dashboard); } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return dashboard; }
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, FilterEnabled filterEnabled) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { if (!string.IsNullOrEmpty(template.Xml)) { dashboard = LoadFromXml(template); dashboard.ApplyModel(filterEnabled, template, objectSpace); } foreach (var typeWrapper in template.DashboardTypes.Select(wrapper => new { wrapper.Type, Caption = GetCaption(wrapper) })) { var wrapper = typeWrapper; var dsource = dashboard.DataSources.FirstOrDefault(source => source.Name.Equals(wrapper.Caption)); var objects = objectSpace.CreateDashboardDataSource(wrapper.Type); if (dsource != null) { dsource.Data = objects; } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { dashboard.AddDataSource(typeWrapper.Caption, objects); } } } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return(dashboard); }
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, FilterEnabled filterEnabled) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { if (!string.IsNullOrEmpty(template.Xml)) { dashboard = LoadFromXml(template); dashboard.ApplyModel(filterEnabled, template, objectSpace); } foreach (var typeWrapper in template.DashboardTypes.Select(wrapper => new { wrapper.Type, Caption = GetCaption(wrapper) })) { var wrapper = typeWrapper; var dsource = dashboard.DataSources.FirstOrDefault(source => source.Name.Equals(wrapper.Caption)); var objects = objectSpace.CreateDashboardDataSource(wrapper.Type); if (dsource != null) { dsource.Data = objects; } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { dashboard.AddDataSource(typeWrapper.Caption, objects); } } } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return dashboard; }
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, bool filter) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { LoadFromXml(template.Xml, dashboard); foreach (ITypeWrapper typeWrapper in template.DashboardTypes) { ITypeWrapper wrapper = typeWrapper; if (dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { Type dashBoardObjectType = DashBoardObjectType(template, dashboard, typeWrapper); if (dashBoardObjectType != null) { ITypeWrapper wrapper1 = typeWrapper; var dataSource = dashboard.DataSources.First(ds => ds.Name.Equals(wrapper1.Caption)); dataSource.Data = GetObjects(objectSpace, dashBoardObjectType); } } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { dashboard.DataSources.Add(new DashboardObjectDataSource(typeWrapper.Caption, GetObjects(objectSpace, typeWrapper.Type))); } } if (filter) { Filter(template, dashboard); } } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return(dashboard); }