Skip to content

Commit bf7e251

Browse files
984006: TreeGrid UG sample added
1 parent 7c9fa8f commit bf7e251

File tree

270 files changed

+17178
-0
lines changed

Some content is hidden

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

270 files changed

+17178
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
9+
<link rel="stylesheet" href="app.css" />
10+
<link rel="stylesheet" href="TreeGridUGSample.styles.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
13+
14+
<HeadOutlet />
15+
</head>
16+
17+
<body>
18+
<Routes />
19+
<script src="_framework/blazor.web.js"></script>
20+
<script src="_content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
21+
</body>
22+
23+
</html>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
namespace TreeGridUGSample.Components.Data
2+
{
3+
public class BusinessObject
4+
{
5+
public int TaskId { get; set; }
6+
public string TaskName { get; set; }
7+
public DateTime? StartDate { get; set; }
8+
public int Duration { get; set; }
9+
public int Progress { get; set; }
10+
public string Priority { get; set; }
11+
public int? ParentId { get; set; }
12+
public Boolean Approved { get; set; }
13+
14+
public static List<BusinessObject> GetSelfDataSource()
15+
{
16+
List<BusinessObject> BusinessObjectCollection = new List<BusinessObject>();
17+
BusinessObjectCollection.Add(new BusinessObject()
18+
{
19+
TaskId = 1,
20+
TaskName = "Parent Task 1",
21+
StartDate = new DateTime(2017, 10, 23),
22+
Duration = 10,
23+
Progress = 70,
24+
Priority = "Critical",
25+
ParentId = null
26+
});
27+
BusinessObjectCollection.Add(new BusinessObject()
28+
{
29+
TaskId = 2,
30+
TaskName = "Child task 1",
31+
StartDate = new DateTime(2017, 10, 23),
32+
Duration = 12,
33+
Progress = 80,
34+
Priority = "Low",
35+
ParentId = 1
36+
});
37+
BusinessObjectCollection.Add(new BusinessObject()
38+
{
39+
TaskId = 3,
40+
TaskName = "Child Task 2",
41+
StartDate = new DateTime(2017, 10, 24),
42+
Duration = 5,
43+
Progress = 65,
44+
Priority = "Critical",
45+
ParentId = 2
46+
});
47+
BusinessObjectCollection.Add(new BusinessObject()
48+
{
49+
TaskId = 4,
50+
TaskName = "Child task 3",
51+
StartDate = new DateTime(2017, 10, 25),
52+
Duration = 6,
53+
Priority = "High",
54+
Progress = 77,
55+
ParentId = 3
56+
});
57+
BusinessObjectCollection.Add(new BusinessObject()
58+
{
59+
TaskId = 5,
60+
TaskName = "Child Task 5",
61+
StartDate = new DateTime(2017, 10, 26),
62+
Duration = 9,
63+
Progress = 25,
64+
ParentId = 4,
65+
Priority = "Normal"
66+
});
67+
BusinessObjectCollection.Add(new BusinessObject()
68+
{
69+
TaskId = 6,
70+
TaskName = "Child Task 6",
71+
StartDate = new DateTime(2017, 10, 27),
72+
Duration = 9,
73+
Progress = 7,
74+
ParentId = 5,
75+
Priority = "Normal"
76+
});
77+
BusinessObjectCollection.Add(new BusinessObject()
78+
{
79+
TaskId = 7,
80+
TaskName = "Parent Task 3",
81+
StartDate = new DateTime(2017, 10, 28),
82+
Duration = 4,
83+
Progress = 45,
84+
ParentId = null,
85+
Priority = "High"
86+
});
87+
BusinessObjectCollection.Add(new BusinessObject()
88+
{
89+
TaskId = 8,
90+
TaskName = "Child Task 7",
91+
StartDate = new DateTime(2017, 10, 29),
92+
Duration = 3,
93+
Progress = 38,
94+
ParentId = 7,
95+
Priority = "Critical"
96+
});
97+
BusinessObjectCollection.Add(new BusinessObject()
98+
{
99+
TaskId = 9,
100+
TaskName = "Child Task 8",
101+
StartDate = new DateTime(2017, 10, 30),
102+
Duration = 7,
103+
Progress = 70,
104+
ParentId = 7,
105+
Priority = "Low"
106+
});
107+
return BusinessObjectCollection;
108+
}
109+
}
110+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Collections.ObjectModel;
2+
using System.ComponentModel;
3+
4+
namespace TreeGridUGSample.Components.Data
5+
{
6+
public class TreeData
7+
{
8+
public class BusinessObject : INotifyPropertyChanged
9+
{
10+
public int TaskId { get; set; }
11+
12+
private string taskName;
13+
public string TaskName
14+
{
15+
get => taskName;
16+
set
17+
{
18+
taskName = value;
19+
NotifyPropertyChanged(nameof(TaskName));
20+
}
21+
}
22+
23+
public int? Duration { get; set; }
24+
public int? Progress { get; set; }
25+
public string Priority { get; set; }
26+
public int? ParentId { get; set; }
27+
28+
public event PropertyChangedEventHandler PropertyChanged;
29+
private void NotifyPropertyChanged(string propertyName)
30+
{
31+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
32+
}
33+
}
34+
35+
public static ObservableCollection<BusinessObject> GetSelfDataSource()
36+
{
37+
return new ObservableCollection<BusinessObject>
38+
{
39+
new BusinessObject { TaskId = 1, TaskName = "Parent Task 1", Duration = 10, Progress = 70, Priority = "Critical", ParentId = null },
40+
new BusinessObject { TaskId = 2, TaskName = "Child task 1", Duration = 6, Progress = 80, Priority = "Low", ParentId = 1 },
41+
new BusinessObject { TaskId = 3, TaskName = "Child Task 2", Duration = 5, Progress = 65, Priority = "Critical", ParentId = 2 },
42+
new BusinessObject { TaskId = 4, TaskName = "Child task 3", Duration = 6, Priority = "High", Progress = 77, ParentId = 3 },
43+
new BusinessObject { TaskId = 5, TaskName = "Parent Task 2", Duration = 10, Progress = 70, Priority = "Critical", ParentId = null }
44+
};
45+
}
46+
}
47+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
namespace TreeGridUGSample.Components.Data
2+
{
3+
public class sampleData
4+
{
5+
public int TaskID { get; set; }
6+
public string FIELD1 { get; set; }
7+
public int FIELD2 { get; set; }
8+
public int FIELD3 { get; set; }
9+
public int FIELD4 { get; set; }
10+
public int FIELD5 { get; set; }
11+
public int FIELD6 { get; set; }
12+
public int Field7 { get; set; }
13+
public int Field8 { get; set; }
14+
public int Field9 { get; set; }
15+
public int? ParentID { get; set; }
16+
public static List<sampleData> GetTreeSampleData()
17+
{
18+
string[] Names = new string[] { "VINET", "TOMSP", "HANAR", "VICTE", "SUPRD", "HANAR", "CHOPS", "RICSU", "WELLI", "HILAA", "ERNSH", "CENTC",
19+
"OTTIK", "QUEDE", "RATTC", "ERNSH", "FOLKO", "BLONP", "WARTH", "FRANK", "GROSR", "WHITC", "WARTH", "SPLIR", "RATTC", "QUICK", "VINET",
20+
"MAGAA", "TORTU", "MORGK", "BERGS", "LEHMS", "BERGS", "ROMEY", "ROMEY", "LILAS", "LEHMS", "QUICK", "QUICK", "RICAR", "REGGC", "BSBEV",
21+
"COMMI", "QUEDE", "TRADH", "TORTU", "RATTC", "VINET", "LILAS", "BLONP", "HUNGO", "RICAR", "MAGAA", "WANDK", "SUPRD", "GODOS", "TORTU",
22+
"OLDWO", "ROMEY", "LONEP", "ANATR", "HUNGO", "THEBI", "DUMON", "WANDK", "QUICK", "RATTC", "ISLAT", "RATTC", "LONEP", "ISLAT", "TORTU",
23+
"WARTH", "ISLAT", "PERIC", "KOENE", "SAVEA", "KOENE", "BOLID", "FOLKO", "FURIB", "SPLIR", "LILAS", "BONAP", "MEREP", "WARTH", "VICTE",
24+
"HUNGO", "PRINI", "FRANK", "OLDWO", "MEREP", "BONAP", "SIMOB", "FRANK", "LEHMS", "WHITC", "QUICK", "RATTC", "FAMIA" };
25+
List<sampleData> DataCollection = new List<sampleData>();
26+
Random random = new Random();
27+
var RecordID = 0;
28+
for (var i = 1; i <= 100; i++)
29+
{
30+
var name = random.Next(0, 100);
31+
sampleData Parent = new sampleData()
32+
{
33+
TaskID = ++RecordID,
34+
FIELD1 = Names[name],
35+
FIELD2 = 1967 + random.Next(0, 10),
36+
FIELD3 = 395 + random.Next(100, 600),
37+
FIELD4 = 87 + random.Next(50, 250),
38+
FIELD5 = 410 + random.Next(100, 600),
39+
FIELD6 = 67 + random.Next(50, 250),
40+
Field7 = (int)Math.Floor(random.NextDouble() * 100),
41+
Field8 = (int)Math.Floor(random.NextDouble() * 10),
42+
Field9 = (int)Math.Floor(random.NextDouble() * 10),
43+
ParentID = null
44+
};
45+
DataCollection.Add(Parent);
46+
for (var j = 1; j <= 4; j++)
47+
{
48+
var childName = random.Next(0, 100);
49+
DataCollection.Add(new sampleData()
50+
{
51+
TaskID = ++RecordID,
52+
FIELD1 = Names[childName],
53+
FIELD2 = 1967 + random.Next(0, 10),
54+
FIELD3 = 395 + random.Next(100, 600),
55+
FIELD4 = 87 + random.Next(50, 250),
56+
FIELD5 = 410 + random.Next(100, 600),
57+
FIELD6 = 67 + random.Next(50, 250),
58+
Field7 = (int)Math.Floor(random.NextDouble() * 100),
59+
Field8 = (int)Math.Floor(random.NextDouble() * 10),
60+
Field9 = (int)Math.Floor(random.NextDouble() * 10),
61+
ParentID = Parent.TaskID
62+
});
63+
}
64+
}
65+
return DataCollection;
66+
}
67+
}
68+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
namespace TreeGridUGSample.Components.Data
7+
{
8+
public class SelfReferenceData
9+
{
10+
public static List<SelfReferenceData> tree = new List<SelfReferenceData>();
11+
[Key]
12+
public int? TaskID { get; set; }
13+
public string? TaskName { get; set; }
14+
public DateTime? StartDate { get; set; }
15+
public DateTime? EndDate { get; set; }
16+
public String? Progress { get; set; }
17+
public String? Priority { get; set; }
18+
public double? Duration { get; set; }
19+
public int? ParentID { get; set; }
20+
public bool? IsParent { get; set; }
21+
public bool? Approved { get; set; }
22+
public int? ParentItem { get; set; }
23+
public SelfReferenceData() { }
24+
public static List<SelfReferenceData> GetTree()
25+
{
26+
tree.Clear();
27+
int root = -1;
28+
int TaskNameID = 0;
29+
int ChildCount = -1;
30+
int SubTaskCount = -1;
31+
for (var t = 1; t <= 60; t++)
32+
{
33+
DateTime start = new DateTime(2022, 08, 25);
34+
DateTime end = new DateTime(2027, 08, 25);
35+
DateTime startingDate = start.AddDays(t + 2);
36+
DateTime endingDate = end.AddDays(t + 20);
37+
string math = "";
38+
string progr = "";
39+
bool appr = true;
40+
int duration = 0;
41+
duration = (t % 2 == 0) ? 52 : (t % 5 == 0) ? 14 : (t % 3 == 0) ? 25 : 34;
42+
math = (t % 3) == 0 ? "High" : (t % 2) == 0 ? "Low" : "Critical";
43+
progr = (t % 3) == 0 ? "Started" : (t % 2) == 0 ? "Open" : "In Progress";
44+
appr = (t % 3) == 0 ? true : (t % 2) == 0 ? false : true;
45+
root++; TaskNameID++;
46+
int rootItem = root + 1;
47+
tree.Add(new SelfReferenceData() { TaskID = rootItem, TaskName = "Parent task " + TaskNameID.ToString(), StartDate = startingDate, EndDate = endingDate, IsParent = true, ParentID = null, Progress = progr, Priority = math, Duration = duration, Approved = appr });
48+
int parent = tree.Count;
49+
for (var c = 0; c < 2; c++)
50+
{
51+
DateTime start1 = new DateTime(2022, 08, 25);
52+
DateTime startingDate1 = start1.AddDays(c + 4);
53+
DateTime end1 = new DateTime(2025, 06, 16);
54+
DateTime endingDate1 = end1.AddDays(c + 15);
55+
root++; ChildCount++;
56+
int parn = parent + c + 1;
57+
string val = "";
58+
duration = (c % 3 == 0) ? 1 : (c % 2 == 0) ? 12 : 98;
59+
val = ((parent + c + 1) % 3 == 0) ? "Low" : "Critical";
60+
progr = ((c + 1) % 3) == 0 ? "In Progress" : ((c + 1) % 2) == 0 ? "Open" : "Validated";
61+
appr = ((c + 1) % 3) == 0 ? true : ((c + 3) % 2) == 0 ? false : true;
62+
int iD = root + 1;
63+
tree.Add(new SelfReferenceData() { TaskID = iD, TaskName = "Child task " + (ChildCount + 1).ToString(), StartDate = startingDate1, EndDate = endingDate1, IsParent = (((parent + c + 1) % 3) == 0), ParentID = rootItem, Progress = progr, Priority = val, Duration = duration, Approved = appr });
64+
if ((((parent + c + 1) % 3) == 0))
65+
{
66+
int immParent = tree.Count;
67+
for (var s = 0; s < 3; s++)
68+
{
69+
DateTime start2 = new DateTime(2022, 08, 25);
70+
DateTime startingDate2 = start2.AddDays(s + 4);
71+
DateTime end2 = new DateTime(2024, 06, 16);
72+
DateTime endingDate2 = end2.AddDays(s + 13);
73+
root++; SubTaskCount++;
74+
duration = (s % 2 == 0) ? 67 : 14;
75+
string Prior = (immParent % 2 == 0) ? "Validated" : "Normal";
76+
tree.Add(new SelfReferenceData() { TaskID = root + 1, TaskName = "Sub task " + (SubTaskCount + 1).ToString(), StartDate = startingDate2, EndDate = endingDate2, IsParent = false, ParentID = iD, Progress = (immParent % 2 == 0) ? "In Progress" : "Closed", Priority = Prior, Duration = duration, Approved = appr });
77+
}
78+
}
79+
}
80+
}
81+
return tree;
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)