@@ -162,6 +162,9 @@ TMarshall = class(TForm)
162
162
LinkListControlToField1: TLinkListControlToField;
163
163
btnClear: TButton;
164
164
actnClearDCode: TAction;
165
+ lblSelectSwimClub: TLabel;
166
+ cmbSwimClubList: TComboBox;
167
+ LinkListControlToField2: TLinkListControlToField;
165
168
procedure actnConnectExecute (Sender: TObject);
166
169
procedure actnConnectUpdate (Sender: TObject);
167
170
procedure actnDisconnectExecute (Sender: TObject);
@@ -177,6 +180,7 @@ TMarshall = class(TForm)
177
180
procedure FormDestroy (Sender: TObject);
178
181
procedure BigButtonClick (Sender: TObject);
179
182
procedure btnClearClick (Sender: TObject);
183
+ procedure cmbSwimClubListChange (Sender: TObject);
180
184
procedure ListViewEventChange (Sender: TObject);
181
185
procedure ListViewHeatChange (Sender: TObject);
182
186
procedure ListViewLaneChange (Sender: TObject);
@@ -207,6 +211,7 @@ TMarshall = class(TForm)
207
211
public
208
212
{ Public declarations }
209
213
procedure Refresh_BigButtons ;
214
+ procedure Refresh_Event ;
210
215
procedure Refresh_Entrant ;
211
216
procedure Refresh_Lane ;
212
217
end ;
@@ -507,7 +512,14 @@ procedure TMarshall.chkbUseFINAcodesChange(Sender: TObject);
507
512
procedure TMarshall.cmbSessionListChange (Sender: TObject);
508
513
begin
509
514
if Assigned(SCM) and SCM.scmConnection.Connected then
515
+ begin
516
+ if SCM.IsActive then
517
+ begin
518
+ bsEvent.DataSet.First;
519
+ bsHeat.DataSet.First;
520
+ end ;
510
521
Update_TabSheetCaptions;
522
+ end ;
511
523
end ;
512
524
513
525
procedure TMarshall.ConnectOnTerminate (Sender: TObject);
@@ -680,6 +692,20 @@ procedure TMarshall.btnClearClick(Sender: TObject);
680
692
end
681
693
end ;
682
694
695
+ procedure TMarshall.cmbSwimClubListChange (Sender: TObject);
696
+ begin
697
+ if Assigned(SCM) and SCM.scmConnection.Connected then
698
+ begin
699
+ if SCM.IsActive then
700
+ begin
701
+ bsSession.DataSet.First;
702
+ bsEvent.DataSet.First;
703
+ bsHeat.DataSet.First;
704
+ end ;
705
+ Update_TabSheetCaptions;
706
+ end ;
707
+ end ;
708
+
683
709
procedure TMarshall.ListViewEventChange (Sender: TObject);
684
710
begin
685
711
Update_TabSheetCaptions;
@@ -759,6 +785,7 @@ procedure TMarshall.TabControl1Change(Sender: TObject);
759
785
begin
760
786
lblConnectionStatus.Text := ' ' ;
761
787
Refresh_Lane;
788
+ Update_DCode;
762
789
// Big buttons are NOT DATA-AWARE. Refresh 'QUALIFICATION STATUS'
763
790
Refresh_BigButtons;
764
791
end ;
@@ -878,11 +905,11 @@ procedure TMarshall.PostFINAcode(ADisqualifyCodeID: integer);
878
905
if not SCM.IsActive then
879
906
exit;
880
907
881
- // if (SCM.qryLane.FieldByName('EntrantID').IsNull) then exit;
882
- // if (SCM.qryLane .FieldByName('EntrantID ').AsInteger = 0 ) then exit;
908
+ // L A N E I S E M P T Y .
909
+ if (bsLane.DataSet .FieldByName(' MemberID ' ).IsNull ) then exit;
883
910
884
911
// Note: only 'OPEN' heats can be modified ...
885
- if not (SCM.qryHeat .FieldByName(' HeatStatusID' ).AsInteger = 1 ) then
912
+ if not (bsHeat.DataSet .FieldByName(' HeatStatusID' ).AsInteger = 1 ) then
886
913
begin
887
914
lblConnectionStatus.Text :=
888
915
' INFO: Only '' OPEN'' heats can be modified.' ;
@@ -901,8 +928,6 @@ procedure TMarshall.PostFINAcode(ADisqualifyCodeID: integer);
901
928
EntrantID := bsEntrant.DataSet.FieldByName(' EntrantID' ).AsInteger;
902
929
rowsEffected := 0 ;
903
930
904
-
905
-
906
931
if (ADisqualifyCodeID > 0 ) then
907
932
begin
908
933
// "Simplified Disqualification Schema" :DEFAULT INIT
@@ -921,16 +946,21 @@ procedure TMarshall.PostFINAcode(ADisqualifyCodeID: integer);
921
946
SQL := ' UPDATE SwimClubMeet.dbo.Entrant SET' +
922
947
' [DisqualifyCodeID] = :ID1, [IsScratched] = :ID2,' +
923
948
' [IsDisqualified] = :ID3 WHERE [Entrant].EntrantID = :ID4;' ;
924
- rowsEffected := SCM.scmConnection.ExecSQL(SQL,
949
+ SCM.scmConnection.ExecSQL(SQL,
925
950
[ADisqualifyCodeID, IsScratched, IsDisqualified, EntrantID],
926
951
[ftInteger, ftBoolean, ftBoolean, ftInteger]);
927
952
953
+ // TFDConnection.ExecSQL does not directly return the @@ROWCOUNT value
954
+ // from SQL Server.
955
+ rowsEffected := SCM.scmConnection.ExecSQLScalar(' SELECT @@ROWCOUNT' );
956
+ //
957
+
928
958
end
929
959
else if (EventTypeID = 2 ) then // TEAM EVENT
930
960
begin
931
961
// team events not enabled ....
932
962
{
933
- SQL := 'UPDATE SwimClubMeet.dbo.Team SET' +
963
+ SQL := 'SET NOCOUNT OFF; UPDATE SwimClubMeet.dbo.Team SET' +
934
964
' [DisqualifyCodeID] = :ID1, [IsScratched] = :ID2,' +
935
965
' [IsDisqualified] = :ID3 WHERE [Team].TeamID = :ID4;';
936
966
SCM.scmConnection.ExecSQL(SQL, [ADisqualifyCodeID, IsScratched, IsDisqualified, fTeamID],
@@ -946,13 +976,14 @@ procedure TMarshall.PostFINAcode(ADisqualifyCodeID: integer);
946
976
SQL := ' UPDATE SwimClubMeet.dbo.Entrant SET' +
947
977
' [DisqualifyCodeID] = NULL, [IsScratched] = 0,' +
948
978
' [IsDisqualified] = 0 WHERE [Entrant].EntrantID = :ID4;' ;
949
- rowsEffected := SCM.scmConnection.ExecSQL(SQL, [EntrantID], [ftInteger]);
979
+ SCM.scmConnection.ExecSQL(SQL, [EntrantID], [ftInteger]);
980
+ rowsEffected := SCM.scmConnection.ExecSQLScalar(' SELECT @@ROWCOUNT' );
950
981
end
951
982
else if (EventTypeID = 2 ) then // TEAM EVENT
952
983
begin
953
984
// team events not enabled ....
954
985
{
955
- SQL := 'UPDATE SwimClubMeet.dbo.Team SET' +
986
+ SQL := 'SET NOCOUNT OFF; UPDATE SwimClubMeet.dbo.Team SET' +
956
987
' [DisqualifyCodeID] = NULL, [IsScratched] = 0,' +
957
988
' [IsDisqualified] = 0 WHERE [Team].TeamID = :ID4;';
958
989
SCM.scmConnection.ExecSQL(SQL, [fTeamID], [ftInteger]);
@@ -1212,6 +1243,24 @@ procedure TMarshall.Refresh_Entrant;
1212
1243
end ;
1213
1244
end ;
1214
1245
1246
+ procedure TMarshall.Refresh_Event ;
1247
+ var
1248
+ EventID: Integer;
1249
+ begin
1250
+ if (Assigned(SCM) and SCM.IsActive) then
1251
+ begin
1252
+ SCM.qryEvent.DisableControls;
1253
+ // SAFE: if dataset is empty or no swimmer assigned, EventID will equal zero.
1254
+ EventID := SCM.qryEvent.FieldByName(' EventID' ).AsInteger;
1255
+ // qryLane was trashed :: full requery required
1256
+ SCM.qryEvent.Close;
1257
+ SCM.qryEvent.Open;
1258
+ // SAFE: ZERO values.
1259
+ SCM.LocateEventID(EventID);
1260
+ SCM.qryEvent.EnableControls;
1261
+ end ;
1262
+ end ;
1263
+
1215
1264
procedure TMarshall.Refresh_BigButtons ();
1216
1265
var
1217
1266
QualifyStatus: Integer;
0 commit comments