unit ServerMethodsUnit1;
interface
uses System.SysUtils, System.Classes, System.Json,
Datasnap.DSServer, Datasnap.DSAuth;
type
{$METHODINFO ON}
TServerMethods1 = class(TDataModule)
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
function EchoString(Value: string): string;
function ReverseString(Value: string): string;
function GetTerminArt(action: string; jObject: TJSONObject): TJSONObject;overload;
end;
{$METHODINFO OFF}
implementation
{$R *.dfm}
uses System.StrUtils;
function TServerMethods1.EchoString(Value: string): string;
begin
Result := Value;
end;
function TServerMethods1.GetTerminArt(action: string; jObject: TJSONObject): TJSONObject;
var
vJSONObject: TJSONObject;
ls_id, ls_terminart : string;
begin
if Assigned(jObject.Get('id')) then begin
ls_id := jObject.Get('id').JsonValue.Value ;
end;
ls_terminart:='[{"id":"1","title":"Termine","description":"","color":"4"},'+
' {"id":"2","title":"Urlaub","description":"","color":"12"},'+
' {"id":"3","title":"Krankheit","description":"","color":"3"},'+
' {"id":"4","title":"Geburtstage","description":"","color":"20"}]';
vJSONObject:=TJSONObject.Create;
vJSONObject.AddPair('success',TJSONTrue.Create);
vJSONObject.AddPair('data',ls_terminart);
Result:=vJSONObject;
end;