Skip to content

Commit 602c8cd

Browse files
Update to 25.1.3+
1 parent 1076aad commit 602c8cd

Some content is hidden

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

44 files changed

+1690
-30
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace ASP_NET_Core.Controllers
8+
{
9+
public class HomeController : Controller
10+
{
11+
public IActionResult Index()
12+
{
13+
return View();
14+
}
15+
16+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
17+
public IActionResult Error() {
18+
return View();
19+
}
20+
}
21+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<script src="~/data/employees.js"></script>
2+
3+
<script>
4+
const backendURL = "http://localhost:5000/";
5+
</script>
6+
7+
<style>
8+
#data-grid-demo {
9+
min-height: 530px;
10+
width: 1000px;
11+
}
12+
.dx-row img {
13+
height: 50px;
14+
}
15+
.retryButton {
16+
margin-left: 7px;
17+
}
18+
.uploadedImage {
19+
height: 50px;
20+
margin-left: 7px;
21+
margin-bottom: 7px;
22+
}
23+
</style>
24+
25+
@(Html.DevExtreme().DataGrid()
26+
.ShowBorders(true)
27+
.DataSource(new JS("employees"))
28+
.KeyExpr("ID")
29+
.Editing(e => e.Mode(GridEditMode.Popup)
30+
.AllowUpdating(true)
31+
.Popup(p => p
32+
.Title("Employee Info")
33+
.ShowTitle(true)
34+
.Width(700)
35+
)
36+
.Form(f => f.Items(items => {
37+
items.AddGroup()
38+
.ColCount(2)
39+
.ColSpan(2)
40+
.Items(groupItems => {
41+
groupItems.AddSimple().DataField("Prefix");
42+
groupItems.AddSimple().DataField("FirstName");
43+
groupItems.AddSimple().DataField("LastName");
44+
groupItems.AddSimple().DataField("Position");
45+
groupItems.AddSimple().DataField("BirthDate");
46+
groupItems.AddSimple().DataField("HireDate");
47+
});
48+
items.AddGroup()
49+
.Caption("Photo")
50+
.ColCount(2)
51+
.ColSpan(2)
52+
.Items(groupItems => {
53+
groupItems.AddSimple().DataField("Picture").ColSpan(2);
54+
});
55+
}))
56+
)
57+
.Columns(columns => {
58+
columns.Add().DataField("Picture")
59+
.Width(70)
60+
.AllowFiltering(false)
61+
.AllowSorting(false)
62+
.CellTemplate(
63+
@<text>
64+
@(await Html.PartialAsync("_CellTemplate"))
65+
</text>)
66+
.EditCellTemplate(
67+
@<text>
68+
@(await Html.PartialAsync("_EditCellTemplate"))
69+
</text>);
70+
71+
columns.Add().DataField("Prefix")
72+
.Width(70);
73+
74+
columns.Add().DataField("FirstName");
75+
76+
columns.Add().DataField("LastName");
77+
78+
columns.Add().DataField("Position");
79+
80+
columns.Add().DataField("BirthDate").DataType(GridColumnDataType.Date);
81+
82+
columns.Add().DataField("HireDate").DataType(GridColumnDataType.Date);
83+
})
84+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@{ Layout = null; }
2+
3+
<img src="[%- backendURL %][%- value %]" alt="Photo" />
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@{ Layout = null;
2+
string backendUploadURL = "http://localhost:5000/"; }
3+
4+
[%
5+
editCellInfo = arguments[0]; // get all properties of editCellTemplate
6+
%]
7+
8+
<script>
9+
function onRetryButtonClick(e) {
10+
const fileUploader = $("#fileUploader").dxFileUploader("instance");
11+
for (let i = 0; i < fileUploader._files.length; i++) {
12+
delete fileUploader._files[i].uploadStarted;
13+
}
14+
fileUploader.upload();
15+
}
16+
17+
function onFileUploaderValueChanged(e) {
18+
let reader = new FileReader();
19+
let imageElement = $("#imgElement")[0];
20+
reader.onload = function (args) {
21+
imageElement.setAttribute('src', args.target.result);
22+
}
23+
reader.readAsDataURL(e.value[0]); // convert to base64 string
24+
}
25+
26+
function onUploaded(e) {
27+
let retryButton = $("#retryButton").dxButton("instance");
28+
editCellInfo.setValue("images/employees/" + e.request.responseText);
29+
retryButton.option("visible", false);
30+
}
31+
32+
function onUploadError(e) {
33+
let retryButton = $("#retryButton").dxButton("instance");
34+
let xhttp = e.request;
35+
if (xhttp.status === 400) {
36+
e.message = e.error.responseText;
37+
}
38+
if (xhttp.readyState == 4 && xhttp.status == 0) {
39+
e.message = "Connection refused";
40+
}
41+
retryButton.option("visible", true);
42+
}
43+
</script>
44+
45+
@(Html.DevExtreme().FileUploader()
46+
.ID("fileUploader")
47+
.Multiple(false)
48+
.Accept("image/*")
49+
.UploadMode(FileUploadMode.Instantly)
50+
.UploadUrl(backendUploadURL + "FileUpload/post")
51+
.OnValueChanged("function(e){onFileUploaderValueChanged(e)}")
52+
.OnUploaded("function(e){onUploaded(e)}")
53+
.OnUploadError("function(e){onUploadError(e)}")
54+
)
55+
56+
<img id="imgElement" class="uploadedImage" src="[%- backendURL %][%- data.Picture %]" alt="Photo" />
57+
58+
@(Html.DevExtreme().Button()
59+
.ID("retryButton")
60+
.Text("Retry")
61+
.Visible(false)
62+
.Type(ButtonType.Normal)
63+
.OnClick("function(e){onRetryButtonClick(e)}")
64+
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta charset="utf-8">
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
8+
<meta name="description" content="">
9+
<meta name="author" content="">
10+
11+
<title>ASP_NET_Core</title>
12+
13+
@* Uncomment to use the HtmlEditor control *@
14+
@* <script src="https://unpkg.com/devextreme-quill/dist/dx-quill.min.js"></script> *@
15+
16+
<link rel="stylesheet" href="~/css/vendor.css" asp-append-version="true" />
17+
<link rel="stylesheet" href="~/css/Site.css" />
18+
<script src="~/js/vendor.js" asp-append-version="true"></script>
19+
</head>
20+
21+
<body style="padding-top: 5rem;">
22+
23+
<nav class="navbar navbar-dark bg-dark fixed-top navbar-expand-md">
24+
<a class="navbar-brand" href="/">ASP_NET_Core</a>
25+
26+
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
27+
<span class="navbar-toggler-icon"></span>
28+
</button>
29+
30+
<div id="navbar" class="collapse navbar-collapse">
31+
<ul class="navbar-nav mr-auto">
32+
<li class="active nav-item"><a href="#" class="nav-link">Home</a></li>
33+
<li class="nav-item"><a href="#about" class="nav-link">About</a></li>
34+
<li class="nav-item"><a href="#contact" class="nav-link">Contact</a></li>
35+
</ul>
36+
</div>
37+
</nav>
38+
39+
<main role="main" class="container">
40+
@RenderBody()
41+
</main>
42+
</body>
43+
44+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.demo-container {
2+
margin: 50px 50px;
3+
width: 90vh;
4+
}
5+
body {
6+
margin: 8px;
7+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
let employees = [{
2+
"ID": 1,
3+
"FirstName": "John",
4+
"LastName": "Heart",
5+
"Prefix": "Mr.",
6+
"Position": "CEO",
7+
"Picture": "images/employees/01.png",
8+
"BirthDate": "1964/03/16",
9+
"HireDate": "1995/01/15",
10+
"Notes": "John has been in the Audio/Video industry since 1990. He has led DevAv as its CEO since 2003.\r\n\r\nWhen not working hard as the CEO, John loves to golf and bowl. He once bowled a perfect game of 300.",
11+
"Address": "351 S Hill St."
12+
}, {
13+
"ID": 20,
14+
"FirstName": "Olivia",
15+
"LastName": "Peyton",
16+
"Prefix": "Mrs.",
17+
"Position": "Sales Assistant",
18+
"Picture": "images/employees/09.png",
19+
"BirthDate": "1981/06/03",
20+
"HireDate": "2012/05/14",
21+
"Notes": "Olivia loves to sell. She has been selling DevAV products since 2012. \r\n\r\nOlivia was homecoming queen in high school. She is expecting her first child in 6 months. Good Luck Olivia.",
22+
"Address": "807 W Paseo Del Mar"
23+
}, {
24+
"ID": 4,
25+
"FirstName": "Robert",
26+
"LastName": "Reagan",
27+
"Prefix": "Mr.",
28+
"Position": "CMO",
29+
"Picture": "images/employees/03.png",
30+
"BirthDate": "1974/09/07",
31+
"HireDate": "2002/11/08",
32+
"Notes": "Robert was recently voted the CMO of the year by CMO Magazine. He is a proud member of the DevAV Management Team.\r\n\r\nRobert is a championship BBQ chef, so when you get the chance ask him for his secret recipe.",
33+
"Address": "4 Westmoreland Pl."
34+
}, {
35+
"ID": 5,
36+
"FirstName": "Greta",
37+
"LastName": "Sims",
38+
"Prefix": "Ms.",
39+
"Position": "HR Manager",
40+
"Picture": "images/employees/04.png",
41+
"BirthDate": "1977/11/22",
42+
"HireDate": "1998/04/23",
43+
"Notes": "Greta has been DevAV's HR Manager since 2003. She joined DevAV from Sonee Corp.\r\n\r\nGreta is currently training for the NYC marathon. Her best marathon time is 4 hours. Go Greta.",
44+
"Address": "1700 S Grandview Dr."
45+
}, {
46+
"ID": 6,
47+
"FirstName": "Brett",
48+
"LastName": "Wade",
49+
"Prefix": "Mr.",
50+
"Position": "IT Manager",
51+
"Picture": "images/employees/05.png",
52+
"BirthDate": "1968/12/01",
53+
"HireDate": "2009/03/06",
54+
"Notes": "Brett came to DevAv from Microsoft and has led our IT department since 2012.\r\n\r\nWhen he is not working hard for DevAV, he coaches Little League (he was a high school pitcher).",
55+
"Address": "1120 Old Mill Rd."
56+
}, {
57+
"ID": 7,
58+
"FirstName": "Sandra",
59+
"LastName": "Johnson",
60+
"Prefix": "Mrs.",
61+
"Position": "Controller",
62+
"Picture": "images/employees/06.png",
63+
"BirthDate": "1974/11/15",
64+
"HireDate": "2005/05/11",
65+
"Notes": "Sandra is a CPA and has been our controller since 2008. She loves to interact with staff so if you've not met her, be certain to say hi.\r\n\r\nSandra has 2 daughters both of whom are accomplished gymnasts.",
66+
"Address": "4600 N Virginia Rd."
67+
}, {
68+
"ID": 10,
69+
"FirstName": "Kevin",
70+
"LastName": "Carter",
71+
"Prefix": "Mr.",
72+
"Position": "Shipping Manager",
73+
"Picture": "images/employees/07.png",
74+
"BirthDate": "1978/01/09",
75+
"HireDate": "2009/08/11",
76+
"Notes": "Kevin is our hard-working shipping manager and has been helping that department work like clockwork for 18 months.\r\n\r\nWhen not in the office, he is usually on the basketball court playing pick-up games.",
77+
"Address": "424 N Main St."
78+
}, {
79+
"ID": 11,
80+
"FirstName": "Cynthia",
81+
"LastName": "Stanwick",
82+
"Prefix": "Ms.",
83+
"Position": "HR Assistant",
84+
"Picture": "images/employees/08.png",
85+
"BirthDate": "1985/06/05",
86+
"HireDate": "2008/03/24",
87+
"Notes": "Cindy joined us in 2008 and has been in the HR department for 2 years. \r\n\r\nShe was recently awarded employee of the month. Way to go Cindy!",
88+
"Address": "2211 Bonita Dr."
89+
}, {
90+
"ID": 30,
91+
"FirstName": "Kent",
92+
"LastName": "Samuelson",
93+
"Prefix": "Dr.",
94+
"Position": "Ombudsman",
95+
"Picture": "images/employees/02.png",
96+
"BirthDate": "1972/09/11",
97+
"HireDate": "2009/04/22",
98+
"Notes": "As our ombudsman, Kent is on the front-lines solving customer problems and helping our partners address issues out in the field. He is a classically trained musician and is a member of the Chamber Orchestra.",
99+
"Address": "12100 Mora Dr"
100+
}];
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
::ng-deep #gridContainer {
2+
min-height: 530px;
3+
width: 1000px;
4+
}
5+
6+
::ng-deep .dx-row img {
7+
height: 50px;
8+
}
9+
10+
::ng-deep .retryButton {
11+
margin-left: 7px;
12+
}
13+
14+
::ng-deep .uploadedImage {
15+
height: 50px;
16+
margin-left: 7px;
17+
margin-bottom: 7px;
18+
}

0 commit comments

Comments
 (0)