起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 136|回复: 2

【结贴】有关于DataNavigator的问题 急等**

[复制链接]
发表于 2007-10-30 09:44:58 | 显示全部楼层 |阅读模式
请问DataNavigator控件中的新增按钮对应的哪个事件,我能接管覆写它吗
回复

使用道具 举报

发表于 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;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-10-30 10:15:53 | 显示全部楼层
问题已搞定 Thanks!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-6-29 11:45 , Processed in 0.041448 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表