Index: AAPClient/WS/Agent.pas =================================================================== diff -u -r191 -r192 --- AAPClient/WS/Agent.pas (.../Agent.pas) (revision 191) +++ AAPClient/WS/Agent.pas (.../Agent.pas) (revision 192) @@ -3,26 +3,34 @@ interface uses - DnaCodeService, GebruikerService, System.SysUtils; + DnaCodeService, GebruikerService, System.SysUtils, Vcl.Forms, UiContext; type TAgent = class private + fUiContext: TUiContext; function ComputerName: String; function WUserName: String; public + Constructor Create(UiContext: TUiContext); overload; function FullName: String; function GebruikerAanmelden(Initialen: string; LoginCode: string): GebruikerAanmeldenResponse; - function GebruikerAfmelden(Initialen: string; LoginCode: string): boolean; + function GebruikerAfmelden(): boolean; + function ValideerPalletCode(PalletCode: string): ValideerPalletCodeResponse; end; implementation uses - Winapi.Windows; + Winapi.Windows, ProScanMain; { TAgent } +constructor TAgent.Create(UiContext: TUiContext); +begin + fUiContext := UiContext; +end; + function TAgent.GebruikerAanmelden(Initialen, LoginCode: string): GebruikerAanmeldenResponse; var @@ -47,7 +55,7 @@ end; end; -function TAgent.GebruikerAfmelden(Initialen, LoginCode: string): boolean; +function TAgent.GebruikerAfmelden(): boolean; var Service: GebruikerServiceSoap; Request: GebruikerAfmeldenRequest; @@ -58,9 +66,9 @@ Request := GebruikerAfmeldenRequest.Create; Header := RequestHeader.Create; try - Request.Initialen := Initialen; - Request.LoginCode := LoginCode; - Header.Initialen := Initialen; + Request.Initialen := fUiContext.Initialen; + Request.LoginCode := fUiContext.LoginCode; + Header.Initialen := fUiContext.Initialen; Request.Header := Header; Service.GebruikerAfmelden(Request); @@ -70,6 +78,29 @@ end; end; +function TAgent.ValideerPalletCode(PalletCode: string): ValideerPalletCodeResponse; +var + Service: DnaCodeServiceSoap; + Request: ValideerPalletCodeRequest; + Header: DnaCodeService.RequestHeader; +begin + Service := DnaCodeService.GetDnaCodeServiceSoap(); + + Request := ValideerPalletCodeRequest.Create; + Header := DnaCodeService.RequestHeader.Create; + try + Header.Initialen := fUiContext.Initialen; + Header.ComputerNaam := FullName(); + Request.Header := Header; + Request.PalletCode := PalletCode; + + result := Service.ValideerPalletCode(Request); + finally + Request.Free; + end; + +end; + function TAgent.ComputerName: String; var buffer: array[0..255] of char;