|
发表于 2007-10-30 10:03:49
|
显示全部楼层
//跟delphi里边的方法不一样
procedure TEMPLOYEEMANAGEFORM.DataNavigatorBeforeAction(Sender: TObject; var Accept: Boolean);
var
lquery:TQuery;
begin
case TBizDataSetAction(Sender).ID of
BizActnConsts.ActionDataSetAppend,
BizActnConsts.ActionDataSetInsert:
begin
if GraphicTab.Index= 0 then
begin
GraphicTab.Index := 1;
Accept := true;
with InfoBroker.Info.DataSetByID('Employee') do
begin
Append;
if DEPTTreeView.Selected.Text <>'' then
Fieldbyname('FDEPTID').AsString:= InfoBroker.Info.DataSetByID('DEPT').FieldByName('FID').AsString ;
end;
end;
end;
BizActnConsts.ActionDataSetDelete:
begin
if (GraphicTab.Index = 0) or (GraphicTab.Index =1) then
begin
if jsdialogs.ConfirmBox('当前只能禁用,不允许删除人员。您真的要禁用么?','禁用提示',1)= true then
begin
try
lquery := TQuery.Create(self);
lquery.Connection := InfoBroker.Info.DataSetByID('Employee').Connection;
lquery.CommandText:=' Update TPerson set FDELETELEVEL= 1 ,FEmployState = '+sysutils.QuotedStr('已删除')+' where FGUID ='
+ sysutils.QuotedStr(InfoBroker.Info.DataSetByID('Employee').FieldByName('FGUID').AsString) ;
lquery.Execute;
finally
InfoBroker.Info.DataSetByID('Employee').Refresh;
end;
end
else begin
Accept:= false;
sysutils.Abort;
end;
end
else begin
if jsdialogs.ConfirmBox('您真的要删除当前记录么?','删除提示',1)= true then
accept:= true
else Accept:= false;
end;
end;
end;
end;
==========================
procedure TEMPLOYEEMANAGEFORM.DataNavigatorAfterAction(Sender: TObject);
begin
case TBizDataSetAction(Sender).ID of
BizActnConsts.ActionDataSetDelete:
begin
InfoBroker.Info.DataSetByID('Employee').CancelUpdates;
(BizToolBar1.ToolBarModule as TEMPLOYEEMANAGEFILTER).Rebuild;
end;
end;
// InfoBroker.Info.DataSetByID('Employee').Refresh;
end; |
|