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

📄 daterestore.~pas

📁 这是用Delphi编写的车辆管理系统。主要功能有档案管理
💻 ~PAS
字号:
unit daterestore;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Backup, ComCtrls, ShellCtrls, ExtCtrls, Gauges, StdCtrls;

 
  type
      tpaintthread = class(TThread)
      protected
      procedure execute;override;
      end;


type
  Trestore = class(TdateBack)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Panel2Click(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
  private
   pt:Tpaintthread;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  restore: Trestore;

implementation
uses unit2;

{$R *.dfm}

procedure Tpaintthread.execute;
var i:integer;
begin
for i:=0 to 100 do
begin
restore.Gauge1.Progress:=restore.Gauge1.Progress+1;
sleep(50);
application.ProcessMessages;
end;
restore.Panel1.Enabled:=true;
restore.Panel1.Color:=clmoneygreen;
restore.Panel2.Enabled:=true;
restore.Panel2.Color:=clmoneygreen;
end;


procedure Trestore.FormCreate(Sender: TObject);
begin
pt:=tpaintthread.Create(true);
restore.Height:=205;
pathse:=true;
getdir(0,dir);
label1.Caption:=dir+'\bak';
end;

procedure Trestore.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 dateback.Height:=205;
 gauge1.Progress:=0;
 gauge1.Visible:=false;
 restore.Panel1.Enabled:=true;
 restore.Panel1.Color:=clmoneygreen;
 restore.Panel2.Enabled:=true;
 restore.Panel2.Color:=clmoneygreen;
 end;

procedure Trestore.Panel2Click(Sender: TObject);
begin
if pathse then
 begin
 restore.Height:=349;
 pathse:=false;
 panel2.Caption:='确认目录';
 end
 else
    begin
    restore.Height:=205;
    pathse:=true;
    panel2.Caption:='选择目录';
    end;
end;

procedure Trestore.Panel1Click(Sender: TObject);
var
  sr: TSearchRec;
 // FileAttrs: Integer;
begin
 restore.Enabled:=false;
 restore.Height:=205;
 panel2.Caption:='选择目录';
gauge1.Visible:=true;
panel1.Enabled:=false;
panel1.Color:=clwindow;
panel2.Enabled:=false;
panel2.Color:=clwindow;
try
begin
datamodule2.carclassQ.Close;
datamodule2.CardanganQ.Close;
//fileattrs:=faDirectory;
dir:=dir+'\data';
if FindFirst(pchar(label1.Caption+'\Carbaofei.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carbaofei.DBF'),pchar(dir+'\Carbaofei.DBF'),false)
   else showmessage('对不起再恢复目录中没有找到'+'Carbaofei.DBF');

if FindFirst(pchar(label1.Caption+'\Carclass.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carclass.DBF'),pchar(dir+'\carclass.DBF'),false)
   else showmessage('对不起再恢复目录中没有找到'+'carclass.DBF');

if FindFirst(pchar(label1.Caption+'\Cardangan.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Cardangan.DBF'),pchar(dir+'\Cardangan.DBF'),false)
   else showmessage('对不起再恢复目录中没有找到'+'Cardangan.DBF');

if FindFirst(pchar(label1.Caption+'\Cardriver.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Cardriver.DBF'),pchar(dir+'\Cardriver.DBF'),false)
    else showmessage('对不起再恢复目录中没有找到'+'Cardriver.DBF');

if FindFirst(pchar(label1.Caption+'\Carlingjian.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carlingjian.DBF'),pchar(dir+'\Carlingjian.DBF'),false)
    else showmessage('对不起再恢复目录中没有找到'+'Carlingjian.DBF');

if FindFirst(pchar(label1.Caption+'\Carshigu.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carshigu.DBF'),pchar(dir+'\Carshigu.DBF'),false)
     else showmessage('对不起再恢复目录中没有找到'+'Carshigu.DBF');

if FindFirst(pchar(label1.Caption+'\Carweixiu.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carweixiu.DBF'),pchar(dir+'\Carweixiu.DBF'),false)
     else showmessage('对不起再恢复目录中没有找到'+'Carweixiu.DBF');

if FindFirst(pchar(label1.Caption+'\Carweizhang.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Carweizhang.DBF'),pchar(dir+'\Carweizhang.DBF'),false)
     else showmessage('对不起再恢复目录中没有找到'+'Carweizhang.DBF');

if FindFirst(pchar(label1.Caption+'\Caryidong.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Caryidong.DBF'),pchar(dir+'\Caryidong.DBF'),false)
     else showmessage('对不起再恢复目录中没有找到'+'Caryidong.DBF');

if FindFirst(pchar(label1.Caption+'\Caryunying.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\Caryunying.DBF'),pchar(dir+'\Caryunying.DBF'),false)
      else showmessage('对不起再恢复目录中没有找到'+'Caryunying.DBF');

if FindFirst(pchar(label1.Caption+'\driverjf.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\driverjf.DBF'),pchar(dir+'\driverjf.DBF'),false)
       else showmessage('对不起再恢复目录中没有找到'+'driverjf.DBF');

if FindFirst(pchar(label1.Caption+'\users.DBF'),$37, sr) = 0 then
   copyfile(pchar(label1.Caption+'\users.DBF'),pchar(dir+'\users.DBF'),false)
    else showmessage('对不起再恢复目录中没有找到'+'users.DBF');
pt.execute;
  showmessage('恢复完毕!');
  restore.Enabled:=true;
end
except
showmessage('出错!请重新恢复!');
end;
panel1.Enabled:=true;
panel1.Color:=clmoneygreen;
panel2.Enabled:=true;
panel2.Color:=clmoneygreen;
restore.Close;
end;
end.

⌨️ 快捷键说明

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