266 lines
6.2 KiB
ObjectPascal
266 lines
6.2 KiB
ObjectPascal
unit U_SetBanZu;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, ComCtrls, ToolWin,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||
cxClasses, cxControls, cxGridCustomView, cxGrid, ADODB, StdCtrls,
|
||
ExtCtrls, DBClient;
|
||
|
||
type
|
||
TfrmSetBanZu = class(TForm)
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
ADOQueryMain: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
CDS_Main: TClientDataSet;
|
||
Button3: TButton;
|
||
Button4: TButton;
|
||
Button5: TButton;
|
||
Button6: TButton;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
BanZu: TComboBox;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure ToolButton12Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure Button4Click(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmSetBanZu: TfrmSetBanZu;
|
||
|
||
implementation
|
||
Uses
|
||
U_DataLink,U_Fun,U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmSetBanZu.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmSetBanZu:=nil;
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.FormShow(Sender: TObject);
|
||
begin
|
||
|
||
//DataLink_WFBProducttion.ADOLink.Connected:=True;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from SY_User where UserId not in(''ADMIN'',''CS01'')');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.ToolButton2Click(Sender: TObject);
|
||
var
|
||
fsj,FUserId:String;
|
||
begin
|
||
{FUserId:=Trim(CDS_Main.fieldbyname('UserId').AsString);
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
CDS_Main.Locate('UserId',Trim(FUserId),[]);
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
CDS_Main.Locate('UserId',Trim(FUserId),[]);
|
||
Panel1.Visible:=True;
|
||
fsj:='select Name=ZdyName from KH_Zdy where Type=''WFBBZ'' ';
|
||
|
||
SInitComBoxBySql(ADOQueryTemp,BanZu,False,fsj); }
|
||
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button2Click(Sender: TObject);
|
||
begin
|
||
BanZu.Visible:=False;
|
||
Button1.Visible:=False;
|
||
Button2.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.ToolButton12Click(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button1Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_Main.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if CDS_Main.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('UPdate SY_User Set BanZu='''+Trim(BanZu.Text)+'''');
|
||
sql.Add(' where UserId='''+Trim(CDS_Main.fieldbyname('UserId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_Main.Edit;
|
||
FieldByName('BanZu').Value:=Trim(BanZu.Text);
|
||
//CDS_Main.Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
BanZu.Visible:=False;
|
||
Button1.Visible:=False;
|
||
Button2.Visible:=False;
|
||
Application.MessageBox('<27><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.ToolButton6Click(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
fsj:=Trim(CDS_Main.fieldbyname('UserId').AsString);
|
||
CDS_Main.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
CDS_Main.Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
CDS_Main.Locate('UserId',fsj,[]);
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='WFBBZ';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button4Click(Sender: TObject);
|
||
var
|
||
fsj,FUserId:String;
|
||
begin
|
||
FUserId:=Trim(CDS_Main.fieldbyname('UserId').AsString);
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
CDS_Main.Locate('UserId',Trim(FUserId),[]);
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
CDS_Main.Locate('UserId',Trim(FUserId),[]);
|
||
BanZu.Visible:=True;
|
||
Button1.Visible:=True;
|
||
Button2.Visible:=True;
|
||
fsj:='select Name=ZdyName from KH_Zdy where Type=''WFBBZ'' ';
|
||
|
||
SInitComBoxBySql(ADOQueryTemp,BanZu,False,fsj);
|
||
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button5Click(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
fsj:=Trim(CDS_Main.fieldbyname('UserId').AsString);
|
||
CDS_Main.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
CDS_Main.Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
CDS_Main.Locate('UserId',fsj,[]);
|
||
end;
|
||
|
||
procedure TfrmSetBanZu.Button6Click(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
end.
|