Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddResponseCompression()
            .AddDevExpressControls()
            .AddMvc();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

                DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath);
                configurator.SetDashboardStorage(dashboardFileStorage);

                DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

                // Registers an SQL data source.
                DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
                sqlDataSource.DataProcessingMode     = DataProcessingMode.Client;
                SelectQuery query = SelectQueryFluentBuilder
                                    .AddTable("Categories")
                                    .Join("Products", "CategoryID")
                                    .SelectAllColumns()
                                    .Build("Products_Categories");
                sqlDataSource.Queries.Add(query);
                dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

                configurator.SetDataSourceStorage(dataSourceStorage);

                return(configurator);
            });
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddDevExpressControls()
            .AddControllersWithViews();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

                var dataBaseDashboardStorage = new DataBaseEditaleDashboardStorage(
                    Configuration.GetConnectionString("DashboardStorageConnection"));

                configurator.SetDashboardStorage(dataBaseDashboardStorage);

                DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
                DashboardObjectDataSource objDataSource     = new DashboardObjectDataSource("Object Data Source", typeof(SalesPersonData));

                objDataSource.DataMember = "GetSalesData";

                dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());

                configurator.SetDataSourceStorage(dataSourceStorage);

                return(configurator);
            });
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Configures services to use the Web Dashboard Control.
            services
            .AddCors(options => {
                options.AddPolicy("CorsPolicy", builder => {
                    builder.AllowAnyOrigin();
                    builder.AllowAnyMethod();
                    builder.WithHeaders("Content-Type");
                });
            })
            .AddDevExpressControls()
            .AddControllers();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                configurator.SetDashboardStorage(new DashboardFileStorage(FileProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath));
                configurator.SetDataSourceStorage(CreateDataSourceStorage());
                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
                configurator.ConfigureDataConnection += Configurator_ConfigureDataConnection;

                return(configurator);
            });
        }
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
         DashboardConfigurator configurator = new DashboardConfigurator();
         configurator.SetDashboardStorage(new DashboardFileStorage(FileProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath));
         configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
         return(configurator);
     });
     services.AddDevExpressControls();
 }
Example #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddCors(options =>
            {
                options.AddPolicy("AllowAnyOrigin", builder =>
                {
                    builder.AllowAnyOrigin();
                    builder.AllowAnyHeader();
                    builder.AllowAnyMethod();
                });
            })
            .AddMvc();

            services.AddDevExpressControls();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();
                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

                //DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath);
                //configurator.SetDashboardStorage(dashboardFileStorage);

                configurator.SetDashboardStorage(serviceProvider.GetService <SessionDashboardStorage>());
                configurator.CustomExport += (s, e) => {
                    ChartConstantLinesExtension.CustomExport(e);
                };
                configurator.ConfigureItemDataCalculation += (s, e) => {
                    e.CalculateAllTotals = true;
                };

                DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

                // Registers an SQL data source.
                DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
                sqlDataSource.DataProcessingMode     = DataProcessingMode.Client;
                SelectQuery query = SelectQueryFluentBuilder
                                    .AddTable("Categories")
                                    .Join("Products", "CategoryID")
                                    .SelectAllColumns()
                                    .Build("Products_Categories");
                sqlDataSource.Queries.Add(query);
                dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

                return(configurator);
            });

            services
            .AddDistributedMemoryCache()
            .AddSession();
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddTransient <SessionDashboardStorage>();
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddMvc();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                configurator.SetDashboardStorage(new DashboardFileStorage(FileProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath));
                configurator.SetDataSourceStorage(new DataSourceInMemoryStorage());
                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
                configurator.ConfigureDataConnection += Configurator_ConfigureDataConnection;

                return(configurator);
            });
        }
Example #7
0
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddDevExpressControls()
            .AddMvc();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                configurator.SetDashboardStorage(new DashboardFileStorage("Dashboards"));
                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
                configurator.SetDataSourceStorage(CreateDataSourceStorage());
                configurator.ConfigureDataConnection += Configurator_ConfigureDataConnection;

                return(configurator);
            });
        }
Example #8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddResponseCompression()
            .AddDevExpressControls()
            .AddMvc();

            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();
                configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

                DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath);
                configurator.SetDashboardStorage(dashboardFileStorage);

                DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

                // Configures an SQL data source.
                DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
                sqlDataSource.DataProcessingMode     = DataProcessingMode.Client;
                SelectQuery query = SelectQueryFluentBuilder
                                    .AddTable("Orders")
                                    .SelectAllColumnsFromTable()
                                    .Build("SQL Orders");
                sqlDataSource.Queries.Add(query);

                // Configures an Object data source.
                DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
                objDataSource.DataId = "odsInvoices";

                // Configures an Excel data source.
                DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");
                excelDataSource.ConnectionName           = "excelSales";
                excelDataSource.FileName      = FileProvider.GetFileInfo("Data/SalesPerson.xlsx").PhysicalPath;
                excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Data"));

                // Configures a JSON data source.
                DashboardJsonDataSource jsonDataSource = new DashboardJsonDataSource("JSON Data Source");
                jsonDataSource.ConnectionName          = "jsonCategories";
                Uri fileUri = new Uri(FileProvider.GetFileInfo("Data/Categories.json").PhysicalPath, UriKind.RelativeOrAbsolute);
                jsonDataSource.JsonSource = new UriJsonSource(fileUri);

                // Registers a Federated data source.
                dataSourceStorage.RegisterDataSource("federatedDataSource", CreateFederatedDataSource(sqlDataSource,
                                                                                                      excelDataSource, objDataSource, jsonDataSource).SaveToXml());

                configurator.SetDataSourceStorage(dataSourceStorage);

                configurator.DataLoading += (s, e) => {
                    if (e.DataId == "odsInvoices")
                    {
                        e.Data = Invoices.CreateData();
                    }
                };

                configurator.ConfigureDataConnection += (s, e) => {
                    if (e.ConnectionName == "excelSales")
                    {
                        (e.ConnectionParameters as ExcelDataSourceConnectionParameters).FileName = FileProvider.GetFileInfo("Data/SalesPerson.xlsx").PhysicalPath;
                    }
                    else if (e.ConnectionName == "jsonCategories")
                    {
                        UriJsonSource source = new UriJsonSource(new Uri(FileProvider.GetFileInfo("Data/Categories.json").PhysicalPath, UriKind.RelativeOrAbsolute));
                        (e.ConnectionParameters as JsonSourceConnectionParameters).JsonSource = source;
                    }
                };

                return(configurator);
            });
        }