|
|
|
|
unit lcxQxsz;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, bsSkinData, BusinessSkinForm, bsSkinCtrls, DB, ADODB,inifiles;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
TfrmLcxQxsz = class(TForm)
|
|
|
|
|
db_load: TADOConnection;
|
|
|
|
|
btnqxrestore: TbsSkinButton;
|
|
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
|
|
btnqxBack: TbsSkinButton;
|
|
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
|
|
bsStoredSkin1: TbsStoredSkin;
|
|
|
|
|
bsSkinData1: TbsSkinData;
|
|
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
|
|
chkseae: TbsSkinCheckRadioBox;
|
|
|
|
|
chkseaei: TbsSkinCheckRadioBox;
|
|
|
|
|
chkair: TbsSkinCheckRadioBox;
|
|
|
|
|
chkairi: TbsSkinCheckRadioBox;
|
|
|
|
|
qrytmp: TADOQuery;
|
|
|
|
|
qryUpdate: TADOQuery;
|
|
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure db_loadBeforeConnect(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
procedure btnqxBackClick(Sender: TObject);
|
|
|
|
|
procedure btnqxrestoreClick(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
function connect_string(file_name:string):string;
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frmLcxQxsz: TfrmLcxQxsz;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_sys_login;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure TfrmLcxQxsz.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
db_load.Connected:=true ;
|
|
|
|
|
frm_sys_login:=Tfrm_sys_login.create(self);
|
|
|
|
|
if frm_sys_login.showmodal=mrok then
|
|
|
|
|
begin
|
|
|
|
|
with qrytmp,sql do //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴλ<CFB4>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('select count(*)as cnt from t_sys_code_emp_back ');
|
|
|
|
|
open ;
|
|
|
|
|
btnqxrestore.Enabled:= fieldbyname('cnt').AsInteger>0 ;
|
|
|
|
|
btnqxBack.Enabled:= not btnqxrestore.Enabled ;
|
|
|
|
|
end;
|
|
|
|
|
end ;
|
|
|
|
|
frm_sys_login.free ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmLcxQxsz.db_loadBeforeConnect(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
db_load.ConnectionString:=connect_string('main.ini');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TfrmLcxQxsz.connect_string(file_name:string):string;
|
|
|
|
|
var
|
|
|
|
|
str:string;
|
|
|
|
|
inifile1:Tinifile;
|
|
|
|
|
begin
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+file_name);
|
|
|
|
|
str:='';
|
|
|
|
|
str:='Provider='+inifile1.ReadString('database','Provider','');
|
|
|
|
|
str:=str+'Password='+inifile1.ReadString('database','Password','');
|
|
|
|
|
str:=str+'Persist Security Info='+inifile1.ReadString('database','Persist Security Info','');
|
|
|
|
|
str:=str+'User ID='+inifile1.ReadString('database','User ID','');
|
|
|
|
|
str:=str+'Initial Catalog='+inifile1.ReadString('database','Initial Catalog','');
|
|
|
|
|
str:=str+'Data Source='+inifile1.ReadString('database','Data Source','');
|
|
|
|
|
result:=str;
|
|
|
|
|
inifile1.Free;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmLcxQxsz.bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmLcxQxsz.btnqxBackClick(Sender: TObject);
|
|
|
|
|
var str :string ;
|
|
|
|
|
begin
|
|
|
|
|
with qrytmp,sql do //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴλ<CFB4>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('select count(*)as cnt from t_sys_code_emp_back ');
|
|
|
|
|
open ;
|
|
|
|
|
if fieldbyname('cnt').AsInteger>0 then
|
|
|
|
|
begin
|
|
|
|
|
if Application.MessageBox('<27>ϴ<EFBFBD>ȡ<EFBFBD><C8A1>Ȩ<EFBFBD><C8A8>δ<EFBFBD><CEB4>ԭ<EFBFBD><D4AD><EFBFBD>Ƿǣ<F1B8B2B8>', '<27><>ʾ',
|
|
|
|
|
MB_ICONQUESTION + MB_YESNO + MB_DEFBUTTON2) <> IDYES then
|
|
|
|
|
Abort;
|
|
|
|
|
end ;
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
with qrytmp,sql do // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('delete from t_sys_code_emp_back ');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
with qrytmp,sql do ///<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|
|
|
|
begin
|
|
|
|
|
close ; clear ;
|
|
|
|
|
add('insert into t_sys_code_emp_back(Ȩ<><EFBFBD><DEB4><EFBFBD>, һ<><D2BB>ģ<EFBFBD><C4A3>, <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>,Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ա,<2C>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>,<2C><>Ȩ<EFBFBD><C8A8>, <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>,ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
|
|
|
|
|
add('select Ȩ<><EFBFBD><DEB4><EFBFBD>, һ<><D2BB>ģ<EFBFBD><C4A3>, <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>,Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ա,<2C>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>,<2C><>Ȩ<EFBFBD><C8A8>, <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>,'''+datetostr(date)+'''');
|
|
|
|
|
add('from t_sys_code_emp where (1=1)');
|
|
|
|
|
if chkseae.Checked then str:='(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'023'''+')or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'022'''+')' ;
|
|
|
|
|
if chkseaei.Checked then
|
|
|
|
|
begin
|
|
|
|
|
if str<>'' then str:=str+ 'or (Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'055'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'056'''+')'
|
|
|
|
|
else str:='(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'022'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'056'''+')' ;
|
|
|
|
|
end ;
|
|
|
|
|
if chkair.Checked then
|
|
|
|
|
begin
|
|
|
|
|
if str<>'' then str:=str+ 'or (Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'073'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'074'''+')'
|
|
|
|
|
else str:='(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'073'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'074'''+')' ;
|
|
|
|
|
end ;
|
|
|
|
|
if chkairi.Checked then
|
|
|
|
|
begin
|
|
|
|
|
if str<>'' then str:=str+ 'or (Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'081'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'082'''+')'
|
|
|
|
|
else str:='(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'081'''+')'+'or(Ȩ<><EFBFBD><DEB4><EFBFBD>='''+'082'''+')' ;
|
|
|
|
|
end ;
|
|
|
|
|
if str='' then exit else add('and ('+str+')');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
with qrytmp,sql do // Ȩ<><EFBFBD><DEBF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('update t_sys_code_emp set <20>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>=0 where (1=1) ');
|
|
|
|
|
if str='' then exit else add('and ('+str+')');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
with qrytmp,sql do
|
|
|
|
|
begin
|
|
|
|
|
close ; clear ;
|
|
|
|
|
add('update t_sys_parameters_value set <20><><EFBFBD><EFBFBD>ֵ='+''''+'TRUE'+'''');
|
|
|
|
|
add(' where VL_ID=109 ');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
showmessage('<27>ɹ<EFBFBD>ȡ<EFBFBD><C8A1>Ȩ<EFBFBD>ޣ<EFBFBD>');
|
|
|
|
|
btnqxrestore.Enabled:= true ;
|
|
|
|
|
btnqxBack.Enabled:= not btnqxrestore.Enabled ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmLcxQxsz.btnqxrestoreClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
with qrytmp,sql do //<2F><><EFBFBD>黹ԭ<E9BBB9><D4AD><EFBFBD><EFBFBD>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('select count(*)as cnt from t_sys_code_emp_back ');
|
|
|
|
|
open ;
|
|
|
|
|
if fieldbyname('cnt').AsInteger<=0 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD>ܻ<EFBFBD>ԭ<EFBFBD><D4AD>');
|
|
|
|
|
exit;
|
|
|
|
|
end ;
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
with qrytmp,sql do //<2F><EFBFBD>Ȩ<EFBFBD>ޱ<EFBFBD>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('select * from t_sys_code_emp_back');
|
|
|
|
|
open ; first ;
|
|
|
|
|
while not eof do
|
|
|
|
|
begin
|
|
|
|
|
qryUpdate.Close ;
|
|
|
|
|
qryUpdate.Parameters.ParamByName('mypermiss').Value:=fieldbyname('<27>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>').Value ;
|
|
|
|
|
qryUpdate.Parameters.ParamByName('myqxdm').Value:=fieldbyname('Ȩ<><EFBFBD><DEB4><EFBFBD>').Value ;
|
|
|
|
|
qryUpdate.Parameters.ParamByName('myuser').Value:=fieldbyname('<27><>Ա').Value ;
|
|
|
|
|
qryUpdate.ExecSQL ;
|
|
|
|
|
next ;
|
|
|
|
|
end ;
|
|
|
|
|
end ;
|
|
|
|
|
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>
|
|
|
|
|
with qrytmp,sql do // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|
|
|
|
begin
|
|
|
|
|
close ;clear ;
|
|
|
|
|
add('delete from t_sys_code_emp_back ');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
with qrytmp,sql do
|
|
|
|
|
begin
|
|
|
|
|
close ; clear ;
|
|
|
|
|
add('update t_sys_parameters_value set <20><><EFBFBD><EFBFBD>ֵ='+''''+'FALSE'+'''');
|
|
|
|
|
add(' where VL_ID=109 ');
|
|
|
|
|
execsql ;
|
|
|
|
|
end ;
|
|
|
|
|
showmessage('<27><>ԭ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>');
|
|
|
|
|
btnqxBack.Enabled:= true ;
|
|
|
|
|
btnqxrestore.Enabled:= not btnqxrestore.Enabled ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|