Skip to content

Commit a225656

Browse files
committed
commit change to 1.3.0
1 parent 89cd3d2 commit a225656

25 files changed

Lines changed: 382 additions & 313 deletions

Appeon.SnapObjectsDemo.Web/Appeon.SnapObjectsDemo.Web.csproj

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
<TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
7+
<OutputType>Exe</OutputType>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<Compile Remove="Pages\NewFolder\**" />
11-
<Content Remove="Pages\NewFolder\**" />
12-
<EmbeddedResource Remove="Pages\NewFolder\**" />
13-
<None Remove="Pages\NewFolder\**" />
14-
</ItemGroup>
15-
16-
17-
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.App" />
19-
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.1" PrivateAssets="All" />
20-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.9" />
11+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
2112
</ItemGroup>
2213

2314

@@ -41,6 +32,7 @@
4132
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
4233
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
4334
<WarningsAsErrors />
35+
<PlatformTarget>AnyCPU</PlatformTarget>
4436
</PropertyGroup>
4537

4638
</Project>

Appeon.SnapObjectsDemo.Web/Models/BasePageModel.cs

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Appeon.MvcModelMapperDemo.Models
88
{
9-
public class BasePageModel: PageModel
9+
public class BasePageModel : PageModel
1010
{
1111
/// <summary>
1212
/// Return to the unified json format
@@ -15,7 +15,7 @@ public class BasePageModel: PageModel
1515
/// <param name="message"></param>
1616
/// <param name="id"></param>
1717
/// <returns></returns>
18-
protected JsonResult GenJsonResult(int code,String message,int? id)
18+
protected JsonResult GenJsonResult(int code, string message, int? id)
1919
{
2020
var result = new Dictionary<string, object>()
2121
{
@@ -32,44 +32,63 @@ protected JsonResult GenJsonResult(int code,String message,int? id)
3232
/// <param name="SalesOrder"></param>
3333
protected void ConvertData(SalesOrder SalesOrder)
3434
{
35-
String orderDate = this.Request.Form["SalesOrder.OrderDate"];
36-
String dueDate = this.Request.Form["SalesOrder.DueDate"];
37-
String shipDate = this.Request.Form["SalesOrder.ShipDate"];
35+
string orderDate = Request.Form["SalesOrder.OrderDate"];
36+
string dueDate = Request.Form["SalesOrder.DueDate"];
37+
string shipDate = Request.Form["SalesOrder.ShipDate"];
3838

39-
if (!String.IsNullOrEmpty(orderDate) && SalesOrder.OrderDate == null)
39+
if (!string.IsNullOrEmpty(orderDate) && SalesOrder.OrderDate == null)
4040
{
41-
try
42-
{
43-
DateTime dt;
44-
DateTime.TryParseExact(orderDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt);
45-
SalesOrder.OrderDate = dt;
46-
}
47-
catch (Exception)
41+
if (!orderDate.ToString().Equals("0001/1/1 0:00:00"))
4842
{
43+
try
44+
{
45+
DateTime dt;
46+
DateTime.TryParseExact(orderDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt);
47+
SalesOrder.OrderDate = dt;
48+
}
49+
catch (Exception)
50+
{ }
4951
}
52+
else
53+
SalesOrder.OrderDate = DateTime.Now;
5054
}
51-
if (!String.IsNullOrEmpty(dueDate) && SalesOrder.DueDate == null)
55+
if (!string.IsNullOrEmpty(dueDate) && SalesOrder.DueDate == null)
5256
{
53-
try
54-
{
55-
SalesOrder.DueDate = DateTime.ParseExact(dueDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);
56-
}
57-
catch (Exception)
57+
if (!dueDate.ToString().Equals("0001/1/1 0:00:00"))
5858
{
59-
59+
try
60+
{
61+
SalesOrder.DueDate = DateTime.ParseExact(dueDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);
62+
}
63+
catch (Exception)
64+
{ }
6065
}
66+
else
67+
SalesOrder.DueDate = DateTime.Now;
6168
}
62-
if (!String.IsNullOrEmpty(shipDate) && SalesOrder.ShipDate == null)
69+
if (!string.IsNullOrEmpty(shipDate) && SalesOrder.ShipDate == null)
6370
{
64-
try
71+
if (!shipDate.ToString().Equals("0001/1/1 0:00:00"))
6572
{
66-
SalesOrder.ShipDate = DateTime.ParseExact(shipDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);
67-
}
68-
catch (Exception)
69-
{
70-
73+
try
74+
{
75+
SalesOrder.ShipDate = (DateTime?)DateTime.ParseExact(shipDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).AddDays(1);
76+
}
77+
catch (Exception)
78+
{ }
7179
}
80+
else
81+
SalesOrder.ShipDate = DateTime.Now;
7282
}
83+
84+
if (SalesOrder.OrderDate.ToString().IndexOf("0001") >= 0)
85+
SalesOrder.OrderDate = DateTime.Now;
86+
87+
if (SalesOrder.DueDate.ToString().IndexOf("0001") >= 0)
88+
SalesOrder.DueDate = DateTime.Now;
89+
90+
if (SalesOrder.ShipDate.ToString().IndexOf("0001") >= 0)
91+
SalesOrder.ShipDate = DateTime.Now.AddDays(1);
7392
}
7493
}
7594
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Threading.Tasks;
61
using Microsoft.AspNetCore.Mvc;
72
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
84

95
namespace Appeon.MvcModelMapperDemo.Pages
106
{
@@ -15,9 +11,10 @@ public class ErrorModel : PageModel
1511

1612
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1713

18-
public void OnGet()
14+
public void OnGetAsync()
1915
{
2016
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
2117
}
18+
2219
}
2320
}

Appeon.SnapObjectsDemo.Web/Pages/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="col-md-3 left_col">
3232
<div class="left_col scroll-view">
3333
<div class="navbar nav_title" style="border: 0;">
34-
<a href="index.html" class="site_title">
34+
<a href="Index" class="site_title">
3535
<img src="~/images/appeon.svg">
3636
<i class="fa fa-paw"></i> <span>Appeon Demo!</span>
3737
</a>

Appeon.SnapObjectsDemo.Web/Pages/Index.cshtml.cs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using Appeon.SnapObjectsDemo.Service.Models;
1+
using Appeon.SnapObjectsDemo.Service.Models;
52
using Appeon.SnapObjectsDemo.Services;
63
using Microsoft.AspNetCore.Mvc.RazorPages;
74
using Newtonsoft.Json;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Threading.Tasks;
89

910
namespace Appeon.MvcModelMapperDemo.Pages
1011
{
@@ -33,42 +34,43 @@ public IndexModel(IOrderReportService reportService)
3334

3435
public string loginName { get; set; }
3536

36-
public void OnGet()
37+
public async Task OnGetAsync()
3738
{
38-
queryPieReport();
39-
queryTotalReport();
40-
queryBarReportByYear();
39+
await queryPieReport();
40+
await queryTotalReport();
41+
await queryBarReportByYear();
4142
}
4243

43-
private void queryTotalReport()
44+
private async Task queryTotalReport()
4445
{
45-
totalData = _reportService.RetrieveSalesOrderTotalReport();
46+
totalData = await _reportService.RetrieveSalesOrderTotalReportAsync();
4647
//转换json
47-
String Json_totalData = Newtonsoft.Json.JsonConvert.SerializeObject(totalData);
48+
string Json_totalData = JsonConvert.SerializeObject(totalData);
4849
categoryReportByYear.Json_totalData = Json_totalData;
4950
}
5051

51-
private void queryPieReport()
52+
private async Task queryPieReport()
5253
{
53-
String curDate = "2013-01-01";
54+
string curDate = "2013-01-01";
5455
var curYear = DateTime.Parse(curDate).Year.ToString();
5556
var lastYear = DateTime.Parse(curDate).AddYears(-1).Year.ToString();
5657
var master = new CategorySalesReportByYear();
57-
categoryReportByYear = _reportService.RetrieveCategorySalesReportByYear(master, curYear, lastYear);
58+
categoryReportByYear = await _reportService.RetrieveCategorySalesReportByYearAsync(master, curYear, lastYear);
5859
//转换json
59-
String categorys = JsonConvert.SerializeObject(categoryReportByYear.SalesReportByCategory
60+
string categorys = JsonConvert.SerializeObject(categoryReportByYear.SalesReportByCategory
6061
.Select(x => x.ProductCategoryName));
6162

62-
String categorysData = JsonConvert.SerializeObject(categoryReportByYear.SalesReportByCategory
63+
string categorysData = JsonConvert.SerializeObject(categoryReportByYear.SalesReportByCategory
6364
.Select(x => new
6465
{
65-
name = x.ProductCategoryName, value = x.TotalSalesqty
66+
name = x.ProductCategoryName,
67+
value = x.TotalSalesqty
6668
}));
6769
categoryReportByYear.Json_Categorys = categorys;
6870
categoryReportByYear.Json_categorysData = categorysData;
6971
}
7072

71-
private void queryBarReportByYear()
73+
private async Task queryBarReportByYear()
7274
{
7375
string salesYear = "2013";
7476
object[] yearMonth = new object[12];
@@ -82,7 +84,7 @@ private void queryBarReportByYear()
8284
}
8385

8486
var master = new ProductCategorySalesReport();
85-
productCategorySalesReport = _reportService.RetrieveProductCategorySalesReport(master, yearMonth);
87+
productCategorySalesReport = await _reportService.RetrieveProductCategorySalesReportAsync(master, yearMonth);
8688
ConvertDataForReport(productCategorySalesReport, resultMonth);
8789
}
8890

@@ -116,15 +118,18 @@ private void ConvertDataForReport(ProductCategorySalesReport productCategorySale
116118
result.Add(name, salesQtys);
117119
}
118120

119-
String proCat =JsonConvert.SerializeObject(ProCategoryName);
120-
String proCatQty =JsonConvert.SerializeObject(result
121+
string proCat = JsonConvert.SerializeObject(ProCategoryName);
122+
string proCatQty = JsonConvert.SerializeObject(result
121123
.Select(x => new
122124
{
123-
name = x.Key, type = "bar", data = x.Value
125+
name = x.Key,
126+
type = "bar",
127+
data = x.Value
124128
}));
125129
categoryReportByYear.Json_ProductSaleMonth = JsonConvert.SerializeObject(yearMonth);
126130
categoryReportByYear.Json_ProductCategory = proCat;
127131
categoryReportByYear.Json_ProductSaleSqty = proCatQty;
128132
}
133+
129134
}
130135
}

Appeon.SnapObjectsDemo.Web/Pages/Login.cshtml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using System;
2-
using Appeon.MvcModelMapperDemo.Models;
1+
using Appeon.MvcModelMapperDemo.Models;
32
using Appeon.SnapObjectsDemo.Service.Models;
43
using Appeon.SnapObjectsDemo.Services;
54
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.AspNetCore.Mvc.RazorPages;
5+
using System;
76

87
namespace Appeon.MvcModelMapperDemo.Pages
98
{
@@ -12,20 +11,20 @@ public class LoginModel : BasePageModel
1211
private readonly ILoginService loginService;
1312
public LoginModel(ILoginService _loginService)
1413
{
15-
this.loginService = _loginService;
14+
loginService = _loginService;
1615
}
1716

1817
[BindProperty]
1918
public Login Login { get; set; }
2019

21-
public void OnGet()
20+
public void OnGetAsync()
2221
{
2322
Login = new Login();
2423
Login.Password = "K7dMpTY=";
2524
Login.Firstname = "Michael.Raheem";
2625
}
2726

28-
public IActionResult OnPost()
27+
public IActionResult OnPostAsync()
2928
{
3029
try
3130
{
@@ -56,5 +55,6 @@ public IActionResult OnPost()
5655

5756
return GenJsonResult(1, "", 0);
5857
}
58+
5959
}
6060
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.AspNetCore.Mvc.RazorPages;
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
72

83
namespace Appeon.MvcModelMapperDemo.Pages
94
{
105
public class PrivacyModel : PageModel
116
{
12-
public void OnGet()
7+
public void OnGetAsync()
138
{
9+
1410
}
11+
1512
}
1613
}

Appeon.SnapObjectsDemo.Web/Pages/SalesOrders/Create.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<div class="col-md-3 left_col">
4343
<div class="left_col scroll-view">
4444
<div class="navbar nav_title" style="border: 0;">
45-
<a href="index.html" class="site_title">
45+
<a href="../Index" class="site_title">
4646
<img src="~/images/appeon.svg">
4747
<i class="fa fa-paw"></i> <span>Appeon Demo!</span>
4848
</a>
@@ -340,15 +340,18 @@
340340
<script type="text/javascript" src="~/js/orderCreate.js"></script>
341341
<script type="text/javascript" src="~/js/order.js"></script>
342342
<script>
343-
$('#myDatepicker1').datetimepicker({
343+
$('#myDatepicker1').datetimepicker({
344344
format: 'DD/MM/YYYY'
345+
345346
});
346347
$('#myDatepicker2').datetimepicker({
347348
format: 'DD/MM/YYYY'
349+
348350
});
349351
350352
$('#myDatepicker3').datetimepicker({
351353
format: 'DD/MM/YYYY'
354+
352355
});
353356
</script>
354357
</body>

0 commit comments

Comments
 (0)