procedure TKas_Server.DoRun;
Var
XML_Server : Txml_kas_server;
begin
FIsDebugFile:=True;
Recon:=False;
ShortDateFormat:='
dd.mm.yyyy';
DateSeparator:='
.';
TimeSeparator:='
:';
DecimalSeparator:='
,';
ShowStatus('
KAS Server V1.2','
');
ShowStatus('
PLUGINS Start','
');
XML_Server:=Txml_kas_server.Create;
XML_Server.DBServer:=FServerClass.DBServer;
XML_Server.DBUserName:=FServerClass.DBUserName;
XML_Server.DBPassword:=FServerClass.DBPassword;
XML_Server.DBDatabase:=FServerClass.DBDatabase;
XML_Server.DebugLevel:=FServerClass.DebugLevel;
XML_Server.OnStatus:=ShowStatus;
XML_Server.UpdTable;
XML_Server.StartDay;
XML_Server.Free;
Run:=True;
ShowStatus('
RUN','
');
While Run
do
Begin
try
If IDatum<>Date
then //Tages Wechsel
Begin
ShowStatus('
Tages Start');
IDatum:=Date;
If (AktMonat<>StrToInt(FormatDateTime('
mm',Date)))
Then
Begin
AktJahr:=StrToInt(FormatDateTime('
yyyy',Date));
AktMonat:=StrToInt(FormatDateTime('
mm',Date));
End;
Try
XML_Server:=Txml_kas_server.Create;
XML_Server.DBServer:=FServerClass.DBServer;
XML_Server.DBUserName:=FServerClass.DBUserName;
XML_Server.DBPassword:=FServerClass.DBPassword;
XML_Server.DBDatabase:=FServerClass.DBDatabase;
XML_Server.DebugLevel:=FServerClass.DebugLevel;
XML_Server.OnStatus:=ShowStatus;
XML_Server.UpdTable;
XML_Server.StartDay;
XML_Server.Free;
Finally
End;
End;
Sleep(500);
If Not Recon
then
Begin
FServerClass.Reconnect;
Recon:=True;
End;
except
on E:
Exception do
Begin
ShowStatus(E.
Message);
End;
End;
End;
// stop program loop
Run:=False;
end;
procedure Tkas_service.ServiceExecute(Sender: TService);
begin
KAS_Server1.ShowStatus('
Service Run');
KAS_Server1.DoRun;
end;
procedure Tkas_service.ServiceStart(Sender: TService;
var Started: Boolean);
begin
kas_server1:=TKas_Server.Create;
KAS_Server1.FIsDebugFile:=True;
KAS_Server1.ShowStatus('
Service Start');
Started:=True;
end;
procedure Tkas_service.ServiceStop(Sender: TService;
var Stopped: Boolean);
begin
KAS_Server1.ShowStatus('
Service Stop');
KAS_Server1.Run:=False;
kas_server1.Free;
Stopped := True;
end;