-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcls_Utility_Class.qfl
1165 lines (1064 loc) · 93.4 KB
/
cls_Utility_Class.qfl
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
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Public Utility
Set Utility = UtilityInstance
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
Class clsUtility
'------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Function SearchForEntity(strEntityCategory, strEntityType, strSearchBy, strSearchByType, strSearchByID, strCountry, strEntityStatus, strAction)
Dim iCount
' Click on the New EM Request Button
WebButton.Click "New EM Request"
GenericObject.HandlePopUp "OK"
If Not Browser("Browser").Page("Process Work").Frame("RoomPane_Search").Exist(2) Then
SearchForEntity = "Fail"
Exit Function
End If
' See which category to choose
WebList.SelectItem "Search Entity Category", strEntityCategory
If strEntityCategory <> "Individual" Then
WebList.SelectItem "Search Entity Type", strEntityType
End If
' Select Search by
WebList.SelectItem "Search By", strSearchBy
' Select which search we're doing
Select Case strSearchBy
Case "GRID"
WebEdit.SetText "Search GRID", strSearchByID
Case "Name"
If strEntityCategory = "Individual" Then
Else
WebEdit.SetText "Search Legal Name", strSearchByID
End If
Case "Government ID"
WebList.SelectItem "Search Government ID Type", strSearchByType
WebEdit.SetText "Search Government ID", strSearchByID
Case "Cross Reference ID"
WebList.SelectItem "Search Cross Reference Type", strSearchByType
WebEdit.SetText "Search Cross Reference ID", strSearchByID
End Select
' Click on search
WebButton.Click "Search"
Do
rc = WebButton.GetROProperty("Search", "disabled")
Wait 1
iCount = iCount + 1
If iCount > 120 Then
Reporter.ReportEvent micFail, "Search Failed", "Search button was pressed but was disabled for more than 120 seconds, aborting..."
ExitTest
End If
Loop Until rc = 0
If strAction = "Create" Then
' See if the Create button appears
If WebButton.Exist("Create Entity", 25) Then
WebButton.Click "Create Entity"
Else
WebCheckBox.SetItem "No Match Found", "ON"
WebButton.Click "Create Entity"
End If
GenericObject.HandlePopUp "OK"
Exit Function
Else
' Select the correct one from the list of results
iRows = WebTable.RowCount("Entity Search Results")
For i = 1 To iRows
rc = WebTable.GetCellData("Entity Search Results", i, 3)
If CStr(Trim(rc)) = CStr(strSearchByID) Then
WebRadioGroup.SelectItem "Search Results Selection", i -1
Wait 2
Exit For
End If
Next
End If
' See which action were doing
Select Case strAction
Case "Amend"
' See if Amend button exists
If WebButton.Exist("Amend Entity", 25) Then
WebButton.Click "Amend Entity"
Else
If WebElement.Exist("An Entity Maintenance", 2) Then
Reporter.ReportEvent micFail, "Amend - Search Failed", "The [ " & WebEdit.GetROProperty("An Entity Maintenance", "innertext") & " ] message was displayed. Cannot continue..."
Else
Reporter.ReportEvent micFail, "Amend - Search Failed", "Searched entity selected but the [ Amend Entity ] button was not displayed, please check. Aborting..."
End If
ExitTest
End If
Case "Deactivate"
' See if Deactivate button exists
If WebButton.Exist("Deactivate Entity", 25) Then
WebButton.Click "Deactivate Entity"
Else
If WebElement.Exist("An Entity Maintenance", 2) Then
Reporter.ReportEvent micFail, "Deactivate - Search Failed", "The [ " & WebEdit.GetROProperty("An Entity Maintenance", "innertext") & " ] message was displayed. Cannot continue..."
Else
Reporter.ReportEvent micFail, "Deactivate - Search Failed", "Searched entity selected but the [ Deactivate Entity ] button was not displayed, please check. Aborting..."
End If
ExitTest
End If
Case "Reactivate"
' See if Reactivate button exists
If WebButton.Exist("Reactivate Entity", 25) Then
WebButton.Highlight "Reactivate Entity"
WebButton.Click "Reactivate Entity"
Else
If WebElement.Exist("An Entity Maintenance", 2) Then
Reporter.ReportEvent micFail, "Reactivate - Search Failed", "The [ " & WebEdit.GetROProperty("An Entity Maintenance", "innertext") & " ] message was displayed. Cannot continue..."
Else
Reporter.ReportEvent micFail, "Reactivate - Search Failed", "Searched entity selected but the [ Reactivate Entity ] button was not displayed, please check. Aborting..."
End If
ExitTest
End If
End Select
GenericObject.HandlePopUp "OK"
End Function
'------------------------------------------------------------------------------------------------------------------
Public Sub FindAndSelectGrid()
Dim strGrid, strERD, getGridColumn, getData1, getData2
Dim iTableRows, iTableCols, iGridColumn, iRequestCol, iFlagGridFound
Dim blnVerifyGrid
Dim a, b
Dim objTbl
' Get the Grid from the database
strGrid = DB.ReturnValue("select GRID_ID from Validation where Test_ID = " & iTestID & " and Entity_Type = '" & strEntityType & "'")
strERD = DB.ReturnValue("select ERD_ID from Validation where Test_ID = " & iTestID & " and Entity_Type = '" & strEntityType & "'")
' Find the Grid by filtering
WebButton.Click "Filter by GRID"
If WebEdit.Exist("GRID Entry", 15) Then
WebEdit.SetText "GRID Entry", strGrid
WebButton.Init "Apply"
WebButton.Click "Apply"
Wait 2
End If
' Click twice on the Grid header to make it sort descending
WebElement.Click "GRID"
WebElement.Init "GRID"
WebElement.Click "GRID"
WebElement.Init "GRID"
' Set the table as an object so we don't have to keep referencing it
Set objTbl = WebTable.SetObject("Urgency")
iTableCols = objTbl.GetROProperty("cols")
blnVerifyGrid = False
a = 1
For b = 1 To iTableCols
getGridColumn = objTbl.GetCellData(a, b)
If Trim(getGridColumn) = "GRID" Then
iGridColumn = b
Exit For
End If
Next
a = 1
For b = 1 To iTableCols
getGridColumn = objTbl.GetCellData(a, b)
If Trim(getGridColumn) = "Request ID" Then
iRequestCol = b
Exit For
End If
Next
iFlagGridFound = 0
Do
Set objTbl = WebTable.SetObject("Urgency")
iTableRows = objTbl.GetROProperty("rows")
For a = 1 To iTableRows
getData1 = Trim(objTbl.GetCellData(a, iGridColumn))
getData2 = Trim(objTbl.GetCellData(a, iRequestCol))
If CStr(getData1) <> CStr(strGrid) Then
blnVerifyGrid = False
Else
If CStr(getData2) = strERD Then
blnVerifyGrid = True
Reporter.ReportEvent micPass, "Grid Id:", "Grid ID - [" & strGrid & "] matches with [" & getData1 & "]"
Wait 2
On Error Resume Next
WebElement.Click "html tag:=TD|innertext:=" & strGrid & "|outerhtml:=<TD class=tdLeftStyle tid=.*</TD>"
Wait 1
If Err Then
If CStr(getData2) = strERD Then
WebElement.Click "html tag:=TD|innertext:=" & strERD
End If
On Error GoTo 0
End If
iFlagGridFound =1
Exit For
End If
End If
Next
If iFlagGridFound = 1 Then
Exit Do
End If
rc = 0
If WebLink.Exist("Next", 3) Then
WebLink.Click "Next"
Wait 5
rc = 1
End If
Loop While rc = 1
If blnVerifyGrid = False Then
Reporter.ReportEvent micFail, "Grid Id:", "Grid ID - [" & iGridID & "] did not match with [" & getData1 & "]. Cannot proceed further"
ExitTest
End If
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub CheckIfDuplicate(strYorN, strProcess)
Dim strRejectionText
' Click on the the Check If Duplicate Button
WebButton.Click "Check if Duplicate"
Select Case strYorN
Case "Yes", "yes", "Y", "y"
DuplicateSearch
Select Case strProcess
Case "Prep For Create"
strRejectionText = DB.ReturnValue("select Rejection_Reason_Text from Prep_Details where Test_ID = " & iTestID & " and Entity_Type = '" & strEntityType & "'")
WebEdit.SetText "Rejection Reason Text", strRejectionText
DB.WriteToTable "Validation", iTestID, "Status,Resolved-Rejected", True
End Select
Case Else
' Select Grid as search
WebList.WaitProperty "Search By", "disabled", 0, 2000
WebList.Init "Search By"
WebList.SelectItem "Search By", "GRID"
' Just enter non-existing grid
WebEdit.WaitProperty "GRID", "disabled", 0 , 2000
WebEdit.Init "GRID"
WebEdit.SetText "GRID", "101101"
' Search
WebButton.WaitProperty "Search", "disabled", 0, 2000
WebButton.Click "Search"
' OK
WebButton.Click "OK"
' Make sure we're back on the main page
WebList.WaitProperty "Language", "disabled", 0, 5000
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Function DuplicateSearch()
Dim strSelection, strField, strData
' Get the data from the table
thisArr = Data.GetDataForSection(iTestID, "Duplicate_Search", strProcessType)
For Each splitEle In thisArr
thisSplit = Split(splitEle, "|")
For Each nextEle In thisSplit
nextSplit = Split(nextEle, ",")
For x = 0 To UBound(nextSplit) -1
strField = Replace(nextSplit(0), "_", " ")
strData = nextSplit(1)
If strData <> "" Then
Select Case strField
Case "Entity Category", "Entity Type", "Search By", "Government ID Type", "Cross Reference ID Type"
WebList.WaitProperty strField, "disabled", 0, 5000
WebList.Init strField
WebList.SelectItem strField, strData
Case "GRID", "Legal Name", "First Name", "Middle Name", "Last Name", "Government ID", "Cross Reference ID"
WebEdit.WaitProperty strField, "disabled", 0, 5000
WebEdit.Init strField
WebEdit.SetText strField, strData
Case "Include Alternate Names in Search", "Include Former Names in Search"
If strData = "N" Then
WebCheckBox.SetItem strData, "Off"
Else
WebCheckBox.SetItem strData, "On"
End If
Case "Selection Item"
strSelection = strData
End Select
End If
Next
Next
Next
' Now search
WebButton.Click "Search"
' See if we get records back
If WebRadioGroup.Exist("Search Results Selection", 30) Then
' Select the correct one from the list of results
iRows = WebTable.RowCount("Entity Search Results")
For i = 1 To iRows
rc = WebTable.GetCellData("Entity Search Results", i, 3)
If Trim(rc) = strSelection Then
WebRadioGroup.SelectItem "Search Results Selection", i -1
WebButton.Init "OK"
WebButton.Click "OK"
Reporter.ReportEvent micPass, "Duplicate Search Completion", "Records returned and [ " & strSelection & " ] item selected from the returned list."
DuplicateSearch = strSelection
Exit For
End If
Next
Else
' Report and exit
Reporter.ReportEvent micFail, "Duplicate Search Error", "No records returned for search criteria. Continuing with test but results could be incorrect..."
WebButton.Click "OK"
DuplicateSearch = strSelection
End If
End Function
'------------------------------------------------------------------------------------------------------------------
Public Sub LegalParent(strYorN)
Dim strSelection, strField, strData, rc
Dim iRows
' See if we do this or not
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Firstly click the button
ExpandAll
WebButton.Click "Search Legal Parent"
' Get the data from the table
thisArr = Data.GetDataForSection(iTestID, "Duplicate_Search", strProcessType)
For Each splitEle In thisArr
thisSplit = Split(splitEle, "|")
For Each nextEle In thisSplit
nextSplit = Split(nextEle, ",")
For x = 0 To UBound(nextSplit) -1
strField = Replace(nextSplit(0), "_", " ")
strData = nextSplit(1)
If strData <> "" Then
Select Case strField
Case "Search By", "Government ID Type", "Cross Reference ID Type"
WebList.WaitProperty strField, "focused", True, 3000
WebList.SelectItem strField, strData
Case "GRID", "Legal Name", "First Name", "Middle Name", "Last Name", "Government ID", "Cross Reference ID"
WebEdit.WaitProperty strField, "focused", True, 3000
WebEdit.SetText strField, strData
Case "Include Alternate Names in Search", "Include Former Names in Search"
If strData = "N" Then
WebCheckBox.SetItem strData, "Off"
Else
WebCheckBox.SetItem strData, "On"
End If
Case "Selection Item"
strSelection = strData
End Select
End If
Next
Next
Next
' Now search
WebButton.Click "Search"
' See if we get records back
If WebRadioGroup.Exist("Search Results Selection", 30) Then
' Select the correct one from the list of results
iRows = WebTable.RowCount("Entity Search Results")
For i = 1 To iRows
rc = WebTable.GetCellData("Entity Search Results", i, 3)
If Trim(rc) = strSelection Then
WebRadioGroup.SelectItem "Search Results Selection", i -1
WebButton.Init "OK"
WebButton.Click "OK"
Reporter.ReportEvent micPass, "Legal Parent Completion", "Records returned and [ " & strSelection & " ] item selected from the returned list."
Exit For
End If
Next
Else
' Report and exit
Reporter.ReportEvent micFail, "Legal Parent Error", "No records returned for search criteria. Continuing with test but results could be incorrect..."
WebButton.Click "OK"
End If
' Check that the selected legal parent is displayed
ExpandAll
rc = WebElement.GetROProperty("Selected Legal Parent", "innertext")
If Trim(rc) = strSelection Then
Reporter.ReportEvent micPass, "[ Search Legal Parent ] Success", "Legal Parent Searched and selected and showing on Entity correctly"
DB.WriteToTable "Validation", iTestID, "Legal_Parent_Added,Yes", True
Else
Reporter.ReportEvent micFail, "[ Search Legal Parent ] Failure", "Legal Parent Searched and selected but not showing correctly on Entity, please check..."
End If
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub RemoveLegalParent(strYorN)
' See if we do this or not
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all just in-case
ExpandAll
' Firstly click the button
If WebButton.Exist("Remove Legal Parent", 2) Then
WebButton.Click "Remove Legal Parent"
ExpandAll
Wait 1
If WebButton.Exist("Remove Legal Parent", 2) Then
Reporter.ReportEvent micFail, "[ Remove Legal Parent] Failure", "[ Remove Legal Parent ] button pressed but the GRID value is still showing on the Entity. Please check..."
Else
Reporter.ReportEvent micPass, "[ Remove Legal Parent] Success", "[ Remove Legal Parent ] button pressed and the associated GRID value has been removed from the Entity."
End If
Else
Reporter.ReportEvent micFail, "[ Remove Legal Parent ] Failure", "[ Remove Legal Parent ] button was not displayed. Please check..."
End If
DB.WriteToTable "Validation", iTestID, "Legal_Parent_Added,No", True
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub DisplayLegalParent(strYorN)
Dim iCount
' See if we do this or not
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all just in-case
ExpandAll
' Click on the Display Entity Details button
If WebButton.Exist("Display Entity Details", 2) Then
WebButton.Click "Display Entity Details"
Do
Wait 1
iCount = iCount + 1
If iCount > 120 Then
Reporter.ReportEvent micFail, "[ Display Entity Details ] Failure", "Waited 120 seconds for the Entity Details to be displayed. Please check."
Exit Sub
End If
Loop Until WebElement.Exist("Entity Type", 1) = True
' Now validate the tables
ValidateEntityDetails
' Close the window
Browser("Browser").Window("Display Entity Details").Activate
Browser("Browser").Window("Display Entity Details").Close
Else
Reporter.ReportEvent micFail, "[ Display Entity Details ] Failure", "The [ Display Entity Details ] button was not displayed, please check."
End If
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub SearchDuplicateOf(strYorN)
Dim rc, strSelection
Dim objDesc, objWES, objWE
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all sections
ExpandAll
' Click on the Search Duplicate button
WebButton.Click "Search Duplicate Of"
' Search for the Duplicate
strSelection = DuplicateSearch
' Expand all sections
ExpandAll
' Check that the Duplicate has been added
Set objDesc = Description.Create
objDesc("micclass").Value = "WebElement"
objDesc("html tag").Value = "TD"
objDesc("outerhtml").Value = "<TD class=dataValueRead style=" &chr(34) & "WIDTH: .*px; HEIGHT: 25px" & chr(34) & ">.*</TD>"
Set objWES = GenericObject.ChildObjects("RoomPane", objDesc)
For i = 0 To objWES.Count -1
Set objWE = objWES.Item(i)
rc = Trim(objWE.GetROProperty("innertext"))
If IsNumeric(rc) Then
If rc = strSelection Then
Reporter.ReportEvent micPass, "[ Search Duplicate Of ] Success", "Duplicate Searched and selected and showing on Entity correctly"
Exit Sub
End If
End If
Next
' If we get here it failed
Reporter.ReportEvent micFail, "[ Search Duplicate Of ] Failure", "Duplicate Searched and selected but not showing correctly on Entity, please check..."
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub RemoveDuplicateOf(strYorN)
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all sections
ExpandAll
' Click on the Search Duplicate button
If WebButton.Exist("Remove Duplicate Of", 2) Then
WebButton.Click "Remove Duplicate Of"
' Expand all sections
ExpandAll
Wait 1
' See if the grid web element still exists
If WebButton.Exist("Remove Duplicate Of", 2) Then
Reporter.ReportEvent micFail, "[ Remove Duplicate Of ] Failure", "[ Remove Duplicate Of ] button pressed but the GRID value is still showing on the Entity. Please check..."
Else
Reporter.ReportEvent micPass, "[ Remove Duplicate Of ] Success", "[ Remove Duplicate Of ] button pressed and the associated GRID value has been removed from the Entity."
End If
Else
Reporter.ReportEvent micFail, "[ Remove Duplicate Of ] Failure", "[ Remove Duplicate Of ] button was not displayed. Please check..."
End If
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub DisplayEntityDetails(strYorN)
Dim iCount
Dim thisObj
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all sections
ExpandAll
' Click on the Display Entity Details button
If WebButton.Exist("Display Entity Details", 2) Then
WebButton.Click "Display Entity Details"
Do
Wait 1
iCount = iCount + 1
If iCount > 120 Then
Reporter.ReportEvent micFail, "[ Display Entity Details ] Failure", "Waited 120 seconds for the Entity Details to be displayed. Please check."
Exit Sub
End If
Loop Until WebElement.Exist("Entity Type", 1) = True
' Now validate the tables
ValidateEntityDetails
' Close the window
Browser("Browser").Window("Display Entity Details").Activate
Browser("Browser").Window("Display Entity Details").Close
Else
Reporter.ReportEvent micFail, "[ Display Entity Details ] Failure", "The [ Display Entity Details ] button was not displayed, please check."
End If
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Private Sub ValidateEntityDetails
Dim strTableText, strField, strData, strTable
Dim iFieldPos, iStart, iFieldLen, iNewPosAlt, iValueLen, iValuePosError, iLen
Dim objPage, objDesc, objTables, objTable
iStart = 1
' Get the page object for use later
Set objPage = GenericObject.SetObject("Display Entity Details Page")
' Get the details from the table depending
thisArr = Data.GetDataForSection(iTestID, "EntityValidation", strProcessType)
' Get the text from the main table
strTableText = WebTable.GetROProperty("Entity Details", "innertext")
' Remove spaces and uppercase
strTableText = UCase(Replace(strTableText, " ", ""))
iLen = Len(strTableText)
' Loop round data seeing if we find it in the text stream
For Each splitEle In thisArr
thisSplit = Split(splitEle, "|")
For Each nextEle In thisSplit
nextSplit = Split(nextEle, ",")
For x = 0 To UBound(nextSplit) -1
strNCField = Replace(nextSplit(0), "_", " ")
strNCData = nextSplit(1)
strField = UCase(Replace(nextSplit(0), "_", ""))
strData = UCase(Replace(nextSplit(1), " ", ""))
If strData <> "" Then
If strField = "ALTNAMETYPE" Then
strField = "NAMETYPE"
strNCField = "Name Type"
End If
If strField = "ALTNAME" Then
strField = "NAME"
strNCField = "Name"
End If
Select Case strField
Case "ENTITYTYPE", "GRID", "ENTITYLEGALNAME", "ENTITYSTATUS", "DATAVERIFICATIONSTATUS", "APPROVALSTATUS", "COUNTRYOFINCORPORATION", "COMMONLOOKUPNAME"
blnTextString = True
Case "DATEOFINCORPORATION", "COUNTRYOFPRIMARYOPERATION", "FUNDTYPE", "COUNTRYOFHEADOFFICE", "HSBCAFFILIATE", "COUNTRYOFRESIDENCE", "STRATEGICCLIENT"
blnTextString = True
Case "TITLE", "FIRSTNAME", "MIDDLENAME", "LASTNAME", "DATEOFBIRTH","COUNTRYOFBIRTH", "PROFESSIONALSUFFIX", "GENERATIONSUFFIX", "NATIONALITY", "NATIONALITY2", "NATIONALITY3"
blnTextString = True
Case "PRIMARYSICCODE", "PRIMARYSIC%", "SECONDARYSICCODE", "SECONDARYSIC%", "TERTIARYSICCODE", "TERTIARYSIC%"
blnTextString = True
Case "NAMETYPE", "NAME"
strTable = "Alternate Names"
blnTextString = False
Case "ADDRESSTYPE", "ADDRESSLINE1", "ADDRESSLINE2", "CITY", "STATE/PROVINCE", "COUNTRY", "POSTALCODE"
strTable = "Addresses"
blnTextString = False
Case "EMAILADDRESSTYPE", "EMAILADDRESS"
strTable = "Email Addresses"
blnTextString = False
Case "WEBSITEADDRESSTYPE", "WEBSITEADDRESS"
strTable = "Website Addresses"
blnTextString = False
Case "PHONENUMBERTYPE", "IDDCODE", "AREACODE", "PHONENUMBER", "EXTENSION"
strTable = "Telephone Details"
blnTextString = False
Case "GOVERNMENTIDTYPE", "GOVERNMENTIDENTIFIER", "ALTERNATEIDSYSTEM", "ALTERNATEID"
strTable = "Identifiers"
blnTextString = False
Case "VENDORS", "VENDORID", "CURRENT"
strTable = "Vendor Links"
blnTextString = False
End Select
If blnTextString = True Then
Do
' Find where the field exists in the string
iFieldPos = InStr(iStart, strTableText, strField)
If iFieldPos > 0 Then
iFieldLen = Len(strField)
' Set to the end of the field in the string
iNewPosAlt = iFieldPos + iFieldLen
' Get the length of the text to check
iValueLen = Len(strData)
' See if it matches
strActualVal = Mid(strTableText, iNewPosAlt, iValueLen)
If strActualVal <> strData Then
iValuePosError = iValuePosError + 1
iStart = iNewPosAlt
Else
iStart = 1
If iValuePosError > 0 Then
iValuePosError = 0
End If
Reporter.ReportEvent micPass, "[ Validate Entity Details ] Success", "Found expected value [ " & strNCData & " ] for field [ " & strNCField & " ]"
Exit Do
End If
If iStart >= iLen - 2 Then
Exit Do
End If
Else
Reporter.ReportEvent micFail, "[ Validate Entity Details ] Failure", "Field [" & strNCField & "] - Not Found"
Exit Do
End If
Loop Until iStart >= iLen
If iValuePosError > 0 Then
Reporter.ReportEvent micFail, "[ Validate Entity Details ] Failure", "Could not find expected value [ " & strNCData & "] for field [ " & strNCField & " ]. Shows [" & strActualVal & "]. Please check."
End If
Else
' Build description of the table
Set objDesc = Description.Create
objDesc("micclass").Value = "WebTable"
objDesc("html tag").Value = "TABLE"
objDesc("text").Value = strTable & ".*"
Set objTables = objPage.ChildObjects(objDesc)
If objTables.Count = 0 Then
Exit For
End If
Set objTable = objTables.Item(0)
iCol = objTable.GetRowWithCellText(strNCField)
If iCol > 0 Then
iRow = objTable.GetRowWithCellText(strNCData, iCol)
If iRow > 0 Then
Reporter.ReportEvent micPass, "[ Validate Entity Details ] Success", "Found expected value [ " & strNCData & " ] for field [ " & strNCField & " ]"
Else
Reporter.ReportEvent micFail, "[ Validate Entity Details ] Failure", "Could not find expected value [ " & strNCData & "] for field [ " & strNCField & " ]. Please check."
End If
Else
Reporter.ReportEvent micFail, "[ Validate Entity Details ] Failure", "Could not find field [ " & strNCField & " ] to validate against. Please check."
End If
End If
End If
Next
Next
Next
Set objTable = Nothing
Set objTables = Nothing
Set objDesc = Nothing
Set objPage = Nothing
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub VendorLinks(strYorN)
Dim strWebList, strWebListProp, strWebEdit, strWebEditProp
Dim myObj
Dim iRowDeleted, i
' See if we're adding vendors
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Set up flag on main table
DB.WriteToTable "Validation", iTestID, "Vendors_Added,Yes", True
' Get the data from the table
thisArr = Data.GetDataForSection(iTestID, "Vendors", strProcessType)
' Expand all - just in-case not already done
ExpandAll
' Loop round data
For Each splitEle In thisArr
thisSplit = Split(splitEle, "|")
For Each nextEle In thisSplit
nextSplit = Split(nextEle, ",")
For x = 0 To UBound(nextSplit) -1
strField = Replace(nextSplit(0), "_", " ")
strData = nextSplit(1)
If strData <> "" Then
Select Case strField
Case "Count"
i = strData
iNoVendors = HowManyVendors
If strData = 1 Then
If iNoVendors = 0 Then
AddNewVendorRow
End If
strWebListProp = WebList.GetTOProperty("Vendor", "name")
strWebEditProp = WebEdit.GetTOProperty("Vendor ID", "name")
ElseIf strData = 2 Then
If iRowDeleted = 0 Then
If iNoVendors = 1 Then
AddNewVendorRow
End If
Else
If iNoVendors = 0 Then
AddNewVendorRow
strWebListProp = WebList.GetTOProperty("Vendor", "name")
strWebEditProp = WebEdit.GetTOProperty("Vendor ID", "name")
End If
End If
ElseIf strData = 3 Then
If iRowDeleted = 0 Then
If iNoVendors = 2 Then
AddNewVendorRow
End If
Else
If iNoVendors = 1 Then
AddNewVendorRow
End If
End If
End If
iNoVendors = HowManyVendors
Case "Vendor"
If i = 1 Then
If strData = "Delete" Then
If iNoVendors = 0 Then
Exit For
End If
If iNoVendors > 1 Then
Set objDesc = Description.Create
objDesc("micclass").Value = "WebRadioGroup"
objDesc("name").Value = "RadioGroup"
objDesc("html tag").Value = "INPUT"
Set objRadios = GenericObject.ChildObjects("RoomPane", objDesc)
Set objRadio = objRadios.Item(0)
objRadio.Select "#" & i
End If
DeleteRow strField, i
iRowDeleted = i
Else
rc =WebList.WaitProperty(strField, "disabled", 0, 12)
WebList.SelectItem strField, strData
End If
Else
If iRowDeleted = 0 Then
strWebList = Replace(strWebListProp, 1, i)
Else
strWebList = Replace(strWebListProp, 1, i -1)
End If
Set myObj = WebList.SetObject(strField)
myObj.SetTOProperty "name", strWebList
rc = myObj.WaitProperty("disabled", 0 , 15)
myObj.Init
myObj.Select strData
myObj.SetTOProperty "name", strWebListProp
End If
Case "Vendor ID"
If i = 1 Then
rc = WebEdit.WaitProperty(strField, "disabled", 0, 12)
WebEdit.SetText strField, strData
Else
If iRowDeleted = 0 Then
strWebEdit = Replace(strWebEditProp, 1, i)
Else
strWebEdit = Replace(strWebEditProp, 1, i -1)
End If
Set myObj = WebEdit.SetObject(strField)
myObj.SetTOProperty "name", strWebEdit
rc = myObj.WaitProperty("disabled", 0, 15)
myObj.Init
myObj.Set strData
myObj.SetTOProperty "name", strWebEditProp
End If
Case "Current"
If strData = "Yes" Then
rc = WebRadioGroup.GetROProperty("Current Vendor", "items count")
If rc = 1 Then
If WebRadioGroup.GetROProperty("Current Vendor", "selected item index") <> 1 Then
Reporter.ReportEvent micFail, "Current Vendor Default", "Current Vendor should default to 1st item if only one item is created. Object has not defaulted, please check."
End If
Else
Set objDesc = Description.Create
objDesc("micclass").Value = "WebRadioGroup"
objDesc("name").Value = "RadioGroup"
objDesc("html tag").Value = "INPUT"
Set objRadios = GenericObject.ChildObjects("RoomPane", objDesc)
Set objRadio = objRadios.Item(0)
If iRowDeleted > 0 Then
objRadio.Select "#" & i -2
Else
objRadio.Select "#" & i-1
End If
Reporter.ReportEvent micPass, "Current Vendor Set", "Current Vendor set for row [ " & i & " ] of the Vendor collection."
End If
End If
End Select
End If
Next
Next
Next
End Select
Set objRadio = Nothing
Set objRadios = Nothing
Set objDesc = Nothing
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Sub NotifyParties(strYorN)
Dim strField, strData, strSearch
' See if we're adding vendors
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Get the data from the table
thisArr = Data.GetDataForSection(iTestID, "Notify Parties", strProcessType)
' Expand all - just in-case not already done
ExpandAll
' Loop round data
For Each splitEle In thisArr
thisSplit = Split(splitEle, "|")
For Each nextEle In thisSplit
nextSplit = Split(nextEle, ",")
For x = 0 To UBound(nextSplit) -1
strField = Replace(nextSplit(0), "_", " ")
strData = nextSplit(1)
If strData <> "" Then
Select Case strField
Case "Entity Type"
Case "First Name 1", "First Name 2", "First Name 3"
' See if the field exists
If WebEdit.Exist("Notify " & strField, 2) Then
WebEdit.SetText "Notify " & strField, strData
End If
strSearch = strData
Case "Last Name 1"
If WebEdit.Exist("Notify " & strField, 2) Then
WebEdit.SetText "Notify " & strField, strData
WebButton.Click "Notify Search 1"
strSearch = strSearch & "|" & strData
GetPartyFromList strSearch
End If
Case "Last Name 2"
If WebEdit.Exist("Notify " & strField, 2) Then
WebEdit.SetText "Notify " & strField, strData
WebButton.Click "Notify Search 2"
strSearch = strSearch & "|" & strData
GetPartyFromList strSearch
End If
Case "Last Name 3"
If WebEdit.Exist("Notify " & strField, 2) Then
WebEdit.SetText "Notify " & strField, strData
WebButton.Click "Notify Search 3"
strSearch = strSearch & "|" & strData
GetPartyFromList strSearch
End If
Case Else
CheckPartyValue strField, strData
End Select
End If
Next
Next
Next
End Select
End Sub
'------------------------------------------------------------------------------------------------------------------
Public Function RandomSelection(strType)
Dim objRS
Dim iRecCount, iRnd, iCount
Randomize
' Make type of for DB
strType = Replace(strType, " ", "_")
' Get the list from the reference data table
iRecCount = DB.ReturnValue("select count(" & strType & ") from Reference_Data") -1
Set objRS = DB.ReturnRecordSet("select " & strType & " from Reference_Data")
' Get a random number between 0 and the record count
iRnd = Int((iRecCount - 1) * Rnd)
If iRnd = 0 Then
RandomSelection = objRS.Fields(0).Value
Set iRecCount = Nothing
Set objRS = Nothing
Exit Function
End If
' Build the array
Do While Not objRS.EOF
iCount = iCount + 1
If iCount = iRnd Then
RandomSelection = objRS.Fields(0).Value
Set iRecCount = Nothing
Set objRS = Nothing
Exit Function
End If
objRS.MoveNext
Loop
Set iRecCount = Nothing
Set objRS = Nothing
End Function
'------------------------------------------------------------------------------------------------------------------
Public Sub AmendmentSummary(strYorN)
' See if we're doing this
Select Case strYorN
Case "Yes", "yes", "Y", "y"
' Expand all - just in-case not already done
ExpandAll
' Get the data prior to the amendment and the data after the amendment
currData = Data.GetDataForValidation(iTestID, strEntityType & " Details", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, strEntityType & " Details", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Main Details"
currData = Data.GetDataForValidation(iTestID, "Alternate Names", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Alternate Names", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Alternate Names"
currData = Data.GetDataForValidation(iTestID, "Addresses", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Addresses", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Addresses"
currData = Data.GetDataForValidation(iTestID, "Email Addresses", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Email Addresses", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Email Addresses"
currData = Data.GetDataForValidation(iTestID, "Website Addresses", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Website Addresses", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Website Addresses"
currData = Data.GetDataForValidation(iTestID, "Telephone Details", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Telephone Details", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Telephone Details"
If strEntityType <> "Individual" Then
currData = Data.GetDataForValidation(iTestID, "SICs", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "SICs", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "SICS"
End If
currData = Data.GetDataForValidation(iTestID, "Government IDs", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Government IDs", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Government IDs"
currData = Data.GetDataForValidation(iTestID, "Alternate IDs", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Alternate IDs", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Alternate IDs"
If strProcessType <> "Create" Then
If DB.ReturnValue("select Search_Duplicate_Of from Prep_Details where Test_ID = " & iTestID & " and Entity_Type = '" & strEntityType & "'") = "Yes" Then
If DB.ReturnValue("select Remove_Duplicate_Of from Prep_Details where Test_ID = " & iTestID & " and Entity_Type = '" & strEntityType & "'") <> "Yes" Then
currData = Data.GetDataForValidation(iTestID, "Duplicate_Search", strProcessType, "Current")
origData = Data.GetDataForValidation(iTestID, "Duplicate_Search", strProcessType, "Original")
Data.Amendment_Verify currData, origData, "Related Entities"
End If