public Form1() { InitializeComponent(); dashboardDesigner1.CreateRibbon(); DataConnectionParametersBase connParameters = CreateConnectionParameters("MSAccess"); DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source 1", connParameters); sqlDataSource.Queries.Add(CreateQuery("fluent")); sqlDataSource.Fill(); dashboardDesigner1.Dashboard = CreateDashboard(sqlDataSource); }
private static DashboardSqlDataSource CreateSQLiteDataSource() { SQLiteConnectionParameters sqliteParams = new SQLiteConnectionParameters(); sqliteParams.FileName = @"Data\nwind.db"; DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQLite Data Source", sqliteParams); SelectQuery selectQuery = SelectQueryFluentBuilder .AddTable("Orders") .SelectAllColumnsFromTable() .Build("SQLite Orders"); sqlDataSource.Queries.Add(selectQuery); sqlDataSource.Fill(); return(sqlDataSource); }
private DashboardSqlDataSource CreateDataSource() { CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(); connectionParameters.ConnectionString = @"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;" + @"AttachDbFilename=|DataDirectory|\NW19.mdf;" + @"Integrated Security=True"; DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("NW19 SQL Server Database File", connectionParameters); // Comment out two lines to use CustomSqlQuery and SQL string expression. SelectQuery selectQuery = CreateSqlQuery(); sqlDataSource.Queries.Add(selectQuery); // Uncomment two lines to to use CustomSqlQuery and SQL string expression. //CustomSqlQuery selectQuery = CreateSqlStringQuery(); //sqlDataSource.Queries.Add(selectQuery); sqlDataSource.CalculatedFields.AddRange(CreateCalculatedFields(selectQuery)); sqlDataSource.Fill(); return(sqlDataSource); }
public Form1() { InitializeComponent(); Dashboard dashboard = new Dashboard(); XmlFileConnectionParameters xmlParams = new XmlFileConnectionParameters(); xmlParams.FileName = @"..\..\Data\DashboardProductDetails.xml"; DashboardSqlDataSource xmlDataSource = new DashboardSqlDataSource("Data Source 1", xmlParams); SelectQuery selectQuery = SelectQueryFluentBuilder .AddTable("Products") .SelectColumns("Id", "Name", "Description") .Build("Query 1"); xmlDataSource.Queries.Add(selectQuery); xmlDataSource.Fill(); dashboard.DataSources.Add(xmlDataSource); BoundImageDashboardItem boundImage = new BoundImageDashboardItem(); boundImage.DataSource = xmlDataSource; boundImage.DataMember = "Query 1"; boundImage.DataBindingMode = ImageDataBindingMode.Uri; boundImage.ImageDimension = new Dimension("Name"); boundImage.UriPattern = @"..\..\ProductDetailsImages\{0}.jpg"; boundImage.SizeMode = ImageSizeMode.Stretch; ListBoxDashboardItem comboBox = new ListBoxDashboardItem(); comboBox.ShowCaption = false; comboBox.DataSource = xmlDataSource; comboBox.DataMember = "Query 1"; comboBox.FilterDimensions.Add(new Dimension("Name")); comboBox.ListBoxType = ListBoxDashboardItemType.Radio; comboBox.ShowAllValue = false; dashboard.Items.AddRange(comboBox, boundImage); dashboardViewer1.Dashboard = dashboard; }
static IDashboardDataSource CreateDataSourceCopy(IDashboardDataSource dataSourceToCopy) { DashboardEFDataSource efDataSource = dataSourceToCopy as DashboardEFDataSource; if (efDataSource != null) { XElement element = efDataSource.SaveToXml(); DashboardEFDataSource newDataSource = new DashboardEFDataSource(); newDataSource.LoadFromXml(element); newDataSource.Fill(); return(newDataSource); } DashboardExcelDataSource excelDataSource = dataSourceToCopy as DashboardExcelDataSource; if (excelDataSource != null) { XElement element = excelDataSource.SaveToXml(); DashboardExcelDataSource newDataSource = new DashboardExcelDataSource(); newDataSource.LoadFromXml(element); newDataSource.Fill(); return(newDataSource); } DashboardExtractDataSource extractDataSource = dataSourceToCopy as DashboardExtractDataSource; if (extractDataSource != null) { XElement element = extractDataSource.SaveToXml(); DashboardExtractDataSource newDataSource = new DashboardExtractDataSource(); newDataSource.LoadFromXml(element); return(newDataSource); } DashboardObjectDataSource objectDataSource = dataSourceToCopy as DashboardObjectDataSource; if (objectDataSource != null) { XElement element = objectDataSource.SaveToXml(); DashboardObjectDataSource newDataSource = new DashboardObjectDataSource(); newDataSource.LoadFromXml(element); newDataSource.Fill(); return(newDataSource); } DashboardOlapDataSource olapDataSource = dataSourceToCopy as DashboardOlapDataSource; if (olapDataSource != null) { XElement element = olapDataSource.SaveToXml(); DashboardOlapDataSource newDataSource = new DashboardOlapDataSource(); newDataSource.LoadFromXml(element); newDataSource.Fill(); return(newDataSource); } DashboardSqlDataSource sqlDataSource = dataSourceToCopy as DashboardSqlDataSource; if (sqlDataSource != null) { XElement element = sqlDataSource.SaveToXml(); DashboardSqlDataSource newDataSource = new DashboardSqlDataSource(); newDataSource.LoadFromXml(element); newDataSource.Fill(); return(newDataSource); } return(null); }