⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backupdata.~pas

📁 企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载 在线数据上传 在线业务申核 申报业务查询 磁盘数据导出 磁盘数据导入 在线业务模块 在线业务
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
  sqlstr:='select * from SBDU_PSWGCASE';
  FlatGauge1.Progress :=50;
  export_data(DataShare_frm.Query1,sqlstr,'SBDU_PSWGCASE','');

  {sqlstr:='select * from SBDU_PSWGCASE';
  FlatGauge1.Progress :=50;
  export_data(DataShare_frm.Query1,sqlstr,'SBDU_PSWGCASE',''); }

  sqlstr:='select * from SBDZ_HTARCH';
  FlatGauge1.Progress :=55;
  export_data(DataShare_frm.Query1,sqlstr,'SBDZ_HTARCH','');

  sqlstr:='select * from SBDZ_PSAGACCT';
  FlatGauge1.Progress :=60;
  export_data(DataShare_frm.Query1,sqlstr,'SBDZ_PSAGACCT','');

  sqlstr:='select * from SBDZ_PSPAUSE';
  FlatGauge1.Progress :=65;
  export_data(DataShare_frm.Query1,sqlstr,'SBDZ_PSPAUSE','');

  sqlstr:='select * from SBDZ_PSWGCASE';
  FlatGauge1.Progress :=70;
  export_data(DataShare_frm.Query1,sqlstr,'SBDZ_PSWGCASE','');

  sqlstr:='select * from SBDZ_RTACCT';
  FlatGauge1.Progress :=70;
  export_data(DataShare_frm.Query1,sqlstr,'SBDZ_RTACCT','');

  sqlstr:='select * from USERS';
  FlatGauge1.Progress :=75;
  export_data(DataShare_frm.Query1,sqlstr,'USERS','');

  sqlstr:='select * from  Account_Moving';
  FlatGauge1.Progress :=85;
  export_data(DataShare_frm.Query1,sqlstr,'Account_Moving','');

  sqlstr:='select * from  sbdz_InEsiis';
  export_data(DataShare_frm.Query1,sqlstr,'sbdz_InEsiis','');

  sqlstr:='select * from  sbdz_rtwage';
  export_data(DataShare_frm.Query1,sqlstr,'sbdz_rtwage','');

  FlatGauge1.Progress :=90;
  zip.ArchiveFile :=FE_filename.Text ;
  zip.Password :='esiis123';
  for loop:=1 to flatcombobox1.Items.Count-1 do
  zip.FileSpec.Add(flatcombobox1.Items[loop]);
  zip.Compress ;
  FlatGauge1.Progress :=95;
  deleteall(d+'exportfile\');
  delay(200);
  FlatGauge1.Progress :=100;
  FB_close.Caption :='完 成';
  except
    cursor:=crdefault;
    application.MessageBox('数据备份出现异常!','恩普软件',mb_iconerror+mb_ok);
    exit;
  end;
  cursor:=crdefault;
  application.MessageBox('数据备份完成!','恩普软件',mb_iconinformation+mb_ok); 
  P_backup.Visible :=false;
  {d:=copy(extractfilepath(application.ExeName),1,length(extractfilepath(application.ExeName))-1);
  if trim(FE_filename.Text)='' then
  begin
    application.MessageBox('请输入备份文件名!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
    FE_filename.SetFocus;
    exit;
  end;

  if fileexists(trim(FE_filename.Text)) then
  begin
    if Application.MessageBox('文件已经存在,是否要覆盖?','文件确认',MB_YESNO+MB_DEFBUTTON2+MB_IconQuestion+MB_SystemModal)=IDYES then
    begin
      deletefile(trim(FE_filename.Text));
    end else
      exit;
  end;

  registerTemp := TRegistry.Create;
  with registerTemp do
  begin
    RootKey:=HKEY_LOCAL_MACHINE;
    if OpenKey(pchar('\software\odbc\odbc.ini\esdd'),false) then
    begin
      ls_value:=ReadString('Start');
    end else
    begin
      application.MessageBox('程序版本未知,无法进行备份操作!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
      FB_fileselect.Enabled:=false;
      FB_backup.Enabled:=false;
      exit;
    end;
  end;
  registerTemp.Free;

  if pos('dbclient.exe',lowercase(ls_value))>0 then
  begin
    application.MessageBox('您安装的是客户端版本程序,无法进行备份操作!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
    FB_fileselect.Enabled:=false;
    FB_backup.Enabled:=false;
    exit;
  end;

  screen.Cursor :=crHourGlass;
  self.Cursor :=crHourGlass;
  panel1.Cursor :=crHourGlass;
  TabSheet1.Cursor :=crHourGlass;
  if pos('dbeng50.exe',lowercase(ls_value))>0 then
  begin
    try
      FB_backup.Enabled:=false;
      p_backup.Visible:=true;
      sleep(500);
      FlatGauge1.Progress:=5;
      SetCurrentDirectory(pchar(d+'\database'));
      datashare_frm.Dbs.Connected:=false;
      Session.CloseDatabase(Datashare_frm.Dbs);//必须把数据库关闭 
      FlatGauge1.Progress:=10;
      sleep(1000);
      FlatGauge1.Progress:=20;

      ls_file:='ESIIS.DB'+chr(13)+chr(10)+'ESIIS.LOG'+chr(13)+chr(10)+'ESIIS.MLG';
      password:=gf_password('ESIISBCK');
      XceedZipInitDLL;
      hZip := XzCreateXceedZipA( cLicenseString );
      XzSetXceedZipWindow( hZip, Self.Handle );
      XzSetZipFilenameA( hZip, PChar( FE_filename.Text ) );
      XzSetFilesToProcessA( hZip,pchar(ls_file));
      XzSetProcessSubfolders(HZip,0);
      XzSetEncryptionPasswordA(hzip, pchar('111'));
      sleep(500);
      FlatGauge1.Progress:=30;
      sleep(500);
      //self.Cursor :=crhourglass;
      //screen.Cursor :=crHourGlass;
      FlatGauge1.Progress:=40;
      //screen.Cursor :=crHourGlass;
      xResult := XzZip( hZip );
      FlatGauge1.Progress:=60;
      if XResult<>0 then
      begin
        XzDestroyXceedZip(hZip);
        XceedZipShutdownDLL;
        SetCurrentDirectory(pchar(d));
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据备份失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        FB_backup.Enabled:=true;
        p_backup.Visible:=false;
        self.Cursor :=crdefault;
        panel1.Cursor :=crdefault;
        TabSheet1.Cursor :=crdefault;
        screen.Cursor :=crdefault;
        exit;
      end;
      sleep(500);
      FlatGauge1.Progress:=65;
      XzDestroyXceedZip(hZip);
      XceedZipShutdownDLL;
      FlatGauge1.Progress:=70;

      sleep(500);
      FlatGauge1.Progress:=80;
      SetCurrentDirectory(pchar(d));
      datashare_frm.Dbs.Connected:=true;
      FlatGauge1.Progress:=90;
      sleep(1000);
      FlatGauge1.Progress:=100;
      sleep(500);
      application.MessageBox('数据备份成功!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
      FB_backup.Enabled:=true;
      p_backup.Visible:=false;
    except
      SetCurrentDirectory(pchar(d));
      datashare_frm.Dbs.Connected:=true;
      application.MessageBox('数据备份失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
      screen.Cursor :=crdefault;
      self.Cursor :=crdefault;
      panel1.Cursor :=crdefault;
      TabSheet1.Cursor :=crdefault;
      FB_backup.Enabled:=true;
      p_backup.Visible:=false;
    end;
  end else
  begin
    try
      FB_backup.Enabled:=false;
      p_backup.Visible:=true;
      sleep(500);
      FlatGauge1.Progress:=5;
      SetCurrentDirectory(pchar(d+'\database'));
      datashare_frm.Dbs.Connected:=false;
      if winexec('dbstop -s uid=dba;pwd=sql;agent=server;unconditional=true',SW_HIDE)<=31 then
      begin
        SetCurrentDirectory(pchar(d));
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据备份失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        FB_backup.Enabled:=true;
        p_backup.Visible:=false;
        screen.Cursor :=crdefault;
        self.Cursor :=crdefault;
        panel1.Cursor :=crdefault;
        TabSheet1.Cursor :=crdefault;
        exit;
      end;
      FlatGauge1.Progress:=10;
      sleep(1000);
      FlatGauge1.Progress:=20;
      sleep(2000);
      FlatGauge1.Progress:=30;
      sleep(2000);
      FlatGauge1.Progress:=40;

      ls_file:='ESIIS.DB'+chr(13)+chr(10)+'ESIIS.LOG'+chr(13)+chr(10)+'ESIIS.MLG';
      password:=gf_password('ESIISBCK');
      XceedZipInitDLL;
      hZip := XzCreateXceedZipA( cLicenseString );
      XzSetXceedZipWindow( hZip, Self.Handle );
      XzSetZipFilenameA( hZip, PChar( FE_filename.Text ) );
      XzSetFilesToProcessA( hZip,pchar(ls_file));
      XzSetProcessSubfolders(HZip,0);
      XzSetEncryptionPasswordA(hzip, pchar(password));
      xResult := XzZip( hZip );
      FlatGauge1.Progress:=60;
      if XResult<>0 then
      begin
        XzDestroyXceedZip(hZip);
        XceedZipShutdownDLL;
        SetCurrentDirectory(pchar(d));
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据备份失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        FB_backup.Enabled:=true;
        p_backup.Visible:=false;
        screen.Cursor :=crdefault;
        self.Cursor :=crdefault;
        panel1.Cursor :=crdefault;
        TabSheet1.Cursor :=crdefault;
        exit;
      end;
      sleep(500);
      FlatGauge1.Progress:=65;
      XzDestroyXceedZip(hZip);
      XceedZipShutdownDLL;
      FlatGauge1.Progress:=70;

      winexec('dbsrv50.exe -x TCPIP ESIIS.DB',SW_HIDE);
      sleep(2000);
      FlatGauge1.Progress:=75;
      sleep(2000);
      FlatGauge1.Progress:=80;
      sleep(2000);
      FlatGauge1.Progress:=85;
      sleep(2000);
      FlatGauge1.Progress:=90;
      sleep(2000);
      FlatGauge1.Progress:=95;
      sleep(2000);
      datashare_frm.Dbs.Connected:=true;
      FlatGauge1.Progress:=100;
      sleep(500);
      SetCurrentDirectory(pchar(d));
      application.MessageBox('数据备份成功!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
      FB_backup.Enabled:=true;
      p_backup.Visible:=false;
    except
      SetCurrentDirectory(pchar(d));
      //datashare_form.Dbs.Connected:=true;
      application.MessageBox('数据备份失败,请重新启动程序!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
      FB_backup.Enabled:=true;
      p_backup.Visible:=false;
      screen.Cursor :=crdefault;
      self.Cursor :=crdefault;
      panel1.Cursor :=crdefault;
      TabSheet1.Cursor :=crdefault;
    end;
  end;
  screen.Cursor :=crdefault;
  self.Cursor :=crdefault;
  panel1.Cursor :=crdefault;
  TabSheet1.Cursor :=crdefault;}
end;
procedure Tbackupdata_frm.FormActivate(Sender: TObject);
var
  registerTemp:TRegistry;
  ls_value:string;
begin
  inherited;
  registerTemp := TRegistry.Create;
  with registerTemp do
  begin
    RootKey:=HKEY_LOCAL_MACHINE;
    if OpenKey(pchar('\software\odbc\odbc.ini\esdd'),false) then
    begin
      ls_value:=ReadString('Start');
    end else
    begin
      application.MessageBox('程序版本未知,无法进行备份操作!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
      FB_fileselect.Enabled:=false;
      FB_backup.Enabled:=false;
      exit;
    end;
  end;
  registerTemp.Free;

  //if lowercase(ls_value)=lowercase(d+'\database\dbclient.exe -x tcpip') then
  if pos('dbclient.exe',lowercase(ls_value))>0 then
  begin
    application.MessageBox('您安装的是客户端版本程序,无法进行备份操作!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
    FB_fileselect.Enabled:=false;
    FB_backup.Enabled:=false;
    exit;
  end;
end;
{
procedure Tbackupdata_form.helpExecute(Sender: TObject);
begin
  inherited;
  if (HHCtrlHandle = 0) then
    application.MessageBox('帮助文件不存在!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal)
  else
    FHelpSystemHook.HelpContext(1080400);
end;  }



end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -