-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmMain.pas
4998 lines (4624 loc) · 150 KB
/
frmMain.pas
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
unit frmMain;
{
RUNNING FireDAC Monitor
RUN FireDAC Monitor tool
Place TFDMoniRemoteClientLink onto main form
Insert into connection definition (SEE - SCMSimpleConnect.pas)
}
// {$IFDEF DEBUG}
// fDBConnection.Params.Add('MonitorBy=Remote');
// {$ENDIF}
{
WRAP SECTION TO ENABLE AND DISABLE MONITORING.
}
// {$IFDEF DEBUG}
// { TODO -oBSA -cGeneral : FireDAC Tracing - ENABLE DEBBUG }
// if Assigned(SCM.scmConnection) then
// SCM.scmConnection.ConnectionIntf.Tracing := true;
// {$ENDIF}
// {$IFDEF DEBUG}
// { TODO -oBSA -cGeneral : FireDAC Tracing - DISABLE DEBBUG }
// if Assigned(SCM.scmConnection) then
// SCM.scmConnection.ConnectionIntf.Tracing := false;
// {$ENDIF}
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.ActnList, System.ImageList,
Vcl.ImgList, Vcl.Menus, System.Actions, Vcl.PlatformDefaultStyleActnCtrls,
Vcl.ActnMan, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.DBCtrls, Vcl.CheckLst, Vcl.Grids,
Vcl.DBGrids, Vcl.ExtCtrls, Vcl.Buttons, System.Contnrs, dlgBootProgress,
SCMDefines, Vcl.VirtualImage, Vcl.VirtualImageList, Vcl.BaseImageCollection,
Vcl.ImageCollection, Vcl.WinXCtrls, Vcl.ControlList, Data.Bind.EngExt,
Vcl.Bind.DBEngExt, Vcl.Bind.ControlList, System.Rtti, System.Bindings.Outputs,
Vcl.Bind.Editors, Data.Bind.Components, Data.Bind.Grid, Data.Bind.DBScope,
Vcl.ToolWin, Vcl.ActnCtrls, Vcl.ActnMenus, Vcl.PlatformVclStylesActnCtrls,
Data.FMTBcd, Data.SqlExpr, FireDAC.Moni.Base, FireDAC.Moni.RemoteClient,
frame_INDV, frame_TEAM, SCMHelpers, dmSCM;
type
TMain = class(TForm)
ActionMainMenuBar1: TActionMainMenuBar;
ActionManager1: TActionManager;
actnAddSlot: TAction;
actnClearSlot: TAction;
actnMoveDownSlot: TAction;
actnMoveUpSlot: TAction;
actnRemoveSlot: TAction;
actnStrikeSlot: TAction;
BindingsList1: TBindingsList;
BindSourceDB1: TBindSourceDB;
BindSourceDB2: TBindSourceDB;
BindSourceDB3: TBindSourceDB;
btnClearSearch: TButton;
clbtnHeatStatus: TControlListButton;
clistCheckBox: TControlListButton;
clistEventCaption: TLabel;
clistEventDistStrokeStr: TLabel;
CloneSession2: TMenuItem;
dbimgSwimClubLogo: TDBImage;
dbnavEventNavigateNext: TDBNavigator;
dbnavEventNavigatePrior: TDBNavigator;
dbtxtDebugEntrant: TDBText;
dbtxtDebugEvent: TDBText;
dbtxtDebugEventType: TDBText;
dbtxtDebugHeat: TDBText;
dbtxtDebugMember: TDBText;
dbtxtDebugNominee: TDBText;
dbtxtDebugSession: TDBText;
dbtxtDebugSwimClub: TDBText;
dbtxtDebugTeam: TDBText;
dbtxtDebugTeamEntrant: TDBText;
dbtxtEventCaption: TDBText;
dbtxtNominateFullName: TDBText;
dbtxtSwimClubCaption: TDBText;
dbtxtSwimClubNickName: TDBText;
DeleteEvent1: TMenuItem;
DeleteHeat1: TMenuItem;
DeleteSession1: TMenuItem;
EditSession1: TMenuItem;
EmptyLane1: TMenuItem;
EntrantWidgets: TRelativePanel;
EventRpt1: TMenuItem;
EventWidgets: TRelativePanel;
Event_AutoSchedule: TAction;
Event_BuildFinals: TAction;
Event_BuildQuarterFinals: TAction;
Event_BuildSemiFinals: TAction;
Event_Delete: TAction;
Event_Grid: TDBGrid;
Event_MoveDown: TAction;
Event_MoveUp: TAction;
Event_NewRecord: TAction;
Event_Renumber: TAction;
Event_Report: TAction;
Event_ToggleGridView: TAction;
File_Exit: TAction;
File_ExportCarnival: TAction;
File_ImportCarnival: TAction;
Filter1: TMenuItem;
GotoMember: TMenuItem;
Grid_EmptyLane: TAction;
Grid_MoveDown: TAction;
Grid_MoveUp: TAction;
Grid_Renumber: TAction;
Grid_Strike: TAction;
Grid_SwapLanes: TAction;
HeatControlList: TControlList;
HeatLeftPanel: TPanel;
HeatNavigateControlList: TControlList;
HeatNavigationPanel: TRelativePanel;
HeatRightPanel: TPanel;
HeatRpt1: TMenuItem;
HeatWidgets: TRelativePanel;
Heat_AutoBuild: TAction;
Heat_BatchBuildHeats: TAction;
Heat_BatchMarshallReport: TAction;
Heat_BatchTimeKeeperReport: TAction;
Heat_Delete: TAction;
Heat_MarshallReport: TAction;
Heat_MoveDown: TAction;
Heat_MoveUp: TAction;
Heat_NewRecord: TAction;
Heat_PrintSet: TAction;
Heat_Renumber: TAction;
Heat_Report: TAction;
Heat_TimeKeeperReport: TAction;
Heat_ToggleStatus: TAction;
Help_About: TAction;
Help_LocalHelp: TAction;
Help_OnlineHelp: TAction;
Help_Website: TAction;
ImageCollection1: TImageCollection;
imeKeeper1: TMenuItem;
INDV: TframeINDV;
Label1: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label2: TLabel;
Label24: TLabel;
Label25: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
lblHeatNavigatorDistance: TLabel;
lblHeatNavigatorEventNum: TLabel;
lblHeatStrokeStr: TLabel;
lblMsgTab1: TLabel;
lblMsgTab3: TLabel;
lblNomWarning: TLabel;
lblSessionCaption: TLabel;
lblSessionEventCaption: TLabel;
LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource;
LinkGridToDataSourceBindSourceDB2: TLinkGridToDataSource;
LinkGridToDataSourceBindSourceDB3: TLinkGridToDataSource;
LinkPropertyToFieldCaption: TLinkPropertyToField;
LinkPropertyToFieldCaption2: TLinkPropertyToField;
LinkPropertyToFieldCaption3: TLinkPropertyToField;
LinkPropertyToFieldCaption4: TLinkPropertyToField;
LinkPropertyToFieldCaption5: TLinkPropertyToField;
Marshall1: TMenuItem;
MoveDown1: TMenuItem;
MoveDown2: TMenuItem;
MoveDown3: TMenuItem;
MoveUp1: TMenuItem;
MoveUp2: TMenuItem;
MoveUp3: TMenuItem;
N1: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
NewEvent1: TMenuItem;
NewRecord1: TMenuItem;
NewSession1: TMenuItem;
NominateBackPanel: TRelativePanel;
NominateCenteredPanel: TPanel;
NominateQuickPick: TRelativePanel;
NominateRightPanel: TRelativePanel;
NominateRpt1: TMenuItem;
NominateWidgets: TRelativePanel;
Nominate_ClearEventNominations: TAction;
Nominate_ClearSessionNominations: TAction;
Nominate_ControlList: TControlList;
Nominate_Edit: TEdit;
Nominate_GotoMemberDetails: TAction;
Nominate_Grid: TDBGrid;
Nominate_MemberDetails: TAction;
Nominate_Report: TAction;
Nominate_SortMembers: TAction;
oggleSessionStatus1: TMenuItem;
oggleStatus1: TMenuItem;
PageControl1: TPageControl;
pnlClient: TPanel;
pnlClubData: TRelativePanel;
pnlDebugInfo: TPanel;
pnlEventGrid: TPanel;
pnlHeatsTabSheet: TPanel;
pnlPageControl: TPanel;
pnlRight: TPanel;
pnlSessClientTop: TPanel;
pnlSessionClient: TPanel;
pnlSessionLeft: TPanel;
pnlSessLeftTop: TPanel;
pnlTitleBar: TRelativePanel;
pumEntrant: TPopupMenu;
pumEvent: TPopupMenu;
pumHeat: TPopupMenu;
pumNominate: TPopupMenu;
pumSession: TPopupMenu;
Renumber1: TMenuItem;
Renumber2: TMenuItem;
sbtnMembers: TSpeedButton;
sbtnRefresh: TSpeedButton;
SCM_ManageMembers: TAction;
SCM_Refresh: TAction;
SCM_StatusBar: TAction;
SessionRpt1: TMenuItem;
SessionWidgets: TRelativePanel;
Session_Clone: TAction;
Session_Delete: TAction;
Session_Edit: TAction;
Session_Export: TAction;
Session_Grid: TDBGrid;
Session_Import: TAction;
Session_New: TAction;
Session_Report: TAction;
Session_Sort: TAction;
Session_ToggleLock: TAction;
Session_ToggleVisible: TAction;
ShapeBarEv1: TShape;
ShapeBarEv2: TShape;
ShapeDotEv1: TShape;
ShapeHeatBar1: TShape;
ShapeHeatBar2: TShape;
ShapeHeatBar3: TShape;
ShapeHeatDot1: TShape;
ShapeHeatDot2: TShape;
ShapeHeatDot3: TShape;
ShapeHeatNavBlackLine: TShape;
ShapeNomBar1: TShape;
ShapeNomDot1: TShape;
ShapeSessBar1: TShape;
ShapeSessBar2: TShape;
ShapeSessDot1: TShape;
Sort1: TMenuItem;
Sort2: TMenuItem;
spbtnEntrantDown: TSpeedButton;
spbtnEntrantEmptyLane: TSpeedButton;
spbtnEntrantScratchLane: TSpeedButton;
spbtnEntrantSort: TSpeedButton;
spbtnEntrantSwapLanes: TSpeedButton;
spbtnEntrantUp: TSpeedButton;
spbtnEventDelete: TSpeedButton;
spbtnEventMoveDown: TSpeedButton;
spbtnEventMoveUp: TSpeedButton;
spbtnEventNew: TSpeedButton;
spbtnEventReport: TSpeedButton;
spbtnEventToggleGridView: TSpeedButton;
spbtnHeatAutoBuild: TSpeedButton;
spbtnHeatBatchPrintSet: TSpeedButton;
spbtnHeatDelete: TSpeedButton;
spbtnHeatDown: TSpeedButton;
spbtnHeatMarshall: TSpeedButton;
spbtnHeatNew: TSpeedButton;
spbtnHeatReport: TSpeedButton;
spbtnHeatTimeKeeper: TSpeedButton;
spbtnHeatToggleStatus: TSpeedButton;
spbtnHeatUp: TSpeedButton;
spbtnNominateReport: TSpeedButton;
spbtnNominateSortMember: TSpeedButton;
spbtnSessionDelete: TSpeedButton;
spbtnSessionNew: TSpeedButton;
spbtnSessionReport: TSpeedButton;
spbtnSessionToggleLock: TSpeedButton;
spbtnSessionToggleVisible: TSpeedButton;
StatusBar1: TStatusBar;
StrikeEntrant1: TMenuItem;
SwapLanes1: TMenuItem;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TEAM: TframeTEAM;
Tools_ConnectionManager: TAction;
Tools_DisqualifyCodes: TAction;
Tools_Divisions: TAction;
Tools_House: TAction;
Tools_LeaderBoard: TAction;
Tools_Preferences: TAction;
Tools_QualifyTimes: TAction;
Tools_Score: TAction;
Tools_Swimmercategory: TAction;
vimage: TVirtualImage;
vimgHeatCircle: TVirtualImage;
vimgHeatNum: TVirtualImage;
vimgHeatStroke: TVirtualImage;
vimgRelayDot: TVirtualImage;
VirtualImage1: TVirtualImage;
VirtualImageList1: TVirtualImageList;
VirtualImageList2: TVirtualImageList;
VirtualImageList3: TVirtualImageList;
VirtualImageListMenu: TVirtualImageList;
SwimClub_Switch: TAction;
SwimClub_Manage: TAction;
File_ExportSession: TAction;
procedure ActionManager1Update(Action: TBasicAction; var Handled: boolean);
procedure actnAddSlotExecute(Sender: TObject);
procedure actnClearSlotExecute(Sender: TObject);
procedure actnClearStrikeSlotUpdate(Sender: TObject);
procedure actnGridEntrantUpdate(Sender: TObject);
procedure actnMoveDownSlotExecute(Sender: TObject);
procedure actnMoveUpSlotExecute(Sender: TObject);
procedure actnRemoveSlotExecute(Sender: TObject);
procedure actnStrikeSlotExecute(Sender: TObject);
procedure btnClearSearchClick(Sender: TObject);
procedure clistCheckBoxClick(Sender: TObject);
procedure Event_AutoScheduleExecute(Sender: TObject);
procedure Event_AutoScheduleUpdate(Sender: TObject);
procedure Event_BuildFinalsExecute(Sender: TObject);
procedure Event_BuildQuarterFinalsExecute(Sender: TObject);
procedure Event_BuildSCMEventTypeUpdate(Sender: TObject);
procedure Event_BuildSemiFinalsExecute(Sender: TObject);
procedure Event_DeleteExecute(Sender: TObject);
procedure Event_DeleteUpdate(Sender: TObject);
procedure Event_GridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: integer; Column: TColumn; State: TGridDrawState);
procedure Event_GridKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Event_MoveDownExecute(Sender: TObject);
procedure Event_MoveUpExecute(Sender: TObject);
procedure Event_MoveUpOrDownUpdate(Sender: TObject);
procedure Event_NewRecordExecute(Sender: TObject);
procedure Event_NewRecordUpdate(Sender: TObject);
procedure Event_RenumberExecute(Sender: TObject);
procedure Event_RenumberUpdate(Sender: TObject);
procedure Event_ReportExecute(Sender: TObject);
procedure Event_ReportUpdate(Sender: TObject);
procedure Event_ToggleGridViewExecute(Sender: TObject);
procedure Event_ToggleGridViewUpdate(Sender: TObject);
procedure File_ExitExecute(Sender: TObject);
procedure File_ExportSessionExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: integer; MousePos: TPoint; var Handled: boolean);
procedure FormShow(Sender: TObject);
procedure Grid_EmptyLaneExecute(Sender: TObject);
procedure Grid_EmptyLaneUpdate(Sender: TObject);
procedure Grid_MoveDownExecute(Sender: TObject);
procedure Grid_MoveDownUpdate(Sender: TObject);
procedure Grid_MoveUpExecute(Sender: TObject);
procedure Grid_MoveUpUpdate(Sender: TObject);
procedure Grid_RenumberExecute(Sender: TObject);
procedure Grid_RenumberUpdate(Sender: TObject);
procedure Grid_StrikeExecute(Sender: TObject);
procedure Grid_StrikeUpdate(Sender: TObject);
procedure Grid_SwapLanesExecute(Sender: TObject);
procedure Grid_SwapLanesUpdate(Sender: TObject);
procedure HeatControlListBeforeDrawItem(AIndex: integer; ACanvas: TCanvas;
ARect: TRect; AState: TOwnerDrawState);
procedure HeatNavigateControlListBeforeDrawItem(AIndex: integer;
ACanvas: TCanvas; ARect: TRect; AState: TOwnerDrawState);
procedure Heat_AutoBuildExecute(Sender: TObject);
procedure Heat_AutoBuildUpdate(Sender: TObject);
procedure Heat_BatchBuildHeatsExecute(Sender: TObject);
procedure Heat_BatchBuildHeatsUpdate(Sender: TObject);
procedure Heat_BatchMarshallReportExecute(Sender: TObject);
procedure Heat_BatchMarshallReportUpdate(Sender: TObject);
procedure Heat_BatchTimeKeeperReportExecute(Sender: TObject);
procedure Heat_BatchTimeKeeperReportUpdate(Sender: TObject);
procedure Heat_DeleteExecute(Sender: TObject);
procedure Heat_DeleteUpdate(Sender: TObject);
procedure Heat_MarshallReportExecute(Sender: TObject);
procedure Heat_MarshallReportUpdate(Sender: TObject);
procedure Heat_MoveDownExecute(Sender: TObject);
procedure Heat_MoveDownUpdate(Sender: TObject);
procedure Heat_MoveUpExecute(Sender: TObject);
procedure Heat_MoveUpUpdate(Sender: TObject);
procedure Heat_NewRecordExecute(Sender: TObject);
procedure Heat_NewRecordUpdate(Sender: TObject);
procedure Heat_PrintSetExecute(Sender: TObject);
procedure Heat_PrintSetUpdate(Sender: TObject);
procedure Heat_ReportExecute(Sender: TObject);
procedure Heat_ReportUpdate(Sender: TObject);
procedure Heat_TimeKeeperReportExecute(Sender: TObject);
procedure Heat_TimeKeeperReportUpdate(Sender: TObject);
procedure Heat_ToggleStatusExecute(Sender: TObject);
procedure Heat_ToggleStatusUpdate(Sender: TObject);
procedure Help_AboutExecute(Sender: TObject);
procedure Help_LocalHelpExecute(Sender: TObject);
procedure Help_OnlineHelpExecute(Sender: TObject);
procedure Help_OnlineHelpUpdate(Sender: TObject);
procedure Help_WebsiteExecute(Sender: TObject);
procedure Help_WebsiteUpdate(Sender: TObject);
procedure Nominate_ControlListBeforeDrawItem(AIndex: integer;
ACanvas: TCanvas; ARect: TRect; AState: TOwnerDrawState);
procedure Nominate_EditChange(Sender: TObject);
procedure Nominate_GotoMemberDetailsExecute(Sender: TObject);
procedure Nominate_GotoMemberDetailsUpdate(Sender: TObject);
procedure Nominate_GridDblClick(Sender: TObject);
procedure Nominate_GridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: integer; Column: TColumn; State: TGridDrawState);
procedure Nominate_MemberDetailsExecute(Sender: TObject);
procedure Nominate_MemberDetailsUpdate(Sender: TObject);
procedure Nominate_ReportExecute(Sender: TObject);
procedure Nominate_ReportUpdate(Sender: TObject);
procedure Nominate_SortMembersExecute(Sender: TObject);
procedure Nominate_SortMembersUpdate(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
procedure PageControl1Changing(Sender: TObject; var AllowChange: boolean);
procedure SCM_ManageMembersExecute(Sender: TObject);
procedure SCM_ManageMembersUpdate(Sender: TObject);
procedure SCM_RefreshExecute(Sender: TObject);
procedure SCM_RefreshUpdate(Sender: TObject);
procedure SCM_StatusBarExecute(Sender: TObject);
procedure SCM_StatusBarUpdate(Sender: TObject);
procedure Session_CloneExecute(Sender: TObject);
procedure Session_CloneUpdate(Sender: TObject);
procedure Session_DeleteExecute(Sender: TObject);
procedure Session_DeleteUpdate(Sender: TObject);
procedure Session_EditExecute(Sender: TObject);
procedure Session_EditUpdate(Sender: TObject);
procedure Session_GridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: integer; Column: TColumn; State: TGridDrawState);
procedure Session_NewExecute(Sender: TObject);
procedure Session_NewUpdate(Sender: TObject);
procedure Session_ReportExecute(Sender: TObject);
procedure Session_ReportUpdate(Sender: TObject);
procedure Session_SortExecute(Sender: TObject);
procedure Session_SortUpdate(Sender: TObject);
procedure Session_ToggleGridUpdate(Sender: TObject);
procedure Session_ToggleLockExecute(Sender: TObject);
procedure Session_ToggleLockUpdate(Sender: TObject);
procedure Session_ToggleVisibleExecute(Sender: TObject);
procedure Session_ToggleVisibleUpdate(Sender: TObject);
procedure SwimClub_ManageExecute(Sender: TObject);
procedure SwimClub_ManageUpdate(Sender: TObject);
procedure SwimClub_SwitchExecute(Sender: TObject);
procedure SwimClub_SwitchUpdate(Sender: TObject);
procedure Tools_ConnectionManagerExecute(Sender: TObject);
procedure Tools_DisqualifyCodesExecute(Sender: TObject);
procedure Tools_DivisionsExecute(Sender: TObject);
procedure Tools_DivisionsUpdate(Sender: TObject);
procedure Tools_HouseExecute(Sender: TObject);
procedure Tools_HouseUpdate(Sender: TObject);
procedure Tools_LeaderBoardExecute(Sender: TObject);
procedure Tools_LeaderBoardUpdate(Sender: TObject);
procedure Tools_PreferencesExecute(Sender: TObject);
procedure Tools_QualifyTimesExecute(Sender: TObject);
procedure Tools_ScoreExecute(Sender: TObject);
procedure Tools_ScoreUpdate(Sender: TObject);
procedure Tools_SwimmercategoryExecute(Sender: TObject);
procedure Tools_SwimmercategoryUpdate(Sender: TObject);
private
bootprogress: TBootProgress;
fFrameBgColor: TColor;
// TRACK the MemberID of the last known member to have their
// IsQualified status checked via Nominee_UpdateCheckListBoxQualified();
fLastMemberQualified: integer;
// Internet connection state
fMyInternetConnected: boolean;
{ Private declarations }
// For scroll wheel tracking on mouse ...
FOrgDBGridWndProc: TWndMethod;
fscmStyleName: String;
fSessionClosedBgColor: TColor;
fSessionClosedFontColor: TColor;
// number of members - called OnCreate and after frmManageMembers dialogue
fCountOfMembers: integer;
prefDisplayDivisions: boolean;
prefDisplaySwimmerCAT: boolean;
prefEnableDCode: boolean;
prefEnableTeamEvents: boolean;
prefEnableSplitTimesForINDV: boolean;
prefEnableSplitTimesForTEAM: boolean;
SCMEventList: TObjectList;
function AssertConnection(): boolean; // Check connection to MSSQL DATABASE
procedure Heat_AutoBuildRelayExecute(Sender: TObject);
procedure DBGridWndProc(var Msg: TMessage);
procedure DrawEventStatus(oGrid: TObject; Rect: TRect; Column: TColumn);
// procedure EnableEvent_GridEllipse();
procedure Event_BuildSCMEventType(Sender: TObject;
EventType: scmEventFinalsType);
// Miscellaneous - uncatagorized
procedure GetSCMPreferences();
procedure Refresh_Event(DoBookmark: boolean = true;
DoRenumber: boolean = false);
procedure Refresh_Heat(DoBookmark: boolean = true;
DoRenumber: boolean = false);
// REFRESH
procedure Refresh_IndvTeam(DoBookmark: boolean = true;
DoRenumber: boolean = false);
procedure Refresh_Nominate(DoBookmark: boolean = true);
procedure Refresh_TeamEntrant(DoBookmark: boolean = true); // --
// Generic TAction onExecute (extended params) for BATCH PRINT
procedure Session_BatchReportExecute(Sender: TObject; RptType: scmRptType);
// ENTRANT_GRID Toggle column display
procedure ToggleDCode(DoEnable: boolean);
procedure ToggleDivisions(SetVisible: boolean);
procedure ToggleSwimmerCAT(SetVisible: boolean);
procedure DisplayHeatStatusMsg(aHeatStatusID: integer);
protected
// posted by dmSCMNom : a refresh of the entrant grid is required.
procedure Entrant_LaneWasCleaned(var Msg: TMessage);
message SCM_LANEWASCLEANED;
procedure Event_AssertStatusState(var Msg: TMessage);
message SCM_EVENTASSERTSTATUSSTATE;
procedure Event_Scroll(var Msg: TMessage); message SCM_EVENTSCROLL;
procedure Heat_Scroll(var Msg: TMessage); message SCM_HEATSCROLL;
procedure INDV_Scroll(var Msg: TMessage); message SCM_ENTRANTSCROLL;
// Posted by TSCM.qryMemberQuickPick : AfterScroll
procedure Nominate_Scroll(var Msg: TMessage); message SCM_NOMINATESCROLL;
procedure RenumberHeats(var Msg: TMessage); message SCM_RENUMBERHEATS;
procedure Session_AssertStatusState(var Msg: TMessage);
message SCM_SESSIONASSERTSTATUSSTATE;
// windows messages ....
procedure Session_Scroll(var Msg: TMessage); message SCM_SESSIONSCROLL;
procedure Session_RenumberEvents(var Msg: TMessage); message SCM_RENUMBEREVENTS;
procedure SetTabSheetDisplayState(var Msg: TMessage);
message SCM_TABSHEETDISPLAYSTATE;
procedure TeamEntrant_Scroll(var Msg: TMessage);
message SCM_TEAMENTRANTSCROLL;
procedure Team_Scroll(var Msg: TMessage); message SCM_TEAMSCROLL;
procedure UpdateEntrantCount(var Msg: TMessage);
message SCM_UPDATEENTRANTCOUNT;
procedure UpdateINDVTEAM(var Msg: TMessage); message SCM_UPDATEINDVTEAM;
procedure UpdateStatusBar(var Msg: TMessage); message SCM_UPDATESTATUSBAR;
public
{ Public declarations }
fDoStatusBarUpdate: boolean; // FLAG ACTION - SCM_StatusBar.Enabled
fSCMisInitializing: boolean; // FLAG FormCreate
end;
var
Main: TMain;
implementation
{$R *.dfm}
uses
System.UITypes, dlgBasicLogin, Vcl.Themes, SCMUtility,
System.IniFiles, System.DateUtils,
dlgCloneSession, rptSessionReportA, rptSessionReportB,
dlgNewSession, dmAutoBuildV2, rptEventReportA, rptEventReportB,
dlgAutoBuild_Heats, dlgAbout, dlgPreferences, rptNominateReportA,
rptNominateReportB, dlgQualifyTimes, dlgSwimmerCategory,
FireDAC.VCLUI.ConnEdit, FireDAC.Stan.Param, frmManageMember,
rptMarshallReportA,
rptMarshallReportB, rptTimeKeeperReportA, rptTimeKeeperReportB, dlgHouse,
dlgAutoBuild_Finals, dlgPointsScored, dlgDivision, dlgLeaderBoard,
dlgSelectPrinter, ioutils, dlgBatchProgress, dlgAutoBuild_Batch, ShellAPI,
UEnvVars, dlgEntrantPicker, dlgEntrantPickerCTRL, dmSCMNom, dlgSwapLanes,
dlgDBVerInfo, rptHeatReportA, rptHeatReportB, frmDisqualificationCodes,
dlgAutoSchedule, dlgDCodePicker, dmSCMHelper, rptMarshallReportC,
dlgSplitTimeTEAM, dlgSplitTimeINDV, dlgSwimClubSwitch, dlgSwimClubManage,
dlgABRelay, uABRelayExec, dlgExportSessionJSON;
procedure TMain.Heat_AutoBuildRelayExecute(Sender: TObject);
var
i, rtnValue: Integer;
dlg: TABRelay;
ABRelay: TABRelayExec;
begin
// NOTE: actn..Update determines if this routine is accessable.
{ Count number of nominees (swimmers) for event.
Exclude entrants (swimmers) in RACED or CLOSED heats.
INCLUDE nominees (swimmers) in OPEN heats.
INCLUDE pooled nominees (swimmers) not assigned a lane to the event.
}
i := SCM.CountTEAMNominee();
if (i = 0) then
begin
MessageDlg('''
No available nominees were found for this event.
Note: nominees (swimmers) in closed or raced heats are excluded.
Auto-Build TEAM-RELAYs was aborted.
''', mtError, [mbOK], 0, mbOK);
exit;
end;
{open the RELAY_TEAM dialogue.}
dlg := TABRelay.Create(self);
rtnValue := dlg.ShowModal;
{closing the form here ensures prefences have been
written out to the preference ini file.}
dlg.Free;
if not IsPositiveResult(rtnValue) then exit;
{TODO -oBSA -cAutoBuildRelay : Partial team. Exclude nominee dialogue.}
{Hand over process to uABRelayExec.}
ABRelay := TABRelayExec.Create(Self);
ABRelay.Prepare(SCM.scmConnection, SCM.Event_ID);
ABRelay.ExecAutoBuildRelay();
if ABRelay.Success then
begin
SCM.qryTeamEntrant.DisableControls;
SCM.qryTeam.DisableControls;
SCM.qryHeat.DisableControls;
SCM.qryTeamEntrant.Close;
SCM.qryTeam.Close;
SCM.qryHeat.Close;
SCM.qryHeat.Open;
SCM.qryTeam.Open;
SCM.qryTeamEntrant.Open;
SCM.qryHeat.EnableControls;
SCM.qryTeamEntrant.EnableControls;
SCM.qryTeam.EnableControls;
// Refresh_Heat;
// Refresh_IndvTeam;
//
// Requery SCM.qryEvent to update entrant count.
PostMessage(Handle, SCM_UPDATEENTRANTCOUNT, 0, 0);
// Set flag for statusbar update.
PostMessage(Handle, SCM_UPDATESTATUSBAR, 0, 0);
end;
ABRelay.free;
end;
procedure TMain.ActionManager1Update(Action: TBasicAction;
var Handled: boolean);
begin
// kill the statusbar action during initialization.
if AssertConnection then
begin
if fSCMisInitializing then SCM_StatusBar.Enabled := false;
end;
end;
procedure TMain.actnAddSlotExecute(Sender: TObject);
begin
if AssertConnection then TEAM.spbtnAddSlotClick(Sender);
end;
procedure TMain.actnClearSlotExecute(Sender: TObject);
var
rtnValue, rows: integer;
aEventType: scmEventType;
begin
aEventType := SCM.CurrEventType;
if aEventType = etUnknown then exit;
rtnValue := MessageDlg('Clear the team entrant?', mtConfirmation,
[mbNo, mbYes], 0, mbYes);
if (rtnValue = mrYes) then
begin
rows := TEAM.ClearSlot;
if rows > 0 then
begin
// S T A T U S B A R . Update entrant totals and any other UI elements
fDoStatusBarUpdate := true; // permits TACTION StatusBarUpdate
SCM_StatusBar.Execute;
end;
end;
end;
procedure TMain.actnClearStrikeSlotUpdate(Sender: TObject);
var
DoEnable: boolean;
aEventType: scmEventType;
begin
DoEnable := false;
if AssertConnection then
// Checks if session is Empty. Then checks if locked..
if not SCM.Session_IsLocked then
// are there any heats?
if not SCM.dsHeat.DataSet.IsEmpty then
// is the current heat closed?
if not SCM.Heat_IsClosed then
begin
aEventType := SCM.CurrEventType;
if aEventType = etTEAM then
begin
if not SCM.dsTeam.DataSet.IsEmpty then
begin
if not SCM.dsTeamEntrant.DataSet.IsEmpty then
if TEAM.TeamActiveGrid = 2 then
// Need a relay in a lane to be able to clear it....
if not SCM.dsTeamEntrant.DataSet.FieldByName('MemberID').IsNull
then DoEnable := true;
end;
end;
end;
TAction(Sender).Enabled := DoEnable;
end;
procedure TMain.actnGridEntrantUpdate(Sender: TObject);
var
DoEnable: boolean;
aEventType: scmEventType;
begin
DoEnable := false;
if AssertConnection then
// Checks if session is Empty. Then checks if locked..
if not SCM.Session_IsLocked then
// are there any heats?
if not SCM.dsHeat.DataSet.IsEmpty then
// is the current heat closed?
if not SCM.Heat_IsClosed then
begin
aEventType := SCM.CurrEventType;
if aEventType = etTEAM then
begin
if not SCM.dsTeam.DataSet.IsEmpty then
begin
if TEAM.TeamActiveGrid = 2 then
if not SCM.dsTeamEntrant.DataSet.IsEmpty then DoEnable := true;
end;
end;
end;
TAction(Sender).Enabled := DoEnable;
end;
procedure TMain.actnMoveDownSlotExecute(Sender: TObject);
begin
TEAM.SlotMovedOWN(Sender);
end;
procedure TMain.actnMoveUpSlotExecute(Sender: TObject);
begin
TEAM.SlotMoveUp(Sender);
end;
procedure TMain.actnRemoveSlotExecute(Sender: TObject);
begin
if AssertConnection then TEAM.spbtnRemoveSlotClick(Sender);
end;
procedure TMain.actnStrikeSlotExecute(Sender: TObject);
begin
if AssertConnection then TEAM.spbtnTeamEntrantStrikeClick(Sender);
end;
function TMain.AssertConnection: boolean;
begin
result := false;
// test datamodule construction
if Assigned(SCM) then
begin
// IsActive if TFDConnection::scmConnection && FireDAC tables are active
if SCM.SCMActive then result := true;
end;
end;
procedure TMain.btnClearSearchClick(Sender: TObject);
begin
Nominate_Edit.Text := '';
if Nominate_Edit.CanFocus then Nominate_Edit.SetFocus;
end;
procedure TMain.clistCheckBoxClick(Sender: TObject);
var
MemberID, EventID, EventNum: integer;
DoNominate: boolean;
nom: TSCMNom;
begin
if not AssertConnection then exit;
MemberID := SCM.dsNominateMembers.DataSet.FieldByName('MemberID').AsInteger;
if (MemberID = 0) then exit;
DoNominate := BindSourceDB1.DataSet.FieldByName('IsNominated').AsBoolean;
EventID := BindSourceDB1.DataSet.FieldByName('EventID').AsInteger;
EventNum := BindSourceDB1.DataSet.FieldByName('EventNum').AsInteger;
// PERFORM THE TOGGLE
DoNominate := not DoNominate;
// Class to nominate/unnominate safely
nom := TSCMNom.CreateWithConnection(self, SCM.scmConnection);
if (DoNominate) then nom.NominateMember(MemberID, EventID)
else
// Returns true if member was unNominated.
// May have required that a Lane was emptied of member.
// TSCMnom will post message SCM_LANEWASCLEANED
nom.UnNominateMember(MemberID, EventID);
nom.Free;
// CLOSE, SET new PARMS and OPEN the database used by the controllist.
// This is needed for images in event Nominate_ControlListBeforeDrawItem
SCM.Nominate_UpdateControlList(SCM.Session_ID, MemberID);
// CLOSE makes inactive the bind source, but DATASET connection ok.
if not BindSourceDB1.DataSet.Active then BindSourceDB1.DataSet.Active := true;
// locate to the last selected ControlList record.
SCM.Nominate_LocateEventNum(BindSourceDB1.DataSet, EventNum);
// paint the member tomatoe red in the nominate_grid
Nominate_Grid.Invalidate;
// Requery SCM.qryEvent to update entrant count.
PostMessage(Handle, SCM_UPDATEENTRANTCOUNT, 0, 0);
// Set flag for statusbar update.
PostMessage(Handle, SCM_UPDATESTATUSBAR, 0, 0);
end;
procedure TMain.DBGridWndProc(var Msg: TMessage);
begin
if ((Msg.Msg = WM_VSCROLL) and (Msg.WParamLo = SB_THUMBTRACK)) then
Msg.WParamLo := SB_THUMBPOSITION;
if Assigned(FOrgDBGridWndProc) then FOrgDBGridWndProc(Msg);
end;
procedure TMain.DisplayHeatStatusMsg(aHeatStatusID: integer);
begin
case aHeatStatusID of
2:
begin
lblMsgTab3.Caption := 'Heat Raced';
lblMsgTab3.Visible := true;
end;
3:
begin
lblMsgTab3.Caption := 'Heat Closed';
lblMsgTab3.Visible := true;
end;
else
lblMsgTab3.Visible := false;
end;
end;
procedure TMain.DrawEventStatus(oGrid: TObject; Rect: TRect; Column: TColumn);
var
MyRect: TRect;
iPos, iFactor: integer;
g: TDBGrid;
begin
g := TDBGrid(oGrid);
// clear the cell with the current OS brush color?
g.Canvas.FillRect(Rect);
// calculate margins
MyRect.Top := Round((Rect.Bottom - Rect.Top - 11) / 2) + Rect.Top;
MyRect.Left := Round((Rect.Right - Rect.Left - 11) / 2) + Rect.Left;
MyRect.Bottom := MyRect.Top + 10;
MyRect.Right := MyRect.Left + 10;
iPos := MyRect.Left;
iFactor := 1;
// DRAW A TICK
g.Canvas.Pen.Color := clWebTomato;
g.Canvas.MoveTo(iPos + (iFactor * 2), MyRect.Top + 4);
g.Canvas.LineTo(iPos + (iFactor * 2), MyRect.Top + 7);
g.Canvas.MoveTo(iPos + (iFactor * 3), MyRect.Top + 5);
g.Canvas.LineTo(iPos + (iFactor * 3), MyRect.Top + 8);
g.Canvas.MoveTo(iPos + (iFactor * 4), MyRect.Top + 6);
g.Canvas.LineTo(iPos + (iFactor * 4), MyRect.Top + 9);
g.Canvas.MoveTo(iPos + (iFactor * 5), MyRect.Top + 5);
g.Canvas.LineTo(iPos + (iFactor * 5), MyRect.Top + 8);
g.Canvas.MoveTo(iPos + (iFactor * 6), MyRect.Top + 4);
g.Canvas.LineTo(iPos + (iFactor * 6), MyRect.Top + 7);
g.Canvas.MoveTo(iPos + (iFactor * 7), MyRect.Top + 3);
g.Canvas.LineTo(iPos + (iFactor * 7), MyRect.Top + 6);
g.Canvas.MoveTo(iPos + (iFactor * 8), MyRect.Top + 2);
g.Canvas.LineTo(iPos + (iFactor * 8), MyRect.Top + 5);
end;
procedure TMain.Entrant_LaneWasCleaned(var Msg: TMessage);
begin
// message posted by TSCMNom SCM_LANEWASCLEANED
Refresh_IndvTeam;
end;
procedure TMain.Event_AssertStatusState(var Msg: TMessage);
var
AllClosed: boolean;
aEventID, newEventStatusID: integer;
fld: TField;
begin
if not AssertConnection then exit;
// Toggle EVENT_GRID EventStatusID.
// If all the heats for the event have been closed then a tick is displayed
// in the UI.
aEventID := SCM.dsEvent.DataSet.FieldByName('EventID').AsInteger;
if (aEventID > 0) then
begin
AllClosed := SCM.Event_AllHeatsAreClosed(aEventID);
if (((AllClosed = true) and
(SCM.dsEvent.DataSet.FieldByName('EventStatusID').AsInteger = 1)) or
((AllClosed = false) and (SCM.dsEvent.DataSet.FieldByName('EventStatusID')
.AsInteger = 2))) then
begin
SCM.dsEvent.DataSet.DisableControls;
if AllClosed then newEventStatusID := 2
else newEventStatusID := 1;
// only modify the record if required ...
if (SCM.dsEvent.DataSet.FieldByName('EventStatusID').AsInteger <>
newEventStatusID) then
begin
{ ALTERNATIVE METHOD
if SCM.Event_SetEventStatusID(aEventID, newEventStatusID) then
begin
SCM.dsEvent.DataSet.Refresh;
SCM.Event_Locate(aEventID);
end;
}
// 13.10.2020 SCM.qryEvent.EventStatusID is READ ONLY
fld := SCM.dsEvent.DataSet.FindField('EventStatusID');
if Assigned(fld) then fld.ReadOnly := false;
// go update the status of the event
SCM.dsEvent.DataSet.Edit;
SCM.dsEvent.DataSet.FieldByName('EventStatusID').AsInteger :=
newEventStatusID;
// 22.09.2020 TimeStamp event closed date.
// posted by TMain::Heat_ToggleStatusExecute(TObject *Sender)
// used by SCM_LeaderBoard application to auto-update it's view
// with the most resently closed event.
if AllClosed then
// Only timestamp if needed
SCM.dsEvent.DataSet.FieldByName('CloseDT').AsDateTime := Now();
SCM.dsEvent.DataSet.Post;
SCM.dsEvent.DataSet.Refresh;
if Assigned(fld) then fld.ReadOnly := true;
// que to event record
SCM.Event_Locate(aEventID);
end;
SCM.dsEvent.DataSet.EnableControls();
end;
end;
end;
procedure TMain.Event_AutoScheduleExecute(Sender: TObject);
var
dlg: TAutoSchedule;
EventID: integer;
rtnValue: TModalResult;
begin
if not AssertConnection then exit;
SCM.dsEvent.DataSet.DisableControls;
EventID := SCM.Event_ID;
dlg := TAutoSchedule.CreateWithConnection(self, SCM.scmConnection);
dlg.SessionID := SCM.Session_ID;
rtnValue := dlg.ShowModal;
dlg.Free;
if IsPositiveResult(rtnValue) then
begin
SCM.dsEvent.DataSet.Refresh;
SCM.Event_Locate(EventID);
end;
SCM.dsEvent.DataSet.EnableControls;
end;
procedure TMain.Event_AutoScheduleUpdate(Sender: TObject);
var
DoEnable: boolean;
begin
DoEnable := false;
if AssertConnection then
if not SCM.dsSession.DataSet.IsEmpty then
begin
if not SCM.dsEvent.DataSet.IsEmpty then DoEnable := true;
end;
TAction(Sender).Enabled := DoEnable;
end;
procedure TMain.Event_BuildFinalsExecute(Sender: TObject);
begin
Event_BuildSCMEventType(Sender, ftFinals);
end;
procedure TMain.Event_BuildQuarterFinalsExecute(Sender: TObject);
begin
Event_BuildSCMEventType(Sender, ftSemi);
end;
procedure TMain.Event_BuildSCMEventType(Sender: TObject;
EventType: scmEventFinalsType);
var
dm: TAutoBuildV2;
dlg: TAutoBuild_Finals;
success: boolean;
EventID, rtnValue: integer;
begin
if not AssertConnection then exit;
dlg := TAutoBuild_Finals.Create(self);
dlg.TypeOfEvent := EventType;
rtnValue := dlg.ShowModal;
dlg.Free;
if (rtnValue = mrYes) then
begin
EventID := SCM.dsEvent.DataSet.FieldByName('EventID').AsInteger;
dm := TAutoBuildV2(self);
success := dm.AutoBuildExecuteExt(EventID, EventType);
dm.Free;
if (success) then
begin
// refresh...