Skip to content

Commit dfff8d8

Browse files
changes
1 parent d2d266d commit dfff8d8

File tree

5 files changed

+81
-167
lines changed

5 files changed

+81
-167
lines changed

Javascript url adaptor/RemoteSave/Controllers/HomeController.cs

Lines changed: 43 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,22 @@ namespace RemoteSave.Controllers
1414
{
1515
public class HomeController : Controller
1616
{
17-
18-
1917
public ActionResult Index()
2018
{
21-
22-
23-
2419
return View();
2520
}
2621
public ActionResult UrlDatasource(DataManagerRequest dm)
2722
{
2823
if (TreeData.tree.Count == 0)
2924
TreeData.GetTree();
3025
IEnumerable DataSource = TreeData.tree;
31-
IEnumerable src =null;
32-
IEnumerable dest = null;
33-
IEnumerable aggregate=null;
3426

3527
DataOperations operation = new DataOperations();
3628
if (dm.Where != null && dm.Where.Count > 0)
3729
{
3830
DataSource = operation.PerformFiltering(DataSource, dm.Where, "and");
3931
}
4032
List<string> str = new List<string>();
41-
4233

4334
if (dm.Sorted != null && dm.Sorted.Count > 0)
4435
{
@@ -53,15 +44,9 @@ public ActionResult UrlDatasource(DataManagerRequest dm)
5344
{
5445
DataSource = operation.PerformTake(DataSource, dm.Take);
5546
}
56-
57-
58-
59-
60-
return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
47+
return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
6148
}
6249

63-
64-
6550
public ActionResult Update(TreeData value)
6651
{
6752
var val = TreeData.tree.Where(ds => ds.TaskID == value.TaskID).FirstOrDefault();
@@ -86,7 +71,7 @@ public void Insert(TreeData value, int relationalKey)
8671
}
8772
}
8873
i += FindChildRecords(relationalKey);
89-
TreeData.tree.Insert(i +1, value);
74+
TreeData.tree.Insert(i + 1, value);
9075
}
9176
public int FindChildRecords(int? id)
9277
{
@@ -101,7 +86,7 @@ public int FindChildRecords(int? id)
10186
}
10287
return count;
10388
}
104-
89+
10590
public void Delete(int key)
10691
{
10792
TreeData.tree.Remove(TreeData.tree.Where(ds => ds.TaskID == key).FirstOrDefault());
@@ -131,59 +116,56 @@ public class ICRUDModel
131116
}
132117

133118
}
134-
135-
136-
137-
public class TreeData
119+
public class TreeData
120+
{
121+
public static List<TreeData> tree = new List<TreeData>();
122+
[System.ComponentModel.DataAnnotations.Key]
123+
public int TaskID { get; set; }
124+
public string TaskName { get; set; }
125+
public DateTime StartDate { get; set; }
126+
public DateTime EndDate { get; set; }
127+
public String Progress { get; set; }
128+
public String Priority { get; set; }
129+
public int Duration { get; set; }
130+
public int? ParentItem { get; set; }
131+
public bool? isParent { get; set; }
132+
public TreeData() { }
133+
public static List<TreeData> GetTree()
138134
{
139-
public static List<TreeData> tree = new List<TreeData>();
140-
[System.ComponentModel.DataAnnotations.Key]
141-
public int TaskID { get; set; }
142-
public string TaskName { get; set; }
143-
public DateTime StartDate { get; set; }
144-
public DateTime EndDate { get; set; }
145-
public String Progress { get; set; }
146-
public String Priority { get; set; }
147-
public int Duration { get; set; }
148-
public int? ParentItem { get; set; }
149-
public bool? isParent { get; set; }
150-
public TreeData() { }
151-
public static List<TreeData> GetTree()
135+
if (tree.Count == 0)
152136
{
153-
if (tree.Count == 0)
154-
{
155-
int root = -1;
137+
int root = -1;
156138
for (var t = 1; t <= 5; t++)
157139
{
158140
Random ran = new Random();
159-
string math = (ran.Next() % 3) == 0 ? "High" : (ran.Next() % 2) == 0 ? "Release Breaker" : "Critical";
160-
string progr = (ran.Next() % 3) == 0 ? "Started" : (ran.Next() % 2) == 0 ? "Open" : "In Progress";
161-
root++;
162-
int rootItem = tree.Count + root + 1;
163-
tree.Add(new TreeData() { TaskID = rootItem, TaskName = "Parent Task " + rootItem.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = true, ParentItem = null, Progress = progr, Priority = math, Duration = (ran.Next(1, 50) *5) });
164-
int parent = tree.Count;
165-
for (var c = 0; c < 3; c++)
166-
{
167-
root++;
168-
string val = ((parent + c + 1) % 3 == 0) ? "Low" : "Critical";
169-
int parn = parent + c + 1;
170-
progr = (ran.Next() % 3) == 0 ? "In Progress" : (ran.Next() % 2) == 0 ? "Open" : "Validated";
171-
int iD = tree.Count + root + 1;
172-
tree.Add(new TreeData() { TaskID = iD, TaskName = "Child Task " + iD.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = rootItem, Progress = progr, Priority = val, Duration = ran.Next(1, 50) });
173-
if ((((parent + c + 1) % 2) == 0))
141+
string math = (ran.Next() % 3) == 0 ? "High" : (ran.Next() % 2) == 0 ? "Release Breaker" : "Critical";
142+
string progr = (ran.Next() % 3) == 0 ? "Started" : (ran.Next() % 2) == 0 ? "Open" : "In Progress";
143+
root++;
144+
int rootItem = tree.Count + root + 1;
145+
tree.Add(new TreeData() { TaskID = rootItem, TaskName = "Parent Task " + rootItem.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = true, ParentItem = null, Progress = progr, Priority = math, Duration = (ran.Next(1, 50) * 5) });
146+
int parent = tree.Count;
147+
for (var c = 0; c < 3; c++)
174148
{
175-
int immParent = tree.Count;
176-
for (var s = 0; s < 2; s++)
149+
root++;
150+
string val = ((parent + c + 1) % 3 == 0) ? "Low" : "Critical";
151+
int parn = parent + c + 1;
152+
progr = (ran.Next() % 3) == 0 ? "In Progress" : (ran.Next() % 2) == 0 ? "Open" : "Validated";
153+
int iD = tree.Count + root + 1;
154+
tree.Add(new TreeData() { TaskID = iD, TaskName = "Child Task " + iD.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = rootItem, Progress = progr, Priority = val, Duration = ran.Next(1, 50) });
155+
if ((((parent + c + 1) % 2) == 0))
177156
{
178-
root++;
179-
string Prior = (immParent % 2 == 0) ? "Validated" : "Normal";
180-
tree.Add(new TreeData() { TaskID = tree.Count + root + 1, TaskName = "Sub Task " + (tree.Count + root + 1).ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = iD, Progress = (immParent % 2 == 0) ? "On Progress" : "Closed", Priority = Prior, Duration = ran.Next(1, 50) });
157+
int immParent = tree.Count;
158+
for (var s = 0; s < 2; s++)
159+
{
160+
root++;
161+
string Prior = (immParent % 2 == 0) ? "Validated" : "Normal";
162+
tree.Add(new TreeData() { TaskID = tree.Count + root + 1, TaskName = "Sub Task " + (tree.Count + root + 1).ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = iD, Progress = (immParent % 2 == 0) ? "On Progress" : "Closed", Priority = Prior, Duration = ran.Next(1, 50) });
163+
}
181164
}
182165
}
183-
}
184-
}
185166
}
186-
return tree;
187167
}
168+
return tree;
188169
}
189170
}
171+
}

Javascript url adaptor/RemoteSave/RemoteSave.csproj

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -137,52 +137,12 @@
137137
<Compile Include="Properties\AssemblyInfo.cs" />
138138
</ItemGroup>
139139
<ItemGroup>
140-
<Content Include="Content\bootstrap-theme.css" />
141-
<Content Include="Content\bootstrap-theme.min.css" />
142-
<Content Include="Content\bootstrap.css" />
143-
<Content Include="Content\bootstrap.min.css" />
144-
<Content Include="Content\ej2\bootstrap-dark.css" />
145-
<Content Include="Content\ej2\bootstrap.css" />
146-
<Content Include="Content\ej2\bootstrap4.css" />
147-
<Content Include="Content\ej2\bootstrap5-dark.css" />
148-
<Content Include="Content\ej2\bootstrap5.css" />
149-
<Content Include="Content\ej2\compatibility\bootstrap.css" />
150-
<Content Include="Content\ej2\compatibility\bootstrap4.css" />
151-
<Content Include="Content\ej2\compatibility\fabric.css" />
152-
<Content Include="Content\ej2\compatibility\highcontrast.css" />
153-
<Content Include="Content\ej2\compatibility\material.css" />
154-
<Content Include="Content\ej2\customized\material-dark.css" />
155-
<Content Include="Content\ej2\customized\material.css" />
156-
<Content Include="Content\ej2\customized\tailwind-dark.css" />
157-
<Content Include="Content\ej2\customized\tailwind.css" />
158-
<Content Include="Content\ej2\fabric-dark.css" />
159-
<Content Include="Content\ej2\fabric.css" />
160-
<Content Include="Content\ej2\fluent-dark.css" />
161-
<Content Include="Content\ej2\fluent.css" />
162-
<Content Include="Content\ej2\highcontrast.css" />
163-
<Content Include="Content\ej2\material-dark.css" />
164-
<Content Include="Content\ej2\material.css" />
165-
<Content Include="Content\ej2\material3-dark.css" />
166-
<Content Include="Content\ej2\material3.css" />
167-
<Content Include="Content\ej2\tailwind-dark.css" />
168-
<Content Include="Content\ej2\tailwind.css" />
169140
<Content Include="favicon.ico" />
170141
<Content Include="fonts\glyphicons-halflings-regular.svg" />
171142
<Content Include="Global.asax" />
172-
<Content Include="Content\Site.css" />
173143
<Content Include="Scripts\bootstrap.js" />
174144
<Content Include="Scripts\bootstrap.min.js" />
175-
<Content Include="Scripts\ej2.min.js" />
176-
<Content Include="Scripts\ej2\ej2-pdfviewer-lib\pdfium.js" />
177-
<Content Include="Scripts\ej2\ej2-pdfviewer-lib\pdfium.wasm" />
178-
<Content Include="Content\ej2\compatibility\material.scss" />
179-
<Content Include="Content\ej2\compatibility\highcontrast.scss" />
180-
<Content Include="Content\ej2\compatibility\fabric.scss" />
181-
<Content Include="Content\ej2\compatibility\bootstrap4.scss" />
182-
<Content Include="Content\ej2\compatibility\bootstrap.scss" />
183145
<None Include="Scripts\jquery-3.3.1.intellisense.js" />
184-
<Content Include="Scripts\ej2\ej2.17.3.21.min.js" />
185-
<Content Include="Scripts\ej2\ej2.min.js" />
186146
<Content Include="Scripts\jquery-3.3.1.js" />
187147
<Content Include="Scripts\jquery-3.3.1.min.js" />
188148
<Content Include="Scripts\jquery-3.3.1.slim.min.js" />
@@ -206,18 +166,12 @@
206166
<Content Include="Views\Home\Index.cshtml" />
207167
<Content Include="Views\Home\EditPartial.cshtml" />
208168
</ItemGroup>
209-
<ItemGroup>
210-
<Folder Include="App_Data\" />
211-
</ItemGroup>
169+
<ItemGroup />
212170
<ItemGroup>
213171
<Content Include="fonts\glyphicons-halflings-regular.woff2" />
214172
<Content Include="fonts\glyphicons-halflings-regular.woff" />
215173
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
216174
<Content Include="fonts\glyphicons-halflings-regular.eot" />
217-
<Content Include="Content\bootstrap.min.css.map" />
218-
<Content Include="Content\bootstrap.css.map" />
219-
<Content Include="Content\bootstrap-theme.min.css.map" />
220-
<Content Include="Content\bootstrap-theme.css.map" />
221175
<None Include="packages.config" />
222176
<Content Include="Scripts\jquery-3.3.1.slim.min.map" />
223177
<Content Include="Scripts\jquery-3.3.1.min.map" />
@@ -254,5 +208,4 @@
254208
</FlavorProperties>
255209
</VisualStudio>
256210
</ProjectExtensions>
257-
258211
</Project>

Javascript url adaptor/RemoteSave/Views/Home/Index.cshtml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,37 @@
1212
<h2>RemoteData</h2>
1313
<div id="TreeGrid"></div>
1414

15-
<script>
16-
ej.treegrid.TreeGrid.Inject(ej.treegrid.Edit, ej.treegrid.Toolbar);
17-
let data = new ej.data.DataManager({
18-
url: "/Home/UrlDatasource",
19-
updateUrl: "/Home/Update",
20-
insertUrl: "/Home/Insert",
21-
removeUrl: "Home/Delete",
22-
batchUrl: "Home/Remove",
23-
adaptor: new ej.data.UrlAdaptor()
24-
});
25-
26-
let treeGridObj = new ej.treegrid.TreeGrid({
27-
dataSource: data,
28-
allowPaging: true,
29-
idMapping: 'TaskID',
30-
parentIdMapping: 'ParentItem',
31-
hasChildMapping: "isParent",
32-
33-
treeColumnIndex: 1,
34-
actionFailure: {},
35-
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
36-
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Row', newRowPosition: 'Below' },
37-
columns: [
38-
{ field: 'TaskID', isPrimaryKey: true, headerText: 'Task ID', width: 120 },
39-
{ field: 'TaskName', width: 140, headerText: 'TaskName' },
40-
{ field: 'Duration', width: 140, headerText: 'Duration' }
41-
],
42-
43-
});
44-
treeGridObj.appendTo('#TreeGrid');
15+
<script>
16+
ej.treegrid.TreeGrid.Inject(ej.treegrid.Edit, ej.treegrid.Toolbar);
17+
let data = new ej.data.DataManager({
18+
url: "/Home/UrlDatasource",
19+
updateUrl: "/Home/Update",
20+
insertUrl: "/Home/Insert",
21+
removeUrl: "Home/Delete",
22+
batchUrl: "Home/Remove",
23+
adaptor: new ej.data.UrlAdaptor()
24+
});
25+
26+
let treeGridObj = new ej.treegrid.TreeGrid({
27+
dataSource: data,
28+
allowPaging: true,
29+
idMapping: 'TaskID',
30+
parentIdMapping: 'ParentItem',
31+
hasChildMapping: "isParent",
32+
33+
treeColumnIndex: 1,
34+
actionFailure: {},
35+
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
36+
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Row', newRowPosition: 'Below' },
37+
columns: [
38+
{ field: 'TaskID', isPrimaryKey: true, headerText: 'Task ID', width: 120 },
39+
{ field: 'TaskName', width: 140, headerText: 'TaskName' },
40+
{ field: 'Duration', width: 140, headerText: 'Duration' }
41+
],
42+
43+
});
44+
treeGridObj.appendTo('#TreeGrid');
4545
</script>
4646

4747

48-
48+

Javascript url adaptor/RemoteSave/Views/Shared/_Layout.cshtml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,17 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>@ViewBag.Title - My ASP.NET Application</title>
7-
@Styles.Render("~/Content/css")
8-
@Scripts.Render("~/bundles/modernizr")
9-
10-
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/material.css" />
11-
12-
<script src="https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2.min.js"></script>
7+
@Scripts.Render("~/bundles/modernizr")
8+
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/24.1.41/material.css" />
9+
<script src="https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2.min.js"></script>
1310
</head>
1411
<body>
1512
<div class="navbar navbar-inverse navbar-fixed-top">
1613
<div class="container">
1714
<div class="navbar-header">
18-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
19-
<span class="icon-bar"></span>
20-
<span class="icon-bar"></span>
21-
<span class="icon-bar"></span>
22-
</button>
23-
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
24-
</div>
25-
<div class="navbar-collapse collapse">
26-
<ul class="nav navbar-nav">
27-
<li>@Html.ActionLink("Home", "Index", "Home")</li>
28-
<li>@Html.ActionLink("About", "About", "Home")</li>
29-
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
30-
</ul>
15+
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
3116
</div>
17+
3218
</div>
3319
</div>
3420
<div class="container body-content">
@@ -39,8 +25,6 @@
3925
</footer>
4026
</div>
4127

42-
@*@Scripts.Render("~/bundles/jquery")
43-
@Scripts.Render("~/bundles/bootstrap")*@
4428
@Html.EJS().ScriptManager();
4529
@RenderSection("scripts", required: false)
4630
<ejs-scripts></ejs-scripts>

Javascript url adaptor/RemoteSave/Web.config

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,5 @@
5858
</dependentAssembly>
5959
</assemblyBinding>
6060
</runtime>
61-
<!--<system.codedom>
62-
<compilers>
63-
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
64-
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
65-
</compilers>
66-
</system.codedom>-->
61+
6762
</configuration>

0 commit comments

Comments
 (0)