|

楼主 |
发表于 2009-12-8 10:47:52
|
显示全部楼层
procedure TBZZLXX.DataGrid1DblClick(Sender: TObject);
var
Str : String;
begin
if DataSetBroker1.DataSet.IsEmpty then
begin
dialogs.ShowMessage('没有记录, 不能修改!');
exit;
end;
Str:=DataSetBroker1.DataSet.FieldByName('ZLBS').AsString;
if not Assigned(lForm) then
lForm := TZJ.Create(self.Context);
try
lForm.Caption := '修改';
lForm.ty:='修改';
if not((cPositionMemberName='标准管理员') and (cDeptName='总工办')) then
begin
lForm.Caption := '查看';
lForm.ty:='查看';
DataSetState(False); //设置数据集的Enabled
lForm.DataSetBroker1.DataSet.ReadOnly:=True;
lForm.DataSetBroker2.DataSet.ReadOnly:=True;
lForm.DataSetBroker4.DataSet.ReadOnly:=True;
lForm.DataSetBroker5.DataSet.ReadOnly:=True;
lForm.DB_SYSRK.DataSet.ReadOnly:=True;
lForm.Db_Fees.DataSet.ReadOnly:=True;
lForm.DataNavigator3.Visible:=False; //替换标准信息
lForm.TB_SaveAndAdd.Visible:=False; //携带新增
lForm.TB_Save.Visible:=False; //保存数据
lForm.TB_SaveAndClose.Visible:=False; //保存返回
lForm.ToolButton2.Visible:=False;
lForm.Btn_add.Visible:=False;
lForm.Btn_Del.Visible:=False;
lForm.BitBtn1.Visible:=False;
end;
lForm.ShowModal;
Finally
lForm.Close;
DataSetState(True);
if (DataSetBroker1.DataSet.RecordCount<>0) and
(DataSetBroker1.DataSet.State in [TdataSetState.dsInsert,TdataSetState.dsEdit]) then
begin
DataSetBroker1.DataSet.ApplyUpdates;
DataSetBroker1.DataSet.Refresh;
end;
DataSetBroker1.DataSet.Locate('ZLBS', Str,
[TLocateOption.loCaseInsensitive, TLocateOption.loPartialKey]);
end;
if DataSetBroker1.DataSet.RecordCount<>0 then
DataGrid1.FocusedNode.Selected:=True;
end;
代码如上 |
|