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

📄 restoredata.~pas

📁 企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载 在线数据上传 在线业务申核 申报业务查询 磁盘数据导出 磁盘数据导入 在线业务模块 在线业务
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
 P_restore.Visible :=false; 
  {unzip.ArchiveFile :=fe_filename.Text ;
  unzip.ExtractDir :=d+'\importfile\';
  unzip.Password :='111';
  unzip.FileSpec.Add('*.*');
  unzip.Extract ;}
  {if Application.MessageBox('是否确认恢复?','文件确认',MB_YESNO+MB_DEFBUTTON2+MB_IconQuestion+MB_SystemModal)=IDNO then
    exit;
  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 not fileexists(trim(FE_filename.Text)) then
  begin
    application.MessageBox('指定的文件不存在!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
    FE_filename.SetFocus;
    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_restore.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_restore.Enabled:=false;
    exit;
  end;

  if pos('dbeng50.exe',lowercase(ls_value))>0 then
  begin
    try
      sleep(500);
      P_restore.Visible:=true;
      FlatGauge1.Progress:=5;
      FB_restore.Enabled:=false;

      //SetCurrentDirectory(pchar(d+'\importfile'));
      password:=gf_password('ESIISBCK');
      XceedZipInitDLL;                      //解压缩
      hUnZip:= XzCreateXceedZipA( cLicenseString );
      XzSetZipFilenameA( hUnZip,PChar(FE_filename.Text));
      XzSetProcessSubfolders( hUnZip, 0 );
      XzSetUnzipToFolderA( hUnZip, pchar('C:\qq'));
      XzSetEncryptionPasswordA(hUnzip, pchar('111'));
      if XzUnzip( hUnZip )<>0 then
      begin
        XzDestroyXceedZip( hUnZip );
        XceedZipShutdownDLL;
        application.MessageBox('数据恢复失败!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end;
      FlatGauge1.Progress:=10; 
      if (not fileexists(d+'\importfile\ESIIS.DB')) or (not fileexists(d+'\importfile\ESIIS.LOG')) or (not fileexists(d+'\importfile\ESIIS.MLG')) then
      begin
        application.MessageBox('不是合法的数据备份文件!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        DelRestoreFile;
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end else
      begin
        DelRestoreFile;
      end;

      datashare_frm.Dbs.Connected:=false;
      session.CloseDatabase(datashare_frm.Dbs); 
      sleep(500);
      FlatGauge1.Progress:=15;
      sleep(500);
      FlatGauge1.Progress:=25;
      sleep(1000);
      FlatGauge1.Progress:=35;
      sleep(1000);
      FlatGauge1.Progress:=45;

      XzSetUnzipToFolderA( hUnZip, pchar(d+'\database'));
      //XzSetEncryptionPasswordA(hUnzip, pchar(password));
      if XzUnzip( hUnZip )<>0 then
      begin
        XzDestroyXceedZip( hUnZip );
        XceedZipShutdownDLL;
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据恢复失败!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end;
      FlatGauge1.Progress:=65;
      XzDestroyXceedZip( hUnZip );
      XceedZipShutdownDLL;
      FlatGauge1.Progress:=70;

      sleep(1000);
      FlatGauge1.Progress:=80;
      datashare_frm.Dbs.Connected:=true;
      FlatGauge1.Progress:=90;
      sleep(1000);
      FlatGauge1.Progress:=100;
      sleep(500);
      application.MessageBox('数据恢复成功!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
      FB_restore.Enabled:=true;
      P_restore.Visible:=false;
    except
      //datashare_form.Dbs.Connected:=true;
      application.MessageBox('数据恢复失败,请重新启动程序!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
      FB_restore.Enabled:=true;
      P_restore.Visible:=false;
    end;
  end else
  begin
    try
      sleep(500);
      P_restore.Visible:=true;
      FlatGauge1.Progress:=5;
      FB_restore.Enabled:=false;

      password:=gf_password('ESIISBCK');
      XceedZipInitDLL;                      //解压缩
      hUnZip:= XzCreateXceedZipA( cLicenseString );
      XzSetZipFilenameA( hUnZip,PChar(FE_filename.Text));
      XzSetProcessSubfolders( hUnZip, 0 );
      XzSetUnzipToFolderA( hUnZip, pchar(d+'\importfile'));
      XzSetEncryptionPasswordA(hUnzip, pchar(password));
      if XzUnzip( hUnZip )<>0 then
      begin
        XzDestroyXceedZip( hUnZip );
        XceedZipShutdownDLL;
        application.MessageBox('数据恢复失败!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end;
      FlatGauge1.Progress:=10;
      if (not fileexists(d+'\importfile\ESIIS.DB')) or (not fileexists(d+'\importfile\ESIIS.LOG')) or (not fileexists(d+'\importfile\ESIIS.MLG')) then
      begin
        application.MessageBox('不是合法的数据备份文件!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        DelRestoreFile;
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end else
      begin
        DelRestoreFile;
      end;

      datashare_frm.Dbs.Connected:=false;
      sleep(2000);
      FlatGauge1.Progress:=15;
      sleep(2000);
      FlatGauge1.Progress:=25;
      SetCurrentDirectory(pchar(d+'\database'));
      if winexec('dbstop -s uid=dba;pwd=sql;agent=server;unconditional=true',SW_HIDE)<=31 then
      begin
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据恢复失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        SetCurrentDirectory(pchar(d));
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end;
      sleep(2000);
      FlatGauge1.Progress:=30;
      sleep(2000);
      FlatGauge1.Progress:=35;
      sleep(2000);
      FlatGauge1.Progress:=40;

      XzSetUnzipToFolderA( hUnZip, pchar(d+'\database'));
      //XzSetEncryptionPasswordA(hUnzip, pchar(password));
      if XzUnzip( hUnZip )<>0 then
      begin
        XzDestroyXceedZip( hUnZip );
        XceedZipShutdownDLL;
        winexec('dbsrv50.exe -x TCPIP ESIIS.DB',SW_HIDE);
        sleep(10000);
        datashare_frm.Dbs.Connected:=true;
        application.MessageBox('数据恢复失败!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        SetCurrentDirectory(pchar(d));
        FB_restore.Enabled:=true;
        P_restore.Visible:=false;
        exit;
      end;
      FlatGauge1.Progress:=50;
      XzDestroyXceedZip( hUnZip );
      XceedZipShutdownDLL;
      sleep(1000);
      FlatGauge1.Progress:=55;

      winexec('dbsrv50.exe -x TCPIP ESIIS.DB',SW_HIDE);
      sleep(2000);
      FlatGauge1.Progress:=65;
      sleep(2000);
      FlatGauge1.Progress:=70;
      sleep(2000);
      FlatGauge1.Progress:=75;
      sleep(2000);
      FlatGauge1.Progress:=80;
      sleep(2000);
      FlatGauge1.Progress:=85;
      sleep(1000);
      FlatGauge1.Progress:=90;
      sleep(1000);
      FlatGauge1.Progress:=95;
      sleep(1000);
      datashare_frm.Dbs.Connected:=true;
      FlatGauge1.Progress:=100;
      sleep(500);
      application.MessageBox('数据恢复成功!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
      SetCurrentDirectory(pchar(d));
      FB_restore.Enabled:=true;
      P_restore.Visible:=false;
    except
      //datashare_form.Dbs.Connected:=true;
      application.MessageBox('数据恢复失败,请重新启动程序!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
      SetCurrentDirectory(pchar(d));
      FB_restore.Enabled:=true;
      P_restore.Visible:=false;
    end;
  end; }
end;

procedure Trestoredata_frm.FB_fileselectClick(Sender: TObject);
begin
  inherited;
  OpenDialog1.Filter := '压缩文件(*.zip)|*.zip|所有文件(*.*)|*.*';
  if OpenDialog1.Execute then
    FE_filename.Text:=OpenDialog1.FileName;
end;

procedure Trestoredata_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_restore.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_restore.Enabled:=false;
    exit;
  end; }
end;
 {
procedure Trestoredata_frm.helpExecute(Sender: TObject);
begin
  inherited;
  if (HHCtrlHandle = 0) then
    application.MessageBox('帮助文件不存在!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal)
  else
    FHelpSystemHook.HelpContext(1080500);
end;   }

end.

⌨️ 快捷键说明

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