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
|
procedure TForm1.dsAfterInsert(DataSet: TDataSet);
Begin
insertiondansliste := True;
End;
procedure TForm1.dsAfterPost(DataSet: TDataSet);
var
i : integer;
bool : Boolean;
begin
if insertiondansliste then begin
NbItemsDansMaliste := NbItemsDansMaliste + 1;
insertiondansliste := False;
end;
bool:= False;
for i := 0 to NbItemsDansMaliste - 1 do begin
if ( Copy(Maliste.Items.Strings[i],0,10) = dsCode.Value ) then begin
bool := True;
break;
end;
end;
if ( bool = False ) then
i := NbItemsDansMaliste - 1;
Maliste.Items.Strings[i] := dsCode.Value;
if ( Maliste.Items.Strings[i] = 'toto' ) or
( Maliste.Items.Strings[i]= 'tata' ) then
isCodeSpecifique := true;
end;
procedure TForm1.dsBeforeDelete(DataSet: TDataSet);
var
i : integer;
bool : boolean;
Begin
bool := false;
for i := 0 to NbItemsDansMaliste - 1 do begin
if ( copy(Maliste.Items.Strings[i],0,10) = dsCode.Value ) then begin
if ( Maliste.Items.Strings[i] = 'toto' ) or
( Maliste.Items.Strings[i]= 'tata' ) then
isCodeSpecifique := False;
bool := true;
break;
end;
end;
{...}
End; |