GetAmountDto()
25 | {
26 | return Context.Task.GroupBy(x => new { x.PlanTime, x.IsImportant }).Select(x => new ChartAmountDto()
27 | {
28 | Day = x.Key.PlanTime.ToString("yy-MM-dd"),
29 | Type = x.Key.IsImportant ? "普通" : "重要",
30 | Value = x.Count(),
31 | }).ToList();
32 |
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Server/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ToDo.Server.Pages.ErrorModel
3 | @{
4 | Layout = "_Layout";
5 | ViewData["Title"] = "Error";
6 | }
7 |
8 | Error.
9 | An error occurred while processing your request.
10 |
11 | @if (Model.ShowRequestId)
12 | {
13 |
14 | Request ID: @Model.RequestId
15 |
16 | }
17 |
18 | Development Mode
19 |
20 | Swapping to the Development environment displays detailed information about the error that occurred.
21 |
22 |
23 | The Development environment shouldn't be enabled for deployed applications.
24 | It can result in displaying sensitive information from exceptions to end users.
25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
26 | and restarting the app.
27 |
28 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Server/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Microsoft.AspNetCore.Mvc.RazorPages;
3 | using Microsoft.Extensions.Logging;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Diagnostics;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Performance.Server.Pages
11 | {
12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13 | [IgnoreAntiforgeryToken]
14 | public class ErrorModel : PageModel
15 | {
16 | public string RequestId { get; set; }
17 |
18 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
19 |
20 | private readonly ILogger _logger;
21 |
22 | public ErrorModel(ILogger logger)
23 | {
24 | _logger = logger;
25 | }
26 |
27 | public void OnGet()
28 | {
29 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance.Gateway/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Performance.Gateway
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.ConfigureAppConfiguration((hostContext, config) =>
24 | {
25 | config.AddJsonFile("Ocelot.json");
26 | })
27 | .UseStartup();
28 | });
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo.Gateway/Ocelot.json:
--------------------------------------------------------------------------------
1 | {
2 | "Routes": [
3 | {
4 | "UpstreamPathTemplate": "/api/{url}",
5 | "UpstreamHttpMethod": [ "Get", "Post", "Put", "Delete" ],
6 |
7 | "DownstreamPathTemplate": "/api/{url}",
8 | "DownstreamScheme": "http",
9 | "DownstreamHostAndPorts": [
10 | {
11 | "Host": "localhost",
12 | "Port": 5000
13 | }
14 | ],
15 |
16 | "LoadBalancerOptions": {
17 | "Type": "RoundRobin"
18 | }
19 | },
20 | {
21 | "UpstreamPathTemplate": "/{url}",
22 | "UpstreamHttpMethod": [ "Get", "Post", "Put", "Delete" ],
23 |
24 | "DownstreamPathTemplate": "/{url}",
25 | "DownstreamScheme": "http",
26 | "DownstreamHostAndPorts": [
27 | {
28 | "Host": "localhost",
29 | "Port": 4000
30 | }
31 | ],
32 |
33 | "LoadBalancerOptions": {
34 | "Type": "RoundRobin"
35 | }
36 | }
37 | ],
38 | "GlobalConfiguration": {
39 | "BaseUrl": "https://api.mybusiness.com"
40 | }
41 | }
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Shared/OrgDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.ComponentModel.DataAnnotations;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Performance.Shared
10 | {
11 | public class OrgDto
12 | {
13 | ///
14 | /// 机构/部门
15 | ///
16 | public Guid OrganizationId { get; set; }
17 | ///
18 | /// 父ID
19 | ///
20 | public Guid? ParentId { get; set; }
21 | [Required]
22 | [StringLength(50)]
23 | [DisplayName("名称")]
24 | public string Name { get; set; }
25 | [StringLength(100)]
26 | [DisplayName("地址")]
27 | public string Address { get; set; }
28 | [StringLength(100)]
29 | [DisplayName("电话")]
30 | public string Phone { get; set; }
31 | [StringLength(100)]
32 | [DisplayName("描述")]
33 | public string Description { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5000",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:57953",
7 | "sslPort": 44322
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "ToDo.Server": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:58308",
7 | "sslPort": 44320
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15 | "environmentVariables": {
16 | "ASPNETCORE_ENVIRONMENT": "Development"
17 | }
18 | },
19 | "Performance": {
20 | "commandName": "Project",
21 | "dotnetRunMessages": "true",
22 | "launchBrowser": true,
23 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Client/TaskServices.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Net.Http;
6 | using System.Net.Http.Json;
7 | using System.Threading.Tasks;
8 | using ToDo.Shared;
9 |
10 | namespace ToDo.Client
11 | {
12 | public class TaskServices
13 | {
14 |
15 | public HttpClient Http { get; set; }
16 |
17 | public TaskServices(HttpClient http)
18 | {
19 | Http = http;
20 | }
21 |
22 | public async Task> LoadToDay()
23 | {
24 | return await Http.GetFromJsonAsync>("api/Task/GetToDayTask");
25 |
26 | }
27 | public async Task> LoadStar()
28 | {
29 | return await Http.GetFromJsonAsync>("api/Task/GetStarTask");
30 |
31 | }
32 |
33 | public async Task> LoadSearch(string title)
34 | {
35 | return await Http.GetFromJsonAsync>("api/Task/GetSearch");
36 |
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Client/Pages/TaskSearch.razor:
--------------------------------------------------------------------------------
1 | @page "/search"
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @context.Title
10 | @if (context.IsImportant)
11 | {
12 | 重要
13 | }
14 |
15 |
16 |
17 |
18 |
19 | @if (context.IsFinish)
20 | {
21 |
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Client/Pages/TaskSearch.razor:
--------------------------------------------------------------------------------
1 | @page "/search"
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @context.Title
10 | @if (context.IsImportant)
11 | {
12 | 重要
13 | }
14 |
15 |
16 |
17 |
18 |
19 | @if (context.IsFinish)
20 | {
21 |
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Client/Pages/TaskSearch.razor:
--------------------------------------------------------------------------------
1 | @page "/search"
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @context.Title
10 | @if (context.IsImportant)
11 | {
12 | 重要
13 | }
14 |
15 |
16 |
17 |
18 |
19 | @if (context.IsFinish)
20 | {
21 |
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Client/Pages/TaskSearch.razor:
--------------------------------------------------------------------------------
1 | @page "/search"
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @context.Title
10 | @if (context.IsImportant)
11 | {
12 | 重要
13 | }
14 |
15 |
16 |
17 |
18 |
19 | @if (context.IsFinish)
20 | {
21 |
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Client/Pages/TaskSearch.razor:
--------------------------------------------------------------------------------
1 | @page "/search"
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @context.Title
10 | @if (context.IsImportant)
11 | {
12 | 重要
13 | }
14 |
15 |
16 |
17 |
18 |
19 | @if (context.IsFinish)
20 | {
21 |
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Server/Program.cs:
--------------------------------------------------------------------------------
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 ToDo.Server
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args)
20 | {
21 | var configuration = new ConfigurationBuilder().AddCommandLine(args).Build();
22 | return Host.CreateDefaultBuilder(args)
23 | .ConfigureWebHostDefaults(webBuilder =>
24 | {
25 | webBuilder
26 | .UseUrls($"http://*:{configuration["httpport"] ?? "5000"}", $"https://*:{configuration["httpsport"] ?? "5001"}")
27 | .UseStartup();
28 | });
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5000",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | },
17 | "ancmHostingModel": "OutOfProcess",
18 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
19 | },
20 | "Performance.Server": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "Org",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | },
27 | "dotnetRunMessages": "true",
28 | "applicationUrl": "http://localhost:5000",
29 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Client/Performance.Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | 9.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Client/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
4 |
5 |
6 | 进击吧!Blazor!
7 |
8 |
19 |
20 |
21 | @Body
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Client/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
4 |
5 |
6 | 进击吧!Blazor!
7 |
8 |
19 |
20 |
21 | @Body
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Client/Shared/NavMenu.razor.cs:
--------------------------------------------------------------------------------
1 | using AntDesign;
2 | using Microsoft.AspNetCore.Components;
3 | using Microsoft.AspNetCore.Components.Authorization;
4 | using Performance.Client.Core;
5 | using Performance.Client.Pages;
6 | using Performance.Shared;
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 | using System.Threading.Tasks;
11 |
12 | namespace Performance.Client.Shared
13 | {
14 | public partial class NavMenu
15 | {
16 | [Inject] public DrawerService DrawerSvr { get; set; }
17 |
18 | [Inject] public AuthenticationStateProvider AuthProvider { get; set; }
19 |
20 | private string UserName => (AuthProvider as AuthProvider)?.UserName;
21 |
22 | async void OnLogin()
23 | {
24 | var result = await DrawerSvr.CreateDialogAsync(null, title: $"登录", width: 450);
25 | if (result != null)
26 | {
27 | ((AuthProvider)AuthProvider).MarkUserAsAuthenticated(result);
28 | }
29 | }
30 |
31 | void OnOutLogin()
32 | {
33 | ((AuthProvider)AuthProvider).MarkUserAsLoggedOut();
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance.Entity/efpt.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ContextClassName": "PerformanceContext",
3 | "ContextNamespace": null,
4 | "DefaultDacpacSchema": null,
5 | "FilterSchemas": false,
6 | "IncludeConnectionString": false,
7 | "ModelNamespace": null,
8 | "OutputContextPath": null,
9 | "OutputPath": null,
10 | "ProjectRootNamespace": "Performance.Entity",
11 | "Schemas": null,
12 | "SelectedHandlebarsLanguage": 0,
13 | "SelectedToBeGenerated": 0,
14 | "Tables": [
15 | {
16 | "HasPrimaryKey": true,
17 | "Name": "[dbo].[Achievement]"
18 | },
19 | {
20 | "HasPrimaryKey": true,
21 | "Name": "[dbo].[IndexLibrary]"
22 | },
23 | {
24 | "HasPrimaryKey": true,
25 | "Name": "[dbo].[Organization]"
26 | },
27 | {
28 | "HasPrimaryKey": true,
29 | "Name": "[dbo].[OrganizationIndex]"
30 | }
31 | ],
32 | "UseDatabaseNames": false,
33 | "UseDbContextSplitting": false,
34 | "UseFluentApiOnly": false,
35 | "UseHandleBars": false,
36 | "UseInflector": false,
37 | "UseLegacyPluralizer": false,
38 | "UseNodaTime": false,
39 | "UseSpatial": false,
40 | "UseStoredProcedures": false
41 | }
--------------------------------------------------------------------------------
/ToDo S7/ToDo.Gateway/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Http;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using Ocelot.DependencyInjection;
7 | using Ocelot.Middleware;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Threading.Tasks;
12 |
13 | namespace ToDo.Gateway
14 | {
15 | public class Startup
16 | {
17 | // This method gets called by the runtime. Use this method to add services to the container.
18 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
19 | public void ConfigureServices(IServiceCollection services)
20 | {
21 | services.AddOcelot();
22 | }
23 |
24 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
25 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
26 | {
27 | if (env.IsDevelopment())
28 | {
29 | app.UseDeveloperExceptionPage();
30 | }
31 | app.UseOcelot();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Server/Performance.Server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | 9.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance.Entity/OrganizationIndex.cs:
--------------------------------------------------------------------------------
1 | // This file has been auto generated by EF Core Power Tools.
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel.DataAnnotations;
5 | using System.ComponentModel.DataAnnotations.Schema;
6 | using Microsoft.EntityFrameworkCore;
7 |
8 | #nullable disable
9 |
10 | namespace Performance.Entity
11 | {
12 | [Table("OrganizationIndex")]
13 | public partial class OrganizationIndex
14 | {
15 | ///
16 | /// 部门绑定指标
17 | ///
18 | [Key]
19 | public Guid OrganizationIndexId { get; set; }
20 | ///
21 | /// 机构/部门
22 | ///
23 | public Guid OrganizationId { get; set; }
24 | ///
25 | /// 指标
26 | ///
27 | public Guid IndexLibraryId { get; set; }
28 |
29 | [ForeignKey(nameof(IndexLibraryId))]
30 | [InverseProperty("OrganizationIndices")]
31 | public virtual IndexLibrary IndexLibrary { get; set; }
32 | [ForeignKey(nameof(OrganizationId))]
33 | [InverseProperty("OrganizationIndices")]
34 | public virtual Organization Organization { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Client/Pages/TaskInfo.razor:
--------------------------------------------------------------------------------
1 | @inherits DrawerTemplate
2 |
3 |
4 | @if (taskDto != null)
5 | {
6 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Client/Pages/TaskInfo.razor:
--------------------------------------------------------------------------------
1 | @inherits DrawerTemplate
2 |
3 |
4 | @if (taskDto != null)
5 | {
6 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Client/Pages/TaskInfo.razor:
--------------------------------------------------------------------------------
1 | @inherits DrawerTemplate
2 |
3 |
4 | @if (taskDto != null)
5 | {
6 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Client/Pages/TaskInfo.razor:
--------------------------------------------------------------------------------
1 | @inherits DrawerTemplate
2 |
3 |
4 | @if (taskDto != null)
5 | {
6 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Client/Pages/TaskInfo.razor:
--------------------------------------------------------------------------------
1 | @inherits DrawerTemplate
2 |
3 |
4 | @if (taskDto != null)
5 | {
6 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance.Gateway/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Http;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using Ocelot.DependencyInjection;
7 | using Ocelot.Middleware;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Threading.Tasks;
12 |
13 | namespace Performance.Gateway
14 | {
15 | public class Startup
16 | {
17 | // This method gets called by the runtime. Use this method to add services to the container.
18 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
19 | public void ConfigureServices(IServiceCollection services)
20 | {
21 | services.AddOcelot();
22 | }
23 |
24 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
25 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
26 | {
27 | if (env.IsDevelopment())
28 | {
29 | app.UseDeveloperExceptionPage();
30 | }
31 | app.UseOcelot();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 | using System.Text;
6 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 | using Microsoft.Extensions.Logging;
10 | using Microsoft.AspNetCore.Components.Authorization;
11 |
12 | namespace ToDo.Client
13 | {
14 | public class Program
15 | {
16 | public static async Task Main(string[] args)
17 | {
18 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
19 | builder.RootComponents.Add("app");
20 |
21 | builder.Services.AddAntDesign();
22 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri($"http://localhost:5500") });
23 |
24 | builder.Services.AddScoped();
25 |
26 | builder.Services.AddAuthorizationCore(option =>
27 | {
28 | option.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
29 |
30 | });
31 | builder.Services.AddScoped();
32 |
33 | await builder.Build().RunAsync();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Server/Controllers/ChartController.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Microsoft.AspNetCore.Mvc;
3 | using Performance.Entity;
4 | using Performance.Shared;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Performance.Server.Controllers
11 | {
12 | [ApiController]
13 | [Route("api/[controller]/[action]")]
14 | public class ChartController : ControllerBase
15 | {
16 | PerformanceContext Context;
17 | IMapper Mapper;
18 | public ChartController(PerformanceContext context, IMapper mapper)
19 | {
20 | Context = context;
21 | Mapper = mapper;
22 | }
23 |
24 | [HttpGet]
25 | public ResultDataSet GetIndexLibraryColumn(Guid indexId)
26 | {
27 | var result = Context.Achievements.Where(x => x.IndexLibraryId == indexId).Select(x => new IndexLibraryChartDto()
28 | {
29 | Year = x.Year,
30 | OrgId=x.OrganizationId,
31 | OrgName = x.Organization.Name,
32 | ActualValue = x.ActualValue ?? 0,
33 | }).OrderBy(x=>x.Year).ToList();
34 | return new(result);
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ToDo S2/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S3/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 | using System.Text;
6 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 | using Microsoft.Extensions.Logging;
10 | using Microsoft.AspNetCore.Components.Authorization;
11 |
12 | namespace ToDo.Client
13 | {
14 | public class Program
15 | {
16 | public static async Task Main(string[] args)
17 | {
18 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
19 | builder.RootComponents.Add("app");
20 |
21 | builder.Services.AddAntDesign();
22 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
23 |
24 | builder.Services.AddScoped();
25 |
26 | builder.Services.AddAuthorizationCore(option =>
27 | {
28 | option.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
29 |
30 | });
31 | builder.Services.AddScoped();
32 |
33 | await builder.Build().RunAsync();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 | using System.Text;
6 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 | using Microsoft.Extensions.Logging;
10 | using Microsoft.AspNetCore.Components.Authorization;
11 |
12 | namespace ToDo.Client
13 | {
14 | public class Program
15 | {
16 | public static async Task Main(string[] args)
17 | {
18 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
19 | builder.RootComponents.Add("app");
20 |
21 | builder.Services.AddAntDesign();
22 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
23 |
24 | builder.Services.AddScoped();
25 |
26 | builder.Services.AddAuthorizationCore(option =>
27 | {
28 | option.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
29 |
30 | });
31 | builder.Services.AddScoped();
32 |
33 | await builder.Build().RunAsync();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Shared/TaskDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace ToDo.Shared
7 | {
8 | public class TaskDto
9 | {
10 | ///
11 | /// 主键
12 | ///
13 | public Guid TaskId { get; set; }
14 |
15 | ///
16 | /// 标题
17 | ///
18 | [DisplayName("标题")]
19 | public string Title { get; set; }
20 |
21 | ///
22 | /// 描述
23 | ///
24 | [DisplayName("描述")]
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// 计划日期
29 | ///
30 | [DisplayName("计划日期")]
31 | public DateTime PlanTime { get; set; }
32 |
33 | ///
34 | /// 截止日期
35 | ///
36 | [DisplayName("截止日期")]
37 | public DateTime? Deadline { get; set; }
38 |
39 | ///
40 | /// 是否重要
41 | ///
42 | [DisplayName("重要")]
43 | public bool IsImportant { get; set; }
44 |
45 | ///
46 | /// 完成
47 | ///
48 | [DisplayName("完成")]
49 | public bool IsFinish { get; set; }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Client/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
4 |
5 |
6 | 进击吧!Blazor!
7 |
8 |
22 |
23 |
24 | @Body
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ToDo S4/ToDo/Client/Pages/ToDay.razor:
--------------------------------------------------------------------------------
1 | @page "/today"
2 |
3 |
4 |
5 |
6 | @foreach (var item in taskDtos)
7 | {
8 |
9 |
10 | @item.Title
11 |
12 |
13 | @item.Description
14 |
15 |
16 |
17 | }
18 |
19 |
20 |
21 |
22 | 重要
23 | 普通
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ToDo S5/ToDo/Client/Pages/ToDay.razor:
--------------------------------------------------------------------------------
1 | @page "/today"
2 |
3 |
4 |
5 |
6 | @foreach (var item in taskDtos)
7 | {
8 |
9 |
10 | @item.Title
11 |
12 |
13 | @item.Description
14 |
15 |
16 |
17 | }
18 |
19 |
20 |
21 |
22 | 重要
23 | 普通
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ToDo S6/ToDo/Client/Pages/ToDay.razor:
--------------------------------------------------------------------------------
1 | @page "/today"
2 |
3 |
4 |
5 |
6 | @foreach (var item in taskDtos)
7 | {
8 |
9 |
10 | @item.Title
11 |
12 |
13 | @item.Description
14 |
15 |
16 |
17 | }
18 |
19 |
20 |
21 |
22 | 重要
23 | 普通
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo/Client/Pages/ToDay.razor:
--------------------------------------------------------------------------------
1 | @page "/today"
2 |
3 |
4 |
5 |
6 | @foreach (var item in taskDtos)
7 | {
8 |
9 |
10 | @item.Title
11 |
12 |
13 | @item.Description
14 |
15 |
16 |
17 | }
18 |
19 |
20 |
21 |
22 | 重要
23 | 普通
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Shared/AchievementEditDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Performance.Shared
8 | {
9 | public class AchievementEditDto
10 | {
11 | public Guid AchievementId { get; set; }
12 | ///
13 | /// 指标
14 | ///
15 | public Guid IndexLibraryId { get; set; }
16 | ///
17 | /// 指标名称
18 | ///
19 | public string IndexName { get; set; }
20 |
21 | ///
22 | /// 机构/部门
23 | ///
24 | public Guid OrganizationId { get; set; }
25 | ///
26 | /// 年份
27 | ///
28 | public int Year { get; set; }
29 | ///
30 | /// 目标值
31 | ///
32 | public decimal TargetValue { get; set; }
33 | ///
34 | /// 实际值
35 | ///
36 | public decimal? ActualValue { get; set; }
37 | ///
38 | /// 保障值
39 | ///
40 | public decimal GuaranteedValue { get; set; }
41 | ///
42 | /// 挑战值
43 | ///
44 | public decimal ChallengeValue { get; set; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Shared/IndexLibraryDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.ComponentModel.DataAnnotations;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Performance.Shared
10 | {
11 | public class IndexLibraryDto
12 | {
13 | ///
14 | /// 指标
15 | ///
16 | [Key]
17 | public Guid IndexLibraryId { get; set; }
18 | [Required]
19 | [StringLength(100)]
20 | [DisplayName("指标名称")]
21 | public string Name { get; set; }
22 | [Required]
23 | [StringLength(100)]
24 | [DisplayName("指标范围")]
25 | public string Scope { get; set; }
26 | [Required]
27 | [StringLength(100)]
28 | [DisplayName("指标类别")]
29 | public string Type { get; set; }
30 | [Required]
31 | [StringLength(100)]
32 | [DisplayName("单位")]
33 | public string Unit { get; set; }
34 | [Required]
35 | [StringLength(100)]
36 | [DisplayName("指标定义")]
37 | public string Definition { get; set; }
38 | [StringLength(100)]
39 | [DisplayName("备注")]
40 | public string Remark { get; set; }
41 | [DisplayName("是否启用")]
42 | public bool IsEnabled { get; set; }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Client/Program.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Microsoft.AspNetCore.Components.Authorization;
3 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4 | using Microsoft.Extensions.Configuration;
5 | using Microsoft.Extensions.DependencyInjection;
6 | using Microsoft.Extensions.Logging;
7 | using Performance.Client.Core;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Net.Http;
11 | using System.Text;
12 | using System.Threading.Tasks;
13 |
14 | namespace Performance.Client
15 | {
16 | public class Program
17 | {
18 | public static async Task Main(string[] args)
19 | {
20 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
21 | builder.RootComponents.Add("#app");
22 |
23 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
24 | builder.Services.AddAntDesign();
25 | builder.Services.AddAutoMapper(typeof(AutomapperConfig));
26 |
27 | builder.Services.AddAuthorizationCore(option=>
28 | {
29 | option.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
30 |
31 | });
32 | builder.Services.AddScoped();
33 |
34 | await builder.Build().RunAsync();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ToDo S7/ToDo.BlazorHost/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Http;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 | using System.Threading.Tasks;
10 |
11 | namespace ToDo.BlazorHost
12 | {
13 | public class Startup
14 | {
15 | // This method gets called by the runtime. Use this method to add services to the container.
16 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
17 | public void ConfigureServices(IServiceCollection services)
18 | {
19 | }
20 |
21 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
22 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
23 | {
24 | if (env.IsDevelopment())
25 | {
26 | app.UseDeveloperExceptionPage();
27 | }
28 |
29 | app.UseBlazorFrameworkFiles();
30 | app.UseStaticFiles();
31 |
32 | app.UseRouting();
33 |
34 | app.UseEndpoints(endpoints =>
35 | {
36 | endpoints.MapFallbackToFile("index.html");
37 | });
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance.BlazorHost/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Http;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 | using System.Threading.Tasks;
10 |
11 | namespace Performance.BlazorHost
12 | {
13 | public class Startup
14 | {
15 | // This method gets called by the runtime. Use this method to add services to the container.
16 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
17 | public void ConfigureServices(IServiceCollection services)
18 | {
19 |
20 | }
21 |
22 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
23 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
24 | {
25 | if (env.IsDevelopment())
26 | {
27 | app.UseDeveloperExceptionPage();
28 | }
29 |
30 | app.UseBlazorFrameworkFiles();
31 | app.UseStaticFiles();
32 |
33 | app.UseRouting();
34 |
35 | app.UseEndpoints(endpoints =>
36 | {
37 | endpoints.MapFallbackToFile("index.html");
38 | }); ;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Performance S6/Performance/Performance/Client/Pages/Login.razor.cs:
--------------------------------------------------------------------------------
1 | using AntDesign;
2 | using Microsoft.AspNetCore.Components;
3 | using Performance.Shared;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Net.Http;
8 | using System.Net.Http.Headers;
9 | using System.Threading.Tasks;
10 |
11 | namespace Performance.Client.Pages
12 | {
13 | public partial class Login : DrawerTemplate