Skip to content

Commit 67f1257

Browse files
author
Natalia Kazakova
committed
add CS solution
1 parent 46b79df commit 67f1257

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+109755
-0
lines changed

CS/WebDashboardAspNetCore3.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29403.142
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDashboardAspNetCore3", "WebDashboardAspNetCore3\WebDashboardAspNetCore3.csproj", "{36E139CA-076D-4BDE-A446-82AE58CCDEFA}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{36E139CA-076D-4BDE-A446-82AE58CCDEFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{36E139CA-076D-4BDE-A446-82AE58CCDEFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{36E139CA-076D-4BDE-A446-82AE58CCDEFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{36E139CA-076D-4BDE-A446-82AE58CCDEFA}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {01672CB1-7A2C-416F-A69C-5A7BA7DFA696}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.Extensions.Logging;
8+
using WebDashboardAspNetCore3.Models;
9+
10+
namespace WebDashboardAspNetCore3.Controllers {
11+
public class HomeController: Controller {
12+
private readonly ILogger<HomeController> _logger;
13+
14+
public HomeController(ILogger<HomeController> logger) {
15+
_logger = logger;
16+
}
17+
18+
public IActionResult Index() {
19+
return View();
20+
}
21+
22+
public IActionResult Privacy() {
23+
return View();
24+
}
25+
26+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
27+
public IActionResult Error() {
28+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
29+
}
30+
}
31+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Dashboard>
3+
<Title Text="New Dashboard" />
4+
<DataSources>
5+
<SqlDataSource Name="Categories" ComponentName="sqlDataSource1">
6+
<Connection Name="nwind" FromAppConfig="true" />
7+
<Query Type="SelectQuery" Name="Categories">
8+
<Tables>
9+
<Table Name="Categories" />
10+
</Tables>
11+
<Columns>
12+
<Column Table="Categories" Name="CategoryID" />
13+
<Column Table="Categories" Name="CategoryName" />
14+
<Column Table="Categories" Name="Description" />
15+
<Column Table="Categories" Name="Picture" />
16+
<Column Table="Categories" Name="Icon_17" />
17+
<Column Table="Categories" Name="Icon_25" />
18+
</Columns>
19+
</Query>
20+
<ConnectionOptions CloseConnection="true" />
21+
</SqlDataSource>
22+
</DataSources>
23+
<Items>
24+
<Grid ComponentName="gridDashboardItem1" Name="Grid 1" ShowCaption="false" DataSource="sqlDataSource1" DataMember="Categories">
25+
<DataItems>
26+
<Dimension DataMember="CategoryName" DefaultId="DataItem0" />
27+
<Dimension DataMember="Description" DefaultId="DataItem1" />
28+
<Dimension DataMember="Picture" DefaultId="DataItem2" />
29+
</DataItems>
30+
<GridColumns>
31+
<GridDimensionColumn>
32+
<Dimension DefaultId="DataItem0" />
33+
</GridDimensionColumn>
34+
<GridDimensionColumn>
35+
<Dimension DefaultId="DataItem1" />
36+
</GridDimensionColumn>
37+
<GridDimensionColumn DisplayMode="Image">
38+
<Dimension DefaultId="DataItem2" />
39+
</GridDimensionColumn>
40+
</GridColumns>
41+
<GridOptions />
42+
</Grid>
43+
</Items>
44+
<LayoutTree>
45+
<LayoutGroup>
46+
<LayoutItem DashboardItem="gridDashboardItem1" />
47+
</LayoutGroup>
48+
</LayoutTree>
49+
</Dashboard>

CS/WebDashboardAspNetCore3/Data/nwind.xml

Lines changed: 31143 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace WebDashboardAspNetCore3.Models {
4+
public class ErrorViewModel {
5+
public string RequestId { get; set; }
6+
7+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
8+
}
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.Configuration;
7+
using Microsoft.Extensions.Hosting;
8+
using Microsoft.Extensions.Logging;
9+
10+
namespace WebDashboardAspNetCore3 {
11+
public class Program {
12+
public static void Main(string[] args) {
13+
CreateHostBuilder(args).Build().Run();
14+
}
15+
16+
public static IHostBuilder CreateHostBuilder(string[] args) =>
17+
Host.CreateDefaultBuilder(args)
18+
.ConfigureWebHostDefaults(webBuilder => {
19+
webBuilder.UseStartup<Startup>();
20+
});
21+
}
22+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using DevExpress.AspNetCore;
2+
using DevExpress.DashboardAspNetCore;
3+
using DevExpress.DashboardWeb;
4+
using Microsoft.AspNetCore.Builder;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.Configuration;
7+
using Microsoft.Extensions.DependencyInjection;
8+
using Microsoft.Extensions.FileProviders;
9+
using Microsoft.Extensions.Hosting;
10+
11+
namespace WebDashboardAspNetCore3 {
12+
public class Startup {
13+
public Startup(IConfiguration configuration, IWebHostEnvironment hostingEnvironment) {
14+
Configuration = configuration;
15+
FileProvider = hostingEnvironment.ContentRootFileProvider;
16+
}
17+
18+
public IConfiguration Configuration { get; }
19+
public IFileProvider FileProvider { get; }
20+
21+
// This method gets called by the runtime. Use this method to add services to the container.
22+
public void ConfigureServices(IServiceCollection services) {
23+
services
24+
.AddDevExpressControls()
25+
.AddControllersWithViews()
26+
.AddDefaultDashboardController(configurator => {
27+
configurator.SetDashboardStorage(new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath));
28+
configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
29+
});
30+
}
31+
32+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
33+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
34+
if(env.IsDevelopment()) {
35+
app.UseDeveloperExceptionPage();
36+
} else {
37+
app.UseExceptionHandler("/Home/Error");
38+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
39+
app.UseHsts();
40+
}
41+
app.UseHttpsRedirection();
42+
app.UseStaticFiles();
43+
app.UseDevExpressControls();
44+
app.UseRouting();
45+
app.UseAuthorization();
46+
app.UseEndpoints(endpoints => {
47+
EndpointRouteBuilderExtension.MapDashboardRoute(endpoints, "api/dashboards");
48+
endpoints.MapControllerRoute(
49+
name: "default",
50+
pattern: "{controller=Home}/{action=Index}/{id?}");
51+
});
52+
}
53+
}
54+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@{
2+
Layout = null;
3+
}
4+
<!-- Add the following namespace usages: -->
5+
@using DevExpress.AspNetCore
6+
@using DevExpress.DashboardWeb
7+
@using DevExpress.DashboardAspNetCore
8+
9+
<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<!-- Add bundled resources. -->
13+
<link href="~/css/site.min.css" rel="stylesheet" />
14+
<script src="~/js/site.min.js"></script>
15+
</head>
16+
<body>
17+
<!-- Add the Web Dashboard with the "clientDashboardControl1" name to a View, specify its size, and set the Working Mode to Designer. -->
18+
<div style="position: absolute; left:0;top:0;right:0;bottom:0;">
19+
@(Html.DevExpress().Dashboard("clientDashboardControl1")
20+
.WorkingMode(WorkingMode.Designer)
21+
.Width("100%")
22+
.Height("100%")
23+
)
24+
</div>
25+
</body>
26+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@{
2+
ViewData["Title"] = "Privacy Policy";
3+
}
4+
<h1>@ViewData["Title"]</h1>
5+
6+
<p>Use this page to detail your site's privacy policy.</p>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@model ErrorViewModel
2+
@{
3+
ViewData["Title"] = "Error";
4+
}
5+
6+
<h1 class="text-danger">Error.</h1>
7+
<h2 class="text-danger">An error occurred while processing your request.</h2>
8+
9+
@if (Model.ShowRequestId)
10+
{
11+
<p>
12+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
13+
</p>
14+
}
15+
16+
<h3>Development Mode</h3>
17+
<p>
18+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
</p>
20+
<p>
21+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
22+
It can result in displaying sensitive information from exceptions to end users.
23+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
24+
and restarting the app.
25+
</p>

0 commit comments

Comments
 (0)