-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAthenaRest_Notes.cs
More file actions
617 lines (574 loc) · 27.9 KB
/
Copy pathAthenaRest_Notes.cs
File metadata and controls
617 lines (574 loc) · 27.9 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
/// <summary>
/// This method is used for debugging purposes
/// It generates SvcCalls and adds them to SvcCalls
/// Also generate parts
/// </summary>
/// <returns>void</returns>
public void GenerateSvc()
{
SvcCall temp1 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "EAST CENTRAL REGIONAL HOSPITAL",
SvcDistance = 0,
Status = "RS",
ControlID = "G1360",
Model = "MP301SPF",
Problem = "MESSAGE: SENDER NAME NOT REGISTERED IN ADDRESS BOOK. -- NEED REMOTE SETUP --",
DateTimeIn = "2018-09-17 10:58:05.087",
ServicePhone = "770-123-4567",
SvcFullAddress = "133 Herman St, Athens GA 30601",
Notes = "Call 770-895-4796 before coming",
Tech_Initials = "NULL",
TakenBy = "TB",
SvcDate = "03/17/2020",
SvcTime = "11:38:16 AM",
SvcSolution = ""
};
SvcCALLS.Add(temp1);
SvcCall temp2 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "CANON SOLUTIONS AMERICA",
SvcDistance = 0,
Status = "INP",
Tech_Initials = "DR",
ControlID = "G1961",
Model = "IR4525I",
Problem = "HAD TO WIPE HIS COMPUTER AND NOW HE NEEDS HELP SETTING SCAN AND EMAIL BACK UP. -- NEED REMOTE SETUP --",
DateTimeIn = "2018-09-13 13:32:01.837",
ServicePhone = "770-123-4567",
SvcFullAddress = "1688 Windale Ct, Lawrenceville GA 30044",
Notes = "Needs a new paper tray",
TakenBy = "TB",
SvcDate = "03/18/2020",
SvcTime = "9:38:16 AM",
SvcSolution = ""
};
SvcCALLS.Add(temp2);
SvcCall temp3 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "NEW BEGINNINGS MED SERVICES/HAROLD WRIGHT",
SvcDistance = 0,
Status = "RS",
Tech_Initials = "NULL",
ControlID = "5817",
Model = "C230SR",
Problem = "MOVE MACHINE TO WRIGHT ONE ON GORDON HIGHWAY GO IN DELI KNOCK ON SIDE DOOR AND ASK FOR MS BLACK",
DateTimeIn = "2018-08-31 10:45:38.047",
ServicePhone = "770-123-4567",
SvcFullAddress = "133 Herman Street, Athens GA 30601",
Notes = "$125 PER DANIEL",
TakenBy = "TB",
SvcDate = "03/19/2020",
SvcTime = "11:00:00 AM",
SvcSolution = ""
};
SvcCALLS.Add(temp3);
SvcCall temp4 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "NEW BEGINNINGS MED SERVICES/HAROLD WRIGHT",
SvcDistance = 0,
Status = "NEW",
Tech_Initials = "NULL",
ControlID = "5817",
Model = "C230SR",
Problem = "MOVE MACHINE TO WRIGHT ONE ON GORDON HIGHWAY GO IN DELI KNOCK ON SIDE DOOR AND ASK FOR MS BLACK",
DateTimeIn = "2018-08-31 10:45:38.047",
ServicePhone = "770-123-4567",
SvcFullAddress = "133 Herman Street, Athens GA 30601",
Notes = "$125 PER DANIEL",
TakenBy = "TB",
SvcDate = "04/20/2020",
SvcTime = "04:20:00 PM",
SvcSolution = ""
};
SvcCALLS.Add(temp4);
SvcCall temp5 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "NEW BEGINNINGS MED SERVICES/HAROLD WRIGHT",
SvcDistance = 0,
Status = "NEW",
Tech_Initials = "NULL",
ControlID = "5817",
Model = "C230SR",
Problem = "MOVE MACHINE TO WRIGHT ONE ON GORDON HIGHWAY GO IN DELI KNOCK ON SIDE DOOR AND ASK FOR MS BLACK",
DateTimeIn = "2018-08-31 10:45:38.047",
ServicePhone = "770-123-4567",
SvcFullAddress = "133 Herman Street, Athens GA 30601",
Notes = "$125 PER DANIEL",
TakenBy = "TB",
SvcDate = "03/13/2020",
SvcTime = "10:38:16 AM",
SvcSolution = ""
};
SvcCALLS.Add(temp5);
SvcCall temp6 = new SvcCall
{
Id = Guid.NewGuid().ToString(),
SvcName = "NEW BEGINNINGS MED SERVICES/HAROLD WRIGHT",
SvcDistance = 0,
Status = "INP",
Tech_Initials = "NULL",
ControlID = "5817",
Model = "C230SR",
Problem = "MOVE MACHINE TO WRIGHT ONE ON GORDON HIGHWAY GO IN DELI KNOCK ON SIDE DOOR AND ASK FOR MS BLACK",
DateTimeIn = "2018-08-31 10:45:38.047",
ServicePhone = "770-123-4567",
SvcFullAddress = "133 Herman Street, Athens GA 30601",
Notes = "$125 PER DANIEL",
TakenBy = "TB",
SvcDate = "02/17/2020",
SvcTime = "11:59:16 AM",
SvcSolution = ""
};
SvcCALLS.Add(temp6);
Part p1 = new Part("Part X", "7");
Part p2 = new Part("Part 2", "9");
Part p3 = new Part("Part 3", "10");
Part p4 = new Part("Part 3", "10");
Part p5 = new Part("Part 3", "10");
SvcSOLUTION_PARTS.Add(p1);
SvcSOLUTION_PARTS.Add(p2);
SvcSOLUTION_PARTS.Add(p3);
SvcSOLUTION_PARTS.Add(p4);
SvcSOLUTION_PARTS.Add(p5);
//SvcCalls.Sort(orderBy() );
//SvcCalls.OrderBy(s => s.Status).ThenBy(o => o.SvcDistance);
BubbleSort_Svc_By_Distance();
BubbleSort_Svc_By_Status();
//Sort_Svc_Status();
} // GenerateSvc
/// <summary>
/// This method claims a SvcCall
/// Makes SQL call to update: @pSvcCallID, @pGivenTo, @pTimeGiven, @pLocation
/// Make sure Svc_Selected has been updated before make any sql functions
/// After making a SQL function, make sure to update the whole system
/// </summary>
public static async void Claim_Svc_SQL_(bool claiming)
{
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetCLAIM_SVC_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pSvcCallID", SqlDbType.VarChar).Value = SvcSELECTED.SvcCallID;
cmd.Parameters.Add("@pGivenTo", SqlDbType.VarChar).Value = claiming ? User.LOGGED_USER.Initials : "";
cmd.Parameters.Add("@pTimeGiven", SqlDbType.VarChar).Value = DateTime.Now.ToString();
cmd.Parameters.Add("@pLocation", SqlDbType.VarChar).Value = User.LOGGED_USER.Location;
cmd.Parameters.Add("@pStatus", SqlDbType.VarChar).Value = SvcSELECTED.Status;
cmd.CommandTimeout = 250;
conn.Open();
// TODO: make sure this command is right
cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
DebugWriteLine(ex.StackTrace);
}
}
// Query SvcCalls
_ = Query_Svc_SQL();
}
/// <summary>
/// This method is used to save a note in Database
/// @pNotes is updated
/// </summary>
public static async Task Save_SvcNotes_SQL_()
{
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetSAVE_NOTES_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pRowID", SqlDbType.VarChar).Value = SvcSELECTED.Rowguid;
cmd.Parameters.Add("@pNotes", SqlDbType.VarChar).Value = SvcSELECTED.Notes;
cmd.CommandTimeout = 250;
conn.Open();
// TODO: make sure this command is right
cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
DebugWriteLine("Claim_SvcSql" + ex.Message);
}
}
}
/// <summary>
/// This method complets a SvcCall
/// Makes an SQL Call to update: @pSvcCallID, @pLocation, @pSolution, @pDateTimeStarted
/// @pStatus, @pCallNumber, @pDateTimeCompleted, @pBlackMeter
/// </summary>
public static async Task Complet_Svc_SQL_(bool complet)
{
// Update Solution Parts
//Changed 2020-05-05 KWS
//Update_Solution_Parts_SQL();
string partList = "";
if (SvcSOLUTION_PARTS.Count != 0)
{
foreach (Part x in SvcSOLUTION_PARTS)
{
partList += x.ID + "," + x.Quantity + "|";
}
// Delete the last comment
partList = partList.Substring(0, partList.Length - 1);
}
// Check internet connection
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetCOMPLET_SVC_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pSvcCallID", SqlDbType.VarChar).Value = SvcSELECTED.SvcCallID;
cmd.Parameters.Add("@pLocation", SqlDbType.VarChar).Value = User.LOGGED_USER.Location;
cmd.Parameters.Add("@pSolution", SqlDbType.VarChar).Value = SvcSELECTED.SvcSolution; //SvcSELECTED.SvcSolution;
cmd.Parameters.Add("@pTimeStarted", SqlDbType.VarChar).Value = SvcSELECTED.SvcTimeBegin;
cmd.Parameters.Add("@pTimeCompleted", SqlDbType.VarChar).Value = SvcSELECTED.SvcTimeEnd;
cmd.Parameters.Add("@pBlackMeter", SqlDbType.Int).Value = int.Parse(SvcSELECTED.SvcBWMeter);
cmd.Parameters.Add("@pColorMeter", SqlDbType.Int).Value = int.Parse(SvcSELECTED.SvcColorMeter);
cmd.Parameters.Add("@pStatus", SqlDbType.VarChar).Value = SvcSELECTED.Status;
cmd.Parameters.Add("@pCallNumber", SqlDbType.Int).Value = int.Parse(SvcSELECTED.CallNumber);
cmd.Parameters.Add("@pTech_Init", SqlDbType.VarChar).Value = User.LOGGED_USER.Initials;
cmd.Parameters.Add("@pPart_Qty_List", SqlDbType.VarChar).Value = partList;
cmd.Parameters.Add("@pNew_Problem", SqlDbType.VarChar).Value = complet ? "" : SvcSELECTED.SvcNew_Problem;
cmd.CommandTimeout = 250;
conn.Open();
// TODO: make sure this command is right
cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
// Do Nothing
Debug.WriteLine(ex.StackTrace);
}
}
// Query Database
_ = Query_Svc_SQL();
}
/// <summary>
/// This method retrieves issued parts from Database
/// Makes an SQL Call
/// </summary>
public static async Task<bool> Retrieve_Issued_Parts_SQL_()
{
// Check internet connection
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetISSUED_PARTS_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pSvcCallID", SqlDbType.VarChar).Value = SvcSELECTED.SvcCallID;
cmd.Parameters.Add("@pTech_Init", SqlDbType.VarChar).Value = User.LOGGED_USER.Initials;
cmd.CommandTimeout = 250;
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
// Clear Solution parts
SvcSOLUTION_PARTS = new List<Part>();
// Iterate through results & adding them to entries
while (rdr.Read())
{
Part temp = new Part(rdr);
SvcSOLUTION_PARTS.Add(temp);
/*
Debug.WriteLine("*******************************************************************************************************************");
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("** " + Convert.ToString(rdr["ItemNumber"]) + " " + Convert.ToString(rdr["Qty"]));
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("*******************************************************************************************************************");*/
}
return true;
}
}
}
}
catch (Exception)
{
return false;
}
}
else
{
// TODO:
return false;
}
}
public static async Task<bool> Query_SQL_()
{
// Check internet connection
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetACTIVE_SVC_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pLocation", SqlDbType.VarChar).Value = User.LOGGED_USER.Location.ToString();
cmd.CommandTimeout = 250;
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
// Clear Service Request List
SvcCALLS = new List<SvcCall>();
// Iterate through results & adding them to entries
while (rdr.Read())
{
SvcCall temp = new SvcCall(rdr);
//temp.Init_Distance(USER_CURR_LATITUDE, USER_CURR_LONGITUDE);
SvcCALLS.Add(temp);
}
return true;
}
}
}
}
catch (Exception)
{
return false;
}
}
else
{
// TODO:
return false;
}
} // Query_SvcCalls_SQL
/// <summary>
/// This method retrieves issued parts from Database
/// Makes an SQL Call
/// </summary>
public static async Task Retrieve_Svc_History_SQL_()
{
SvcHISTORY_LIST = new ObservableCollection<JobClassModel>();
// Check internet connection
if (IsCONNECTED)
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetSVC_HISTORY_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pSvcCallID", SqlDbType.VarChar).Value = SvcSELECTED.SvcCallID;
cmd.CommandTimeout = 250;
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
// Iterate through results & adding them to entries
while (rdr.Read())
{
JobClassModel temp = new JobClassModel(rdr);
Append_Svc_Parts(SvcHISTORY_LIST, temp);
}
}
}
}
}
catch (Exception ex)
{
// TODO:
Debug.WriteLine(ex.StackTrace);
}
}
}
/// <summary>
/// This method claims a SvcCall
/// Makes SQL call to update: @pSvcCallID, @pGivenTo, @pTimeGiven, @pLocation
/// Make sure Svc_Selected has been updated before make any sql functions
/// After making a SQL function, make sure to update the whole system
/// </summary>
///
public SvcCall(SqlDataReader rdr)
{
Id = Guid.NewGuid().ToString();
Rowguid = Convert.ToString(rdr["Rowguid"]);
SerialNumber = Convert.ToString(rdr["SerialNumber"]);
ControlID = Convert.ToString(rdr["ControlID"]);
SvcCallID = Convert.ToString(rdr["SvcCallID"]);
Model = Convert.ToString(rdr["Model"]);
SvcName = Convert.ToString(rdr["SvcName"]);
SvcAddr1 = Convert.ToString(rdr["SvcAddr1"]);
SvcAddr2 = Convert.ToString(rdr["SvcAddr2"]);
SvcCity = Convert.ToString(rdr["SvcCity"]);
SvcState = Convert.ToString(rdr["SvcState"]);
SvcZip = Convert.ToString(rdr["SvcZip"]);
SvcCounty = Convert.ToString(rdr["SvcCounty"]);
ServiceContact = Convert.ToString(rdr["ServiceContact"]);
ServicePhone = Convert.ToString(rdr["ServicePhone"]);
DateTimeIn = Convert.ToString(rdr["DateTimeIn"]);
Problem = Convert.ToString(rdr["Problem"]);
Notes = Convert.ToString(rdr["Notes"]);
Status = Convert.ToString(rdr["Status"]);
CallNumber = Convert.ToString(rdr["CallNumber"]);
TakenBy = Convert.ToString(rdr["TakenBy"]);
//changed 2020-05-05 KWS
//temp.Tech_Initials = Convert.ToString(rdr["Tech_Initials"]);
Tech_Initials = Convert.ToString(rdr["GivenTo"]);
SvcDate = Convert.ToString(rdr["DateTimeIn"]).Substring(0, 9);
//SvcDate = Convert.ToDateTime(rdr["DateTimeIn"]).ToString("DD/MM/YYYY");
//changed 2020-05-05 KWS
SvcTime = Convert.ToDateTime(rdr["DateTimeIn"]).ToString("HH:mm"); // Convert.ToString(rdr["DateTimeIn"]).Substring(12,5);
SvcFullAddress = Convert.ToString(rdr["SvcAddr1"]) + " " + Convert.ToString(rdr["SvcAddr2"])
+ ", " + Convert.ToString(rdr["SvcCity"]) + " " + Convert.ToString(rdr["SvcState"]) + " " + Convert.ToString(rdr["SvcZip"]);
SvcSolution = "";
}
public JobClassModel(SqlDataReader rdr)
{
Invoice_Number = Convert.ToString(rdr["InvoiceNumber"]);
Call_Number = Convert.ToString(rdr["CallNumber"]);
Problem = Convert.ToString(rdr["Problem"]);
Solution = Convert.ToString(rdr["Solution"]);
Black_Meter = Convert.ToString(rdr["BlackMeter"]);
Color_Meter = Convert.ToString(rdr["ColorMeter"]);
DateTimeCompleted = Convert.ToString(rdr["DateTimeCompleted"]);
Solution_Parts = Convert.ToString(rdr["QtyOrdered"]) + " x " + Convert.ToString(rdr["ItemNumber"])
+ " - " + Convert.ToString(rdr["Description"]) + " -{" + Convert.ToString(rdr["Tech"]) + "}";
}
/// <summary>
/// This method initiales Svc distance property
/// by calculation the user's distance from Svc address
/// </summary>
/// <param name="user_Curr_Latitude"> User Current Latitude</param>
/// <param name="user_Curr_Longitude"> User Current Longitude</param>
public async Task Init_Distance(double user_Curr_Latitude, double user_Curr_Longitude)
{
System.Collections.Generic.IEnumerable<Location> locations_To_Destination = await Geocoding.GetLocationsAsync(SvcFullAddress);
Location location_To_Destination = locations_To_Destination.FirstOrDefault();
if (location_To_Destination == null)
{
// Notify User
SvcLatitude = 0;
SvcLongitude = 0;
}
else
{
SvcLatitude = location_To_Destination.Latitude;
SvcLongitude = location_To_Destination.Longitude;
SvcDistance = (int)Xamarin.Essentials.Location.CalculateDistance(new Location(user_Curr_Latitude, user_Curr_Longitude),
new Location(SvcLatitude, SvcLongitude), DistanceUnits.Miles);
}
}
public Part(SqlDataReader rdr)
{
ID = Convert.ToString(rdr["ItemNumber"]);
Quantity = Convert.ToString(rdr["Qty"]);
}
public User(SqlDataReader rdr)
{
//Copy from Ken
//this.Rowguid = Convert.ToString(rdr["Rowguid"]);
//this.First_Name = Convert.ToString(rdr["First_Name"]);
//this.Last_Name = Convert.ToString(rdr["Last_Name"]);
//this.Password = Convert.ToString(rdr["Password"]);
try
{
Initials = Convert.ToString(rdr["Tech_Init"]);
Username = Convert.ToString(rdr["Name"]);
Location = Convert.ToString(rdr["Location"]);
//Debug.WriteLine("* " + Convert.ToString(rdr["Name"]) + " : " + Convert.ToString(rdr["Password_Hash"]));
Password = Convert.ToString(rdr["Password_Hash"]);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
public static async void Query_Users_SQL_()
{
try
{
// Start Connection
using (SqlConnection conn = new SqlConnection(SQLServer.GetSQL_CREDENTIALS()))
{
// Create a command object identifying the stored procedure
using (SqlCommand cmd = new SqlCommand(SQLServer.GetUSERS_COMMAND(), conn))
{
// Set Parameters
// Set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 250;
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
// Iterate through results & adding them to entries
while (rdr.Read())
{
Debug.WriteLine("*******************************************************************************************************************");
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("* " + Convert.ToString(rdr["Tech_Init"]) + " " + Convert.ToString(rdr["Name"]));
Debug.WriteLine("*");
Debug.WriteLine("*");
Debug.WriteLine("*******************************************************************************************************************");
USERS.Add(new User(rdr));
}
}
}
}
}
catch
{
//DebugWriteLine(ex.Message);
//throw new Exception("VPN");
//_ = Application.Current.MainPage.DisplayAlert("Athena", "VPN", "OK");
//Connectivity_Status = true;
}
}