-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEmployeesDataSource.cs
68 lines (64 loc) · 2.91 KB
/
EmployeesDataSource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Reporting_ObjectDS_Blazor
{
[DisplayName("Employees")]
public class EmployeeList
{
public EmployeeList()
{
Items = InitializeList();
}
public EmployeeList(int noOfItems)
{
Items = InitializeList().GetRange(1, noOfItems);
}
public List<DataItem> Items { get; set; }
public List<DataItem> InitializeList()
{
return new List<DataItem>() {
new DataItem(1, 101, "Andrew Fuller", "Dr.", "Vice President, Sales"),
new DataItem(1, 102, "Anne Dodsworth", "Ms.", "Sales Representative"),
new DataItem(1, 103, "Michael Suyama", "Mr.", "Sales Representative"),
new DataItem(1, 104, "Janet Leverling", "Ms.", "Sales Representative"),
new DataItem(1, 105, "Elliot Komaroff", "Dr.", "Sales Coordinator"),
new DataItem(2, 201, "Nancy Davolio", "Ms.", "Sales Representative"),
new DataItem(2, 202, "Steven Buchanan", "Mr.", "Sales Manager"),
new DataItem(2, 203, "Laura Callahan", "Ms.", "Sales Coordinator"),
new DataItem(3, 301, "Frédérique Citeaux", "Mr.", "Sales Coordinator"),
new DataItem(3, 302, "Laurence Lebihan", "Mr.", "Sales Representative"),
new DataItem(3, 303, "Elizabeth Lincoln", "Ms.", "Sales Manager"),
new DataItem(3, 304, "Yang Wang", "Mr.", "Sales Representative"),
new DataItem(4, 401, "Antonio Moreno", "Mr.", "Sales Representative"),
new DataItem(4, 402, "Thomas Hardy", "Mr.", "Sales Representative"),
new DataItem(4, 403, "Christina Berglund", "Ms.", "Sales Manager"),
new DataItem(5, 501, "Alejandra Camino", "Ms.", "Sales Representative"),
new DataItem(5, 502, "Matti Karttunen", "Mr.", "Sales Representative"),
new DataItem(5, 503, "Rita Müller", "Mrs.", "Sales Representative"),
};
}
public List<DataItem> GetData(int noOfItems)
{
List<DataItem> revertList = new List<DataItem>(Items);
revertList.Reverse();
return revertList.Take(noOfItems).ToList();
}
}
public class DataItem
{
public DataItem(int floor, int office, string personName, string titleOfCourtesy, string title)
{
Floor = floor;
Office = office;
PersonName = personName;
TitleOfCourtesy = titleOfCourtesy;
Title = title;
}
public int Floor { get; set; }
public int Office { get; set; }
public string PersonName { get; set; }
public string TitleOfCourtesy { get; set; }
public string Title { get; set; }
}
}