private bool IsSamplesWebResource(RVDataSourceItem dataSourceItem) { if (dataSourceItem is RVExcelDataSourceItem excelItem) { var wrItem = excelItem.ResourceItem as RVWebResourceDataSourceItem; return(wrItem != null && wrItem.Url.EndsWith("Samples.xlsx")); } return(false); }
private RVDataSourceItem CreateLocalSamplesDataSourceItem(RVDataSourceItem dataSourceItem) { if (dataSourceItem is RVExcelDataSourceItem excelItem) { var localItem = new RVLocalFileDataSourceItem(); localItem.Uri = "local:/Samples.xlsx"; excelItem.ResourceItem = localItem; return(excelItem); } return(dataSourceItem); }
private RVDataSourceItem ChangeDataSourceItem(RVDataSourceItem dataSourceItem) { var sqlServerDS = new RVSqlServerDataSource(); sqlServerDS.Host = "0.0.0.0"; // Provide host sqlServerDS.Database = "Database"; // Provide database var sqlServerDsi = new RVSqlServerDataSourceItem(sqlServerDS); sqlServerDsi.Database = "Database"; // Provide database sqlServerDsi.Table = "Marketing"; // Provide table return(sqlServerDsi); }
private RVDataSourceItem ChangeDataSourceItem(RVDataSourceItem dataSourceItem) { var excelItem = dataSourceItem as RVExcelDataSourceItem; var wrItem = excelItem?.ResourceItem as RVWebResourceDataSourceItem; if (wrItem != null && wrItem.Url.EndsWith("Samples.xlsx")) { var localItem = new RVLocalFileDataSourceItem(); localItem.Uri = "local:/Marketing.xlsx"; excelItem.ResourceItem = localItem; return(excelItem); } else { return(null); } }
public Task <RVDataSourceItem> ChangeDashboardFilterDataSourceItemAsync(RVDashboardFilter filter, RVDataSourceItem dataSourceItem) { if (IsSamplesWebResource(dataSourceItem)) { return(Task.FromResult(CreateLocalSamplesDataSourceItem(dataSourceItem))); } else { return(Task.FromResult <RVDataSourceItem>(null)); } }
public Task <RVDataSourceItem> ChangeVisualizationDataSourceItemAsync(RVVisualization visualization, RVDataSourceItem dataSourceItem) { if (IsSamplesWebResource(dataSourceItem)) { return(Task.FromResult(CreateLocalSamplesDataSourceItem(dataSourceItem))); } else { return(Task.FromResult <RVDataSourceItem>(null)); } }
public Task <RVDataSourceItem> ChangeVisualizationDataSourceItemAsync(string userId, string dashboardId, RVVisualization visualization, RVDataSourceItem dataSourceItem) { return(Task.FromResult <RVDataSourceItem>(ChangeDataSourceItem(dataSourceItem))); }
public Task <RVDataSourceItem> ChangeDashboardFilterDataSourceItemAsync(string userId, string dashboardId, RVDashboardFilter filter, RVDataSourceItem dataSourceItem) { return(Task.FromResult <RVDataSourceItem>(ChangeDataSourceItem(dataSourceItem))); }
private RVDataSourceItem ChangeDataSourceItem(RVDataSourceItem dataSourceItem) { return(new RVInMemoryDataSourceItem("Marketing")); }