unit p_validate;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  IBCAdmin, StdCtrls, Buttons, RzBorder, RzButton, Abcutil, jpeg, Abcspla,
  EnJpgGr;

type
  Tf_validate = class(TForm)
    rrr: TIBCRestoreService;
    vvv: TIBCValidationService;
    bbb: TIBCBackupService;
    mmm: TIBCValidationService;
    Edit1: TEdit;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    Memo1: TMemo;
    od1: TOpenDialog;
    aaa: TIBCSecurityService;
    SpeedButton5: TSpeedButton;
    myl: TRzLEDDisplay;
    RzBitBtn1: TRzBitBtn;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure bbbError(E: Exception; var Fail: Boolean);
    procedure vvvError(E: Exception; var Fail: Boolean);
    procedure RzBitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure rrrError(E: Exception; var Fail: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_validate: Tf_validate;

implementation



{$R *.DFM}


procedure Tf_validate.SpeedButton1Click(Sender: TObject);
begin
if od1.Execute then
edit1.Text:=od1.FileName;
end;

procedure Tf_validate.SpeedButton2Click(Sender: TObject);
begin
//vvv.Params.Clear;
//vvv.Database.clear;
vvv.DATABASE:= edit1.Text;
vvv.Username:='dollysoft';
vvv.Password:='!@#$!$';

vvv.Attach;


vvv.ServiceStart;
  myl.Caption:='Validation Complete';
  While not vvv.Eof do
        Memo1.Lines.Add(vvv.GetNextLine);
vvv.Detach;




end;

procedure Tf_validate.SpeedButton3Click(Sender: TObject);
begin
try
deletefile('c:\mydolly1.bcp');

except
end;

try



Memo1.Lines.Clear;

bbb.Database:=edit1.Text;

bbb.Username:='dollysoft';
bbb.Password:='!@#$!$';



bbb.Attach;

bbb.ServiceStart;
  While not bbb.Eof do
        Memo1.Lines.Add(bbb.GetNextLine);
  myl.Caption:='Backup Complete';
SpeedButton4.Enabled:=true;
bbb.Detach;

except
end;

end;

procedure Tf_validate.SpeedButton4Click(Sender: TObject);
VAR I:INTEGER;
begin
I:=RANDOM(10);
Memo1.Lines.Clear;
try
copyfile(pchar(edit1.text),pchar('c:\'+INTTOSTR(I)+extractfilename(edit1.Text)),true);
except
end;
rrr.Params.Clear;
rrr.Database.Text:=edit1.Text;

rrr.Username:='dollysoft';
rrr.Password:='!@#$!$';


if FileExists('c:\mydolly1.bcp') <>True then exit;





rrr.Attach;

rrr.ServiceStart;

  While not rrr.Eof do
        Memo1.Lines.Add(rrr.GetNextLine);

rrr.Detach;
    myl.Caption:='Restore Complete';
 SpeedButton4.Enabled:=false;
end;

procedure Tf_validate.SpeedButton5Click(Sender: TObject);
begin
aaa.Username:='sysdba';
aaa.Password:='masterkey';
aaa.Attach;
//aaa.Password:='!@#$!$'  ;
try
aaa.UserInfo.Password:='!@#$!$'  ;
aaa.UserInfo.UserName:='dollysoft';
aaa.AddUser;
except





end;



aaa.Detach;



end;

procedure Tf_validate.bbbError(E: Exception; var Fail: Boolean);
begin
SpeedButton4.Enabled:=false;
end;

procedure Tf_validate.vvvError(E: Exception; var Fail: Boolean);
begin
//showmessage('Error to Connect To Database!!')
  myl.Caption:='Error to Validate!!';
end;

procedure Tf_validate.RzBitBtn1Click(Sender: TObject);
begin
close;
end;

procedure Tf_validate.FormCreate(Sender: TObject);
begin
edit1.text:=extractfilepath(application.ExeName)+ 'POSPREMIER.gdb' ;
end;

procedure Tf_validate.rrrError(E: Exception; var Fail: Boolean);
begin
  myl.Caption:='Error to Restore!';
end;

end.
