protected void Application_Start()
        {
            DashboardDesignerConfig.RegisterService(RouteTable.Routes);
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder();

            DevExpress.Web.ASPxWebControl.CallbackError += Application_Error;

            DataBaseEditaleDashboardStorage dataBaseDashboardStorage = new DataBaseEditaleDashboardStorage(MVCDashboardDesigner.Properties.Settings.Default.DashboardStorageConnection);

            DashboardConfigurator.Default.SetDashboardStorage(dataBaseDashboardStorage);

            DashboardSqlDataSource sqlDataSource        = new DashboardSqlDataSource("SQL Data Source");
            SelectQuery            customerReportsQuery = SelectQueryFluentBuilder
                                                          .AddTable("CustomerReports")
                                                          .SelectColumn("CompanyName")
                                                          .SelectColumn("ProductName")
                                                          .SelectColumn("OrderDate")
                                                          .SelectColumn("ProductAmount")
                                                          .Build("CustomerReportsQuery");

            sqlDataSource.Queries.Add(customerReportsQuery);

            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            dataSourceStorage.RegisterDataSource("sqlDataSource1", sqlDataSource.SaveToXml());
            DashboardConfigurator.Default.SetDataSourceStorage(dataSourceStorage);
            DashboardConfigurator.Default.ConfigureDataConnection += DataApi_ConfigureDataConnection;
        }
Exemple #2
0
        static Customer()
        {
            SqlDataSource ds    = new SqlDataSource("NWindConnectionString");
            SelectQuery   query = SelectQueryFluentBuilder
                                  .AddTable("Customers")
                                  .SelectAllColumns()
                                  .Build("Customers");

            ds.Queries.Add(query);
            ds.RebuildResultSchema();
            ds.Fill();
            ITable src = ds.Result["Customers"];

            foreach (var row in src)
            {
                customers.Add(new Customer()
                {
                    CustomerID   = row.GetValue <string>("CustomerID"),
                    Address      = row.GetValue <string>("Address"),
                    CompanyName  = row.GetValue <string>("CompanyName"),
                    ContactName  = row.GetValue <string>("ContactName"),
                    ContactTitle = row.GetValue <string>("ContactTitle"),
                    Country      = row.GetValue <string>("Country"),
                    City         = row.GetValue <string>("City"),
                    Fax          = row.GetValue <string>("Fax"),
                    Phone        = row.GetValue <string>("Phone"),
                    PostalCode   = row.GetValue <string>("PostalCode"),
                    Region       = row.GetValue <string>("Region")
                });
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");

            ASPxDashboard1.SetDashboardStorage(dashboardFileStorage);

            // Uncomment this string to allow end users to create new data sources based on predefined connection strings.
            //ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());

            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            // Registers an SQL data source.
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
            SelectQuery            query         = SelectQueryFluentBuilder
                                                   .AddTable("SalesPerson")
                                                   .SelectAllColumns()
                                                   .Build("Sales Person");

            sqlDataSource.Queries.Add(query);
            dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

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

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

            // Registers an Excel data source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");

            excelDataSource.FileName      = HostingEnvironment.MapPath(@"~/App_Data/Sales.xlsx");
            excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));
            dataSourceStorage.RegisterDataSource("excelDataSource", excelDataSource.SaveToXml());

            ASPxDashboard1.SetDataSourceStorage(dataSourceStorage);
        }
Exemple #4
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);

                configurator.ConfigureItemDataCalculation += (s, e) => {
                    e.CalculateAllTotals = true;
                };
                return(configurator);
            });
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");
            //ASPxDashboard1.SetDashboardStorage(dashboardFileStorage);

            ASPxDashboard1.SetDashboardStorage(SessionDashboardStorage.Instance);

            ASPxDashboard1.CustomExport += (s, args) => {
                ChartConstantLinesExtension.CustomExport(args);
            };
            // Uncomment this string to allow end users to create new data sources based on predefined connection strings.
            //ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());

            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            ASPxDashboard1.ConfigureItemDataCalculation += (s, args) => {
                args.CalculateAllTotals = true;
            };
            // Registers an SQL data source.
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
            SelectQuery            query         = SelectQueryFluentBuilder
                                                   .AddTable("SalesPerson")
                                                   .SelectAllColumns()
                                                   .Build("Sales Person");

            sqlDataSource.Queries.Add(query);
            dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

            ASPxDashboard1.SetDataSourceStorage(dataSourceStorage);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");

            ASPxDashboardSql.SetDashboardStorage(dashboardFileStorage);

            // Uncomment the next line to allow users to create new data sources based on predefined connection strings.
            //ASPxDashboardSql.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());

            // Create a data source storage.
            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            // Register an SQL data source.
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
            SelectQuery            query         = SelectQueryFluentBuilder
                                                   .AddTable("SalesPerson")
                                                   .SelectAllColumnsFromTable()
                                                   .Build("Sales Person");

            sqlDataSource.Queries.Add(query);
            dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

            // Set the configured data source storage.
            ASPxDashboardSql.SetDataSourceStorage(dataSourceStorage);

            ASPxDashboardSql.InitialDashboardId = "dashboardSql";
        }
Exemple #7
0
        void RelationshipInitialization()
        {
            SelectQuery categories = SelectQueryFluentBuilder.AddTable("Categories").SelectAllColumns().Build("Categories");
            SelectQuery products   = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumns().Build("Products");

            DataSource.Queries.AddRange(new SqlQuery[] { categories, products });
            DataSource.Relations.Add(new MasterDetailInfo("Categories", "Products", "CategoryID", "CategoryID"));
        }
Exemple #8
0
 static SelectQuery GenerateDefaultQuery()
 {
     return(SelectQueryFluentBuilder
            .AddTable("Suppliers")
            .SelectColumns("CompanyName", "ContactName", "City", "Country")
            .Join("Products", DevExpress.Xpo.DB.JoinType.LeftOuter, "SupplierID", "SupplierID")
            .SelectColumns("ProductName", "UnitPrice")
            .Build("Query1"));
 }
Exemple #9
0
        XtraReport CreateReport()
        {
            // Create a new report instance.
            XtraReport report = new XtraReport();

            // Create a data source.
            SqlDataSource ds = new SqlDataSource(new XmlFileConnectionParameters("../../Cars.xml"));

            // Create a query to access fields of the Cars data table.
            SelectQuery query = SelectQueryFluentBuilder
                                .AddTable("Cars")
                                .SelectColumns("ID", "Trademark", "Model", "Category", "Description")
                                .Build("MyQuery");

            ds.Queries.Add(query);

            // Make the data source structure displayed
            // in the Field List of an End-User Report Designer.
            ds.RebuildResultSchema();

            // Assign the data source to the report.
            report.DataSource = ds;
            report.DataMember = "MyQuery";

            // Add a detail band to the report.
            DetailBand detailBand = new DetailBand();

            report.Bands.Add(detailBand);

            // Add a label to the detail band.
            XRLabel label = new XRLabel {
                WidthF = 300
            };

            label.Text  = "[MyQuery.Trademark] [MyQuery.Model]";
            label.LeftF = 30;
            detailBand.Controls.Add(label);
            detailBand.Height = (int)label.HeightF;

            // Create a group header band and add it to the report.
            GroupHeaderBand ghBand = new GroupHeaderBand();

            report.Bands.Add(ghBand);

            // Create a grouping criteria.
            ghBand.GroupFields.Add(new GroupField("Category"));

            // Display the grouping criteria in the group header.
            XRLabel labelGroup = new XRLabel();

            labelGroup.Text = "[MyQuery.Category]";
            ghBand.Controls.Add(labelGroup);
            ghBand.Height = (int)labelGroup.HeightF;

            return(report);
        }
Exemple #10
0
        public Dictionary <string, object> GetAvailableDataSources()
        {
            var dataSources = new Dictionary <string, object>();

            dataSources.Add("Northwind", CreateDataSource("Northwind_Json", SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products")));
            dataSources.Add("Countries", CreateDataSource("Countries_DevelopmentJson", SelectQueryFluentBuilder.AddTable("Regions").SelectAllColumnsFromTable().Build("Regions")));
            dataSources.Add("Vehicles", CreateDataSource("Vehicles_InMemory", SelectQueryFluentBuilder.AddTable("Model").SelectAllColumnsFromTable().Build("Model")));
            dataSources.Add("Cars", CreateDataSource("Cars_InMemory", SelectQueryFluentBuilder.AddTable("Cars").SelectAllColumnsFromTable().Build("Cars")));
            return(dataSources);
        }
Exemple #11
0
        protected override SqlQuery RunQueryBuilder(SqlQuery query)
        {
            string tableName  = null;
            int    topRecords = 100;

            // Analyze the query that is being edited (if any).
            SelectQuery selectQuery = query as SelectQuery;

            if (selectQuery != null && selectQuery.Tables.Count == 1 && selectQuery.Columns.Count == 1 && string.IsNullOrEmpty(selectQuery.FilterString) && selectQuery.Skip == 0)
            {
                var columns = selectQuery.Columns[0] as AllColumns;
                if (columns != null && columns.Table == null)
                {
                    tableName  = selectQuery.Tables[0].Name;
                    topRecords = selectQuery.Top;
                }
            }
            if (tableName == null && query != null)
            {
                ShowMessage("This query is too complex and cannot be displayed.");
                return(null);
            }

            // Display a custom query builder form.
            using (var form = new FrmQueryBuilder()) {
                form.Initialize(DbTables.Keys.OrderBy(s => s));
                if (tableName != null)
                {
                    form.Selected   = tableName;
                    form.TopRecords = topRecords;
                }
                if (form.ShowDialog(((Control)View).FindForm()) != DialogResult.OK)
                {
                    return(null);
                }
                tableName  = form.Selected;
                topRecords = form.TopRecords;
            }

            // Generate a query based on user input.
            if (string.IsNullOrEmpty(tableName))
            {
                return(null);
            }
            SqlQuery result = SelectQueryFluentBuilder
                              .AddTable(tableName)
                              .SelectAllColumns()
                              .Top(topRecords)
                              .Build(tableName);

            // Make sure that the table columns have been loaded.
            dbSchemaProvider.LoadColumns(Model.DataConnection, DBSchema.Tables.First(t => t.Name == tableName));

            return(result);
        }
        Dictionary <string, object> GetAvailableDataSources()
        {
            var           dataSources = new Dictionary <string, object>();
            SqlDataSource ds          = new SqlDataSource("Northwind_Connection");
            var           query       = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumns().Build("Products");

            ds.Queries.Add(query);
            ds.RebuildResultSchema();
            dataSources.Add("SqlDataSource", ds);
            return(dataSources);
        }
Exemple #13
0
        private IDashboardDataSource CreateSqlDataSource()
        {
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("MySqlDataSource");
            SelectQuery            selectQuery   = SelectQueryFluentBuilder
                                                   .AddTable("SalesPerson")
                                                   .SelectColumns("CategoryName", "SalesPerson", "OrderDate", "ExtendedPrice")
                                                   .Build("MyQuery");

            sqlDataSource.Queries.Add(selectQuery);
            return(sqlDataSource);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddDevExpressControls();
            services.AddMvc()
            .AddDefaultReportingControllers()
            .AddDefaultDashboardController((configurator, serviceProvider) => {
                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());

                // Registers an Object data source.
                DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
                dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml());

                // Registers an Excel data source.
                DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");
                excelDataSource.FileName      = FileProvider.GetFileInfo("Data/Sales.xlsx").PhysicalPath;
                excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));
                dataSourceStorage.RegisterDataSource("excelDataSource", excelDataSource.SaveToXml());

                configurator.SetDataSourceStorage(dataSourceStorage);

                configurator.DataLoading += (s, e) => {
                    if (e.DataSourceName == "Object Data Source")
                    {
                        e.Data = Invoices.CreateData();
                    }
                };
            });
            services.ConfigureReportingServices(configurator => {
                configurator.ConfigureReportDesigner(designerConfigurator => {
                    designerConfigurator.RegisterDataSourceWizardConfigFileConnectionStringsProvider();
                });
            });
            services.AddSpaStaticFiles(configuration => {
                configuration.RootPath = "ClientApp/dist";
            });
        }
Exemple #15
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>();
        }
        public static void ConfigureDataSource(DataSourceInMemoryStorage storage)
        {
            // Registers an SQL data source.
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
            SelectQuery            query         = SelectQueryFluentBuilder
                                                   .AddTable("SalesPerson")
                                                   .SelectAllColumnsFromTable()
                                                   .Build("Sales Person");

            sqlDataSource.Queries.Add(query);
            storage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());
        }
Exemple #17
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("CorsPolicy", builder => {
                    builder.WithOrigins("http://localhost:4200");
                    builder.WithMethods(new String[] { "GET", "POST" });
                    builder.WithHeaders("Content-Type");
                });
            })
            .AddResponseCompression()
            .AddDevExpressControls()
            .AddMvc()
            .AddDefaultDashboardController((configurator, serviceProvider) => {
                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());

                // Registers an Object data source.
                DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
                dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml());

                // Registers an Excel data source.
                DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");
                excelDataSource.FileName      = FileProvider.GetFileInfo("Data/Sales.xlsx").PhysicalPath;
                excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));
                dataSourceStorage.RegisterDataSource("excelDataSource", excelDataSource.SaveToXml());

                configurator.SetDataSourceStorage(dataSourceStorage);

                configurator.DataLoading += (s, e) => {
                    if (e.DataSourceName == "Object Data Source")
                    {
                        e.Data = Invoices.CreateData();
                    }
                };
            });
        }
Exemple #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Create a data source connection.
            Access97ConnectionParameters connectionParameters = new Access97ConnectionParameters("../../nwind.mdb", "", "");
            SqlDataSource ds = new SqlDataSource(connectionParameters);

            // Create a query and specify its SELECT expression.
            SelectQuery query = SelectQueryFluentBuilder
                                .AddTable("Products")
                                .SelectColumn("CategoryID")
                                .GroupBy("CategoryID")
                                .SelectExpression("StDev([Products].[UnitPrice])", "PriceDeviation")
                                .Build("Products");

            //Add the query to the data source.

            ds.Queries.Add(query);

            // Fill the data source.
            ds.Fill();

            // Create a new report and bind it to the data source.
            XtraReport report = new XtraReport();

            report.DataSource = ds;
            report.DataMember = "Products";

            // Create a report layout.
            DetailBand detailBand = new DetailBand();

            detailBand.Height = 50;
            report.Bands.Add(detailBand);

            XRLabel labelCategory = new XRLabel();

            labelCategory.DataBindings.Add("Text", report.DataSource, "Products.CategoryID", "Category ID: {0}");
            labelCategory.TopF = 15;
            detailBand.Controls.Add(labelCategory);

            XRLabel labelDeviation = new XRLabel();

            labelDeviation.DataBindings.Add("Text", report.DataSource, "Products.PriceDeviation", "Price Deviation: {0}");
            labelDeviation.TopF   = 30;
            labelDeviation.WidthF = 500;
            detailBand.Controls.Add(labelDeviation);

            // Publish the report.
            ReportPrintTool pt = new ReportPrintTool(report);

            pt.ShowPreviewDialog();
        }
Exemple #19
0
        private static DashboardSqlDataSource CreateDataSource()
        {
            DashboardSqlDataSource dataSource = new DashboardSqlDataSource();

            dataSource.ConnectionParameters =
                new XmlFileConnectionParameters(@"..\..\Data\WebsiteStatisticsData.xml");
            SelectQuery selectQuery = SelectQueryFluentBuilder
                                      .AddTable("Data")
                                      .SelectColumns("Browser", "BrowserDetails", "Date", "Count")
                                      .Build("Statistics");

            dataSource.Queries.Add(selectQuery);
            return(dataSource);
        }
Exemple #20
0
        void configureQueryPageViewEx_SelectedTableChanged(object sender, SelectedTableChanged e)
        {
            result = null;
            var dbTable = DBSchema.Tables.FirstOrDefault(t => string.Equals(t.Name, e.TableName));

            if (dbTable != null)
            {
                schemaProvider.LoadColumns(Model.DataConnection, dbTable);
                result = SelectQueryFluentBuilder.AddTable(e.TableName)
                         .SelectColumns(dbTable.Columns.Select(c => c.Name).ToArray())
                         .Build(e.TableName);
            }
            RaiseChanged();
        }
        public ActionResult Designer()
        {
            Models.ReportDesignerModel model = new Models.ReportDesignerModel();
            // Create a SQL data source with the specified connection string.
            SqlDataSource ds = new SqlDataSource("NWindConnectionString");
            // Create a SQL query to access the Products data table.
            SelectQuery query = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products");

            ds.Queries.Add(query);
            ds.RebuildResultSchema();
            model.DataSources = new Dictionary <string, object>();
            model.DataSources.Add("Northwind", ds);
            return(View(model));
        }
        void BindToData()
        {
            // Create a SQL data source with the specified connection string.
            SqlDataSource ds = new SqlDataSource("NWindConnectionString");

            // Create a SQL query to access the Products data table.
            SelectQuery query = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products");

            ds.Queries.Add(query);
            ds.RebuildResultSchema();

            // Add the created data source to the list of default data sources.
            ASPxReportDesigner1.DataSources.Add("Northwind", ds);
            ASPxReportDesigner1.OpenReport("Report");
        }
Exemple #23
0
        public static SqlDataSource CreateSqlDataSource()
        {
            MsSqlConnectionParameters connectionParameters = new MsSqlConnectionParameters(".", "NorthWind", null, null, MsSqlAuthorizationType.Windows);
            var sqlDataSource = new SqlDataSource(connectionParameters)
            {
                Name = "Sql_Categories"
            };
            var categoriesQuery = SelectQueryFluentBuilder.AddTable("Categories").
                                  SelectAllColumnsFromTable().
                                  Build("Categories");

            sqlDataSource.Queries.Add(categoriesQuery);
            sqlDataSource.RebuildResultSchema();
            return(sqlDataSource);
        }
        Dictionary <string, object> GetAvailableDataSources()
        {
            //SqlConnection connection = new SqlConnection("data source=(localdb)/mssqllocaldb;initial catalog=aspnet-DXWebApplication1-20200900153700;integrated security=SSPI");
            //connection.Open();
            var           dataSources    = new Dictionary <string, object>();
            SqlDataSource ds             = new SqlDataSource("Northwind_Connection");
            var           productsQuery  = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumns().Build("Products");
            var           customersQuery = SelectQueryFluentBuilder.AddTable("Customers").SelectAllColumns().Build("Customers");

            ds.Queries.Add(productsQuery);
            ds.Queries.Add(customersQuery);
            ds.RebuildResultSchema();
            dataSources.Add("SqlDataSource", ds);
            return(dataSources);
        }
        public static void ConfigureDataSource(DataSourceInMemoryStorage storage)
        {
            // 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")
                                .SelectAllColumnsFromTable()
                                .Build("Products_Categories");

            sqlDataSource.Queries.Add(query);
            storage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());
        }
Exemple #26
0
        void SelectQueryCreation()
        {
            SelectQuery query = SelectQueryFluentBuilder
                                .AddTable("Categories")
                                .SelectColumn("CategoryName")
                                .GroupBy("CategoryName")
                                .Join("Products", "CategoryID")
                                .SelectColumn("ProductName", AggregationType.Count, "ProductCount")
                                .SortBy("ProductName", AggregationType.Count, System.ComponentModel.ListSortDirection.Descending)
                                .GroupFilter("[ProductCount] > 7")
                                .Build("Categories");

            DataSource.Queries.Add(query);

            QueryParameterInitialization(query);
        }
Exemple #27
0
        public DataSourceInMemoryStorage CreateDataSourceStorage()
        {
            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "sqliteConnection");

            sqlDataSource.DataProcessingMode = DataProcessingMode.Client;
            DevExpress.DataAccess.Sql.SelectQuery query = SelectQueryFluentBuilder
                                                          .AddTable("SalesPerson")
                                                          .SelectAllColumns()
                                                          .Build("Sales Person");
            sqlDataSource.Queries.Add(query);
            dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());

            return(dataSourceStorage);
        }
Exemple #28
0
        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);
        }
        public object GetReportDesignerModel([FromForm] string reportUrl)
        {
            Dictionary <string, object> dataSources = new Dictionary <string, object>();
            SqlDataSource ds = new SqlDataSource("SevenR");

            // Create a SQL query to access the Products data table.
            SelectQuery query = SelectQueryFluentBuilder.AddTable("GN_EMPRE").SelectAllColumnsFromTable().Build("GN_EMPRE");

            ds.Queries.Add(query);
            ds.RebuildResultSchema();
            dataSources.Add("Northwind", ds);

            string modelJsonScript = new ReportDesignerClientSideModelGenerator(HttpContext.RequestServices).GetJsonModelScript(reportUrl, dataSources, "/DXXRD", "/DXXRDV", "/DXXQB");

            return(new JavaScriptSerializer().Deserialize <object>(modelJsonScript));
        }
        public static SqlDataSource CreateSqlDataSource()
        {
            string rootPath = Path.GetDirectoryName(typeof(Form1).Assembly.Location);

            SQLiteConnectionParameters connectionParameters =
                new SQLiteConnectionParameters(Path.Combine(rootPath, "nwind.db"), null);
            SqlDataSource sqlDataSource = new SqlDataSource(connectionParameters);

            SelectQuery querySalesPerson = SelectQueryFluentBuilder
                                           .AddTable("Customers")
                                           .SelectAllColumnsFromTable()
                                           .Build("Customers");

            sqlDataSource.Queries.Add(querySalesPerson);
            return(sqlDataSource);
        }