-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
246 lines (184 loc) · 7.27 KB
/
Copy pathProgram.cs
File metadata and controls
246 lines (184 loc) · 7.27 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
using System.Text.Json;
using System.Reflection;
using UCDRosettaAPI;
//Submitted Argument Check
if(args.Length > 0 && string.IsNullOrEmpty(args[0]) == false)
{
switch(args[0].ToLower())
{
case "people-login":
PeopleSearching(RosettaAPIWorker.PeopleSearchBy.loginid,args[1]);
break;
case "people-iam":
PeopleSearching(RosettaAPIWorker.PeopleSearchBy.iamid,args[1]);
break;
case "people-employee":
PeopleSearching(RosettaAPIWorker.PeopleSearchBy.employeeid,args[1]);
break;
case "people-student":
PeopleSearching(RosettaAPIWorker.PeopleSearchBy.studentid,args[1]);
break;
case "people-department":
PeopleSearching(RosettaAPIWorker.PeopleSearchBy.department,args[1]);
break;
case "employee-iam":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.iamid,args[1]);
break;
case "employee-department":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.departmentid,args[1]);
break;
case "employee-division":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.divisionid,args[1]);
break;
case "employee-organization":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.organizationid,args[1]);
break;
case "employee-subdivision":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.subdivisionid,args[1]);
break;
case "employee-subdivisionl4":
EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy.subdivisionl4id,args[1]);
break;
case "departments":
ShowDepartments();
break;
}
}
else
{
ShowArgumentOptions();
}
//###############################
// People Searching
//###############################
static void PeopleSearching(RosettaAPIWorker.PeopleSearchBy peopleSearchBy,string searchTerm)
{
//Initiate Rosetta API Worker
RosettaAPIWorker rosettaAPIWrkr = new();
//Query People by Search Parameters
List<RosettaPerson> lRosettaPeople = rosettaAPIWrkr.GetPeopleBySearchTerm(peopleSearchBy,searchTerm.Trim());
//Loop Through Returned Rosetta People Listing
foreach(RosettaPerson rosettaPrsn in lRosettaPeople)
{
//For Readability
Console.WriteLine(" ");
Console.WriteLine("=========== " + rosettaPrsn.DisplayName + " =============");
Console.WriteLine(" ");
//Loop Through Rosetta Person Class and Display Each Property Value
foreach (PropertyInfo property in rosettaPrsn.GetType().GetProperties())
{
if(property.Name != "lEmployeeAssociations" && property.Name != "lStudentAssociations")
{
Console.WriteLine($"{property.Name}: {property.GetValue(rosettaPrsn)}");
}
}
//For Readability
Console.WriteLine(" ");
//Display Employee Associations
if(rosettaPrsn.lEmployeeAssociations.Count > 0)
{
Console.WriteLine("Employee Associations:");
Console.WriteLine(" ");
foreach(RosettaEmployeeAssociation rea in rosettaPrsn.lEmployeeAssociations)
{
foreach(PropertyInfo reaProp in rea.GetType().GetProperties())
{
Console.WriteLine($"{reaProp.Name}: {reaProp.GetValue(rea)}");
}
Console.WriteLine(" ");
}
}//End of Employee Associations
//Display Student Associations
if(rosettaPrsn.lStudentAssociations.Count > 0)
{
Console.WriteLine("Student Associations:");
Console.WriteLine(" ");
foreach(RosettaStudentAssociationShort rsa in rosettaPrsn.lStudentAssociations)
{
foreach(PropertyInfo rsaProp in rsa.GetType().GetProperties())
{
Console.WriteLine($"{rsaProp.Name}: {rsaProp.GetValue(rsa)}");
}
Console.WriteLine(" ");
}
}//End of Student Associations
}//End of lRosettaPeople Listing
}
//###############################
// Employee-Associations
//###############################
static void EmployeeSearching(RosettaAPIWorker.EmployeeSearchBy employeeSearchBy,string searchTerm)
{
//Initiate Rosetta API Worker
RosettaAPIWorker rosettaAPIWrkr = new();
//Query Employee Associations by Search Parameters
List<RosettaEmployeeAssociation> lRosettaEmplAssocs = rosettaAPIWrkr.GetEmployeeAssociationsBySearchTerm(employeeSearchBy,searchTerm.Trim());
//Loop Through Returned Rosetta Employee Associations
foreach(RosettaEmployeeAssociation rosettaEmplAssoc in lRosettaEmplAssocs)
{
//For Readability
Console.WriteLine(" ");
//Loop Through Rosetta Employee Association Class and Display Each Property Value
foreach(PropertyInfo reaProp in rosettaEmplAssoc.GetType().GetProperties())
{
Console.WriteLine($"{reaProp.Name}: {reaProp.GetValue(rosettaEmplAssoc)}");
}
//For Readability
Console.WriteLine(" ");
}
Console.WriteLine("Employee Associations Count: " + lRosettaEmplAssocs.Count.ToString());
}
//###############################
// Show Rosetta Departments
//###############################
static void ShowDepartments()
{
//Initiate Rosetta API Worker
RosettaAPIWorker rosettaAPIWrkr = new();
List<RosettaDepartment> lRosettaDepartments = rosettaAPIWrkr.GetRosettaDepartments();
foreach(RosettaDepartment rosettaDept in lRosettaDepartments)
{
//For Readability
Console.WriteLine(" ");
//Loop Through Rosetta Department Class and Display Each Property Value
foreach(PropertyInfo deptProp in rosettaDept.GetType().GetProperties())
{
Console.WriteLine($"{deptProp.Name}: {deptProp.GetValue(rosettaDept)}");
}
//For Readability
Console.WriteLine(" ");
}
Console.WriteLine("Departments Count: " + lRosettaDepartments.Count.ToString());
}
//###############################
// Display Agrument Options
//###############################
static void ShowArgumentOptions()
{
Console.WriteLine(" ");
Console.WriteLine("Argument Options:");
Console.WriteLine("=======================");
Console.WriteLine("people-login <userid>");
Console.WriteLine("people-iam <iamid>");
Console.WriteLine("people-employee <employeeid>");
Console.WriteLine("people-student <studentid>");
Console.WriteLine("people-department <departmentcode>");
Console.WriteLine("employee-iam <iamid>");
Console.WriteLine("employee-department <departmentcode>");
Console.WriteLine("employee-division <divisionid>");
Console.WriteLine("employee-organization <organizationid>");
Console.WriteLine("employee-subdivision <subdivisionid>");
Console.WriteLine("employee-subdivisionl4 <subdivisionl4id>");
Console.WriteLine("departments");
Console.WriteLine(" ");
Console.WriteLine(" ");
}
//############################
// Testing Snippets
//############################
//Wait for 4 Seconds
//await Task.Delay(TimeSpan.FromSeconds(4));
// //Testing Loop
// for(int i = 0; i < 1;i++)
// {
// }