Index: VerpakkingsDefinitie/ApplicationContext.pas =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 555) +++ VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 556) @@ -14,7 +14,7 @@ // - UserServerService type - TUserServerServiceContext = class(TSubject) + TUserContext = class(TSubject) private FSessionKey: string; FGebruikersNaam: string; @@ -23,34 +23,59 @@ FErrorMessage: string; FInternalErrorMessage: string; public - procedure Changed(); + procedure NotifyChanged(); property SessionKey: string read FSessionKey write FSessionKey; property GebruikersNaam: string read FGebruikersNaam write FGebruikersNaam; property IsOK: Boolean read FIsOK write FIsOK; property ErrorMessage: string read FErrorMessage write FErrorMessage; property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; end; + TProductsContext = class(TSubject) + private + FSessionKey: string; + FDataSet: TObject; + + FIsOK: Boolean; + FErrorMessage: string; + FInternalErrorMessage: string; + public + procedure NotifyChanged(); + property DataSet: TObject read FDataSet write FDataSet; + + property IsOK: Boolean read FIsOK write FIsOK; + property ErrorMessage: string read FErrorMessage write FErrorMessage; + property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; + end; + // APPLICATION CONTEXT // Application context bevat alle sub-contexts TApplicationContext = class private - FUserServerServiceContext: TUserServerServiceContext; + FUserContext: TUserContext; + FProductsContext: TProductsContext; public constructor Create(); - property UserServerServiceContext: TUserServerServiceContext read FUserServerServiceContext write FUserServerServiceContext; + property UserContext: TUserContext read FUserContext write FUserContext; + property ProductsContext: TProductsContext read FProductsContext write FProductsContext; end; implementation -procedure TUserServerServiceContext.Changed(); +procedure TUserContext.NotifyChanged(); begin self.Change(); end; +procedure TProductsContext.NotifyChanged(); +begin + self.Change(); +end; + constructor TApplicationContext.Create(); begin - FUserServerServiceContext := TUserServerServiceContext.Create(); + FUserContext := TUserContext.Create(); + FProductsContext := TProductsContext.Create(); end; end. Index: VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm (.../ZoekProductenScherm.dfm) (revision 555) +++ VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm (.../ZoekProductenScherm.dfm) (revision 556) @@ -54,6 +54,7 @@ Width = 289 Height = 21 TabOrder = 0 + OnChange = EditZoekChange end object ComboBoxAt: TComboBox Left = 56 @@ -83,34 +84,18 @@ object TabSheetIdentificatieNr: TTabSheet Caption = 'Identificatie nr' ImageIndex = 1 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 end object TabSheetLeveranciersRef: TTabSheet Caption = 'Leveranciers ref' ImageIndex = 2 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 end object TabSheetTekst: TTabSheet Caption = 'Tekst' ImageIndex = 3 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 end object TabSheetProductboom: TTabSheet Caption = 'Productboom' ImageIndex = 4 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 end end end Index: VerpakkingsDefinitie/UI/ZoekProductenScherm.pas =================================================================== diff -u -r550 -r556 --- VerpakkingsDefinitie/UI/ZoekProductenScherm.pas (.../ZoekProductenScherm.pas) (revision 550) +++ VerpakkingsDefinitie/UI/ZoekProductenScherm.pas (.../ZoekProductenScherm.pas) (revision 556) @@ -7,7 +7,8 @@ System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, - Subscherm; + Subscherm, Main, + ApplicationContext, ProductAgent; type TFormZoekProducten = class(TFormSubscherm) @@ -25,18 +26,36 @@ ButtonZoekViaKortTekst: TButton; procedure FormCreate(Sender: TObject); procedure ButtonZoekViaKortTekstClick(Sender: TObject); + procedure EditZoekChange(Sender: TObject); private - { Private declarations } + FProductAgent: TProductAgent; public - { Public declarations } + Constructor Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; + ProductAgent: TProductAgent); end; implementation {$R *.dfm} +constructor TFormZoekProducten.Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; + ProductAgent: TProductAgent); +begin + inherited Create(AOwner, Navigator, ApplicationContext); + self.FProductAgent := ProductAgent; + + ButtonZoekViaKortTekst.Enabled := false; +end; + +procedure TFormZoekProducten.EditZoekChange(Sender: TObject); +begin + // Opzoeken met lege tekst geeft problemen + ButtonZoekViaKortTekst.Enabled := (Sender as TEdit).Text <> EmptyStr; +end; + procedure TFormZoekProducten.FormCreate(Sender: TObject); begin + // COMBOBOXAT INSTELLEN ComboBoxAt.Style := csDropDownList; // Typen in combobox uitzetten // Waarden toevoegen aan combobox ComboBoxAt.AddItem('K', nil); @@ -47,8 +66,27 @@ end; procedure TFormZoekProducten.ButtonZoekViaKortTekstClick(Sender: TObject); +var + ErrorMessage: string; begin - // TODO Zoeken + FProductAgent.ZoekOpMetKortTekst(EditZoek.Text, EditKlantNr.Text, ComboBoxAt.Text, self.ApplicationContext.UserContext, + self.ApplicationContext.ProductsContext); + + if ApplicationContext.ProductsContext.IsOK then + begin + (self.Navigator as TFormMain).NavigeerNaar(Main.NAVZOEKPRODUCTEN); + end + else + begin + // Opzoeking gefaald + ErrorMessage := ApplicationContext.ProductsContext.ErrorMessage; + if ApplicationContext.ProductsContext.InternalErrorMessage <> '' then + begin + ErrorMessage := ErrorMessage + sLineBreak + ApplicationContext.ProductsContext.InternalErrorMessage; + end; + + MessageDlg(ErrorMessage, TMsgDlgType.mtInformation, [mbOK], 0, mbCancel) + end; end; end. Index: VerpakkingsDefinitie/Main.pas =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/Main.pas (.../Main.pas) (revision 555) +++ VerpakkingsDefinitie/Main.pas (.../Main.pas) (revision 556) @@ -1,12 +1,13 @@ unit Main; interface - { TODO -cnavigatie : NavigeerNaar in interface zetten ter abstractie voor subschermen } + +{ TODO -cnavigatie : NavigeerNaar in interface zetten ter abstractie voor subschermen } uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, - ApplicationContext, Agent, Vcl.StdCtrls; + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, + ApplicationContext, UserAgent, ProductAgent; const NAVHOME = 0; @@ -20,7 +21,8 @@ procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); private FAppContext: TApplicationContext; - FAgent: TAgent; + FUserAgent: TUserAgent; + FProductAgent: TProductAgent; procedure FreeControlChildrenRec(AControl: TControl); procedure ConfigureerLayoutGridPanel(GridPanel: TGridPanel); procedure PlaatsControlOpGrid(GridPanel: TGridPanel; Control: TControl; RowI: Integer; ColI: Integer; RowSpan: Integer = 1; @@ -42,13 +44,14 @@ // Dit event wordt altijd aangeroepen, OnClose niet procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin - FAgent.GebruikerAfmelden(FAppContext.UserServerServiceContext); // Antwoord wordt genegeerd + FUserAgent.GebruikerAfmelden(FAppContext.UserContext); // Antwoord wordt genegeerd end; procedure TFormMain.FormCreate(Sender: TObject); begin FAppContext := TApplicationContext.Create(); - FAgent := TAgent.Create(); + FUserAgent := TUserAgent.Create(); + FProductAgent := TProductAgent.Create(); { TODO -cMain: Wat doet dit in de originele applicatie?: fUiContext.ImagesScherm := TImagesScherm.Create(self); } { TODO -cMain: Kijken of "VerwerkParamStrings;" nodig is } PanelMain.Parent := Self; @@ -83,20 +86,20 @@ // Schermen op GridPanel plaatsen // PlaatsControlOpGrid(GridPanel; Control; RowI; ColI; (opt) RowSpan; (opt)ColSpan); // Gebruikersgegevens scherm bovenaan. - NieuweGridControl := TFormGebruiker.Create(GridPanel, Self, FAppContext, FAppContext.UserServerServiceContext, FAgent); + NieuweGridControl := TFormGebruiker.Create(GridPanel, Self, FAppContext, FAppContext.UserContext, FUserAgent); PlaatsControlOpGrid(GridPanel, NieuweGridControl, 0, 0, 1, 2); // Zoekscherm daaronder links - NieuweGridControl := TFormZoekProducten.Create(GridPanel, Self, FAppContext); + NieuweGridControl := TFormZoekProducten.Create(GridPanel, Self, FAppContext, FProductAgent); PlaatsControlOpGrid(GridPanel, NieuweGridControl, 1, 0); // Resultaten scherm daaronder links - NieuweGridControl := TFormLogin.Create(GridPanel, Self, FAppContext, FAgent); + NieuweGridControl := TFormLogin.Create(GridPanel, Self, FAppContext, FUserAgent); PlaatsControlOpGrid(GridPanel, NieuweGridControl, 2, 0); // Rechts is helemaal voor detail scherm - NieuweGridControl := TFormLogin.Create(GridPanel, Self, FAppContext, FAgent); + NieuweGridControl := TFormLogin.Create(GridPanel, Self, FAppContext, FUserAgent); PlaatsControlOpGrid(GridPanel, NieuweGridControl, 1, 1, 2); end; NAVLOGIN: - NieuwScherm := TFormLogin.Create(PanelMain, Self, FAppContext, FAgent); + NieuwScherm := TFormLogin.Create(PanelMain, Self, FAppContext, FUserAgent); end; NieuwScherm.Parent := PanelMain; Index: VerpakkingsDefinitie/WS/SelectService.pas =================================================================== diff -u --- VerpakkingsDefinitie/WS/SelectService.pas (revision 0) +++ VerpakkingsDefinitie/WS/SelectService.pas (revision 556) @@ -0,0 +1,478 @@ +// ************************************************************************ // +// The types declared in this file were generated from data read from the +// WSDL File described below: +// WSDL : http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.CLS?WSDL=1 +// >Import : http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.CLS?WSDL=1>0 +// Encoding : UTF-8 +// Codegen : [wfUnwindLiteralParameters-, wfOutputLiteralTypes+] +// Version : 1.0 +// (6/08/2021 11:30:44 - - $Rev: 45757 $) +// ************************************************************************ // + +unit SelectService; + +interface + +uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; + +const + IS_OPTN = $0001; + IS_REF = $0080; + + +type + + // ************************************************************************ // + // The following types, referred to in the WSDL document are not being represented + // in this file. They are either aliases[@] of other types represented or were referred + // to but never[!] declared in the document. The types from the latter category + // typically map to predefined/known XML or Embarcadero types; however, they could also + // indicate incorrect WSDL documents that failed to declare or import a schema type. + // ************************************************************************ // + // !:boolean - "http://www.w3.org/2001/XMLSchema"[Gbl] + // !:string - "http://www.w3.org/2001/XMLSchema"[Gbl] + // !:long - "http://www.w3.org/2001/XMLSchema"[Gbl] + + SelectResponse = class; { "http://vhintra.vanhoecke.be"[GblElm] } + Select = class; { "http://vhintra.vanhoecke.be"[GblElm] } + pxStatus = class; { "http://vhintra.vanhoecke.be"[GblCplx] } + anyType = class; { "http://vhintra.vanhoecke.be"[GblCplx] } + pxSelectCriteria = class; { "http://vhintra.vanhoecke.be"[GblCplx] } + + + + // ************************************************************************ // + // XML : SelectResponse, global, + // Namespace : http://vhintra.vanhoecke.be + // ************************************************************************ // + SelectResponse = class(TRemotable) + private + FSelectResult: pxStatus; + FvarDataSet: anyType; + FvarDataSet_Specified: boolean; + procedure SetvarDataSet(Index: Integer; const AanyType: anyType); + function varDataSet_Specified(Index: Integer): boolean; + public + destructor Destroy; override; + published + property SelectResult: pxStatus read FSelectResult write FSelectResult; + property varDataSet: anyType Index (IS_OPTN) read FvarDataSet write SetvarDataSet stored varDataSet_Specified; + end; + + + + // ************************************************************************ // + // XML : Select, global, + // Namespace : http://vhintra.vanhoecke.be + // ************************************************************************ // + Select = class(TRemotable) + private + FSessionKey: string; + FSessionKey_Specified: boolean; + FCriteria: pxSelectCriteria; + FCriteria_Specified: boolean; + FvarDataSet: anyType; + FvarDataSet_Specified: boolean; + procedure SetSessionKey(Index: Integer; const Astring: string); + function SessionKey_Specified(Index: Integer): boolean; + procedure SetCriteria(Index: Integer; const ApxSelectCriteria: pxSelectCriteria); + function Criteria_Specified(Index: Integer): boolean; + procedure SetvarDataSet(Index: Integer; const AanyType: anyType); + function varDataSet_Specified(Index: Integer): boolean; + public + destructor Destroy; override; + published + property SessionKey: string Index (IS_OPTN) read FSessionKey write SetSessionKey stored SessionKey_Specified; + property Criteria: pxSelectCriteria Index (IS_OPTN) read FCriteria write SetCriteria stored Criteria_Specified; + property varDataSet: anyType Index (IS_OPTN) read FvarDataSet write SetvarDataSet stored varDataSet_Specified; + end; + + + + // ************************************************************************ // + // XML : pxStatus, global, + // Namespace : http://vhintra.vanhoecke.be + // ************************************************************************ // + pxStatus = class(TRemotable) + private + FIsOK: Boolean; + FIsOK_Specified: boolean; + FMessage_: string; + FMessage__Specified: boolean; + FInternalMessage: string; + FInternalMessage_Specified: boolean; + FData: string; + FData_Specified: boolean; + procedure SetIsOK(Index: Integer; const ABoolean: Boolean); + function IsOK_Specified(Index: Integer): boolean; + procedure SetMessage_(Index: Integer; const Astring: string); + function Message__Specified(Index: Integer): boolean; + procedure SetInternalMessage(Index: Integer; const Astring: string); + function InternalMessage_Specified(Index: Integer): boolean; + procedure SetData(Index: Integer; const Astring: string); + function Data_Specified(Index: Integer): boolean; + published + property IsOK: Boolean Index (IS_OPTN) read FIsOK write SetIsOK stored IsOK_Specified; + property Message_: string Index (IS_OPTN) read FMessage_ write SetMessage_ stored Message__Specified; + property InternalMessage: string Index (IS_OPTN) read FInternalMessage write SetInternalMessage stored InternalMessage_Specified; + property Data: string Index (IS_OPTN) read FData write SetData stored Data_Specified; + end; + + + + // ************************************************************************ // + // XML : anyType, global, + // Namespace : http://vhintra.vanhoecke.be + // ************************************************************************ // + anyType = class(TRemotable) + private + published + end; + + + + // ************************************************************************ // + // XML : pxSelectCriteria, global, + // Namespace : http://vhintra.vanhoecke.be + // ************************************************************************ // + pxSelectCriteria = class(TRemotable) + private + FStockType: string; + FStockType_Specified: boolean; + FActief: string; + FActief_Specified: boolean; + FKLNr: string; + FKLNr_Specified: boolean; + FLevNr: string; + FLevNr_Specified: boolean; + FZoek: string; + FZoek_Specified: boolean; + FAt: string; + FAt_Specified: boolean; + FSubAt: string; + FSubAt_Specified: boolean; + FFormatCompact: string; + FFormatCompact_Specified: boolean; + FFormatExpand: string; + FFormatExpand_Specified: boolean; + FLijnMax: Int64; + FLijnMax_Specified: boolean; + procedure SetStockType(Index: Integer; const Astring: string); + function StockType_Specified(Index: Integer): boolean; + procedure SetActief(Index: Integer; const Astring: string); + function Actief_Specified(Index: Integer): boolean; + procedure SetKLNr(Index: Integer; const Astring: string); + function KLNr_Specified(Index: Integer): boolean; + procedure SetLevNr(Index: Integer; const Astring: string); + function LevNr_Specified(Index: Integer): boolean; + procedure SetZoek(Index: Integer; const Astring: string); + function Zoek_Specified(Index: Integer): boolean; + procedure SetAt(Index: Integer; const Astring: string); + function At_Specified(Index: Integer): boolean; + procedure SetSubAt(Index: Integer; const Astring: string); + function SubAt_Specified(Index: Integer): boolean; + procedure SetFormatCompact(Index: Integer; const Astring: string); + function FormatCompact_Specified(Index: Integer): boolean; + procedure SetFormatExpand(Index: Integer; const Astring: string); + function FormatExpand_Specified(Index: Integer): boolean; + procedure SetLijnMax(Index: Integer; const AInt64: Int64); + function LijnMax_Specified(Index: Integer): boolean; + published + property StockType: string Index (IS_OPTN) read FStockType write SetStockType stored StockType_Specified; + property Actief: string Index (IS_OPTN) read FActief write SetActief stored Actief_Specified; + property KLNr: string Index (IS_OPTN) read FKLNr write SetKLNr stored KLNr_Specified; + property LevNr: string Index (IS_OPTN) read FLevNr write SetLevNr stored LevNr_Specified; + property Zoek: string Index (IS_OPTN) read FZoek write SetZoek stored Zoek_Specified; + property At: string Index (IS_OPTN) read FAt write SetAt stored At_Specified; + property SubAt: string Index (IS_OPTN) read FSubAt write SetSubAt stored SubAt_Specified; + property FormatCompact: string Index (IS_OPTN) read FFormatCompact write SetFormatCompact stored FormatCompact_Specified; + property FormatExpand: string Index (IS_OPTN) read FFormatExpand write SetFormatExpand stored FormatExpand_Specified; + property LijnMax: Int64 Index (IS_OPTN) read FLijnMax write SetLijnMax stored LijnMax_Specified; + end; + + + // ************************************************************************ // + // Namespace : http://vhintra.vanhoecke.be + // soapAction: http://vhintra.vanhoecke.be/WS.Prod.Select.Select + // transport : http://schemas.xmlsoap.org/soap/http + // style : document + // use : literal + // binding : ProdSelectServerSoap + // service : ProdSelectServer + // port : ProdSelectServerSoap + // URL : http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.cls + // ************************************************************************ // + ProdSelectServerSoap = interface(IInvokable) + ['{94F84166-EBC8-EA46-AC2B-CB77654909FA}'] + function Select(const parameters: Select): SelectResponse; stdcall; + end; + +function GetProdSelectServerSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ProdSelectServerSoap; + + +implementation + uses SysUtils; + +function GetProdSelectServerSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ProdSelectServerSoap; +const + defWSDL = 'http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.CLS?WSDL=1'; + defURL = 'http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.cls'; + defSvc = 'ProdSelectServer'; + defPrt = 'ProdSelectServerSoap'; +var + RIO: THTTPRIO; +begin + Result := nil; + if (Addr = '') then + begin + if UseWSDL then + Addr := defWSDL + else + Addr := defURL; + end; + if HTTPRIO = nil then + RIO := THTTPRIO.Create(nil) + else + RIO := HTTPRIO; + try + Result := (RIO as ProdSelectServerSoap); + if UseWSDL then + begin + RIO.WSDLLocation := Addr; + RIO.Service := defSvc; + RIO.Port := defPrt; + end else + RIO.URL := Addr; + finally + if (Result = nil) and (HTTPRIO = nil) then + RIO.Free; + end; +end; + + +destructor SelectResponse.Destroy; +begin + SysUtils.FreeAndNil(FSelectResult); + SysUtils.FreeAndNil(FvarDataSet); + inherited Destroy; +end; + +procedure SelectResponse.SetvarDataSet(Index: Integer; const AanyType: anyType); +begin + FvarDataSet := AanyType; + FvarDataSet_Specified := True; +end; + +function SelectResponse.varDataSet_Specified(Index: Integer): boolean; +begin + Result := FvarDataSet_Specified; +end; + +destructor Select.Destroy; +begin + SysUtils.FreeAndNil(FCriteria); + SysUtils.FreeAndNil(FvarDataSet); + inherited Destroy; +end; + +procedure Select.SetSessionKey(Index: Integer; const Astring: string); +begin + FSessionKey := Astring; + FSessionKey_Specified := True; +end; + +function Select.SessionKey_Specified(Index: Integer): boolean; +begin + Result := FSessionKey_Specified; +end; + +procedure Select.SetCriteria(Index: Integer; const ApxSelectCriteria: pxSelectCriteria); +begin + FCriteria := ApxSelectCriteria; + FCriteria_Specified := True; +end; + +function Select.Criteria_Specified(Index: Integer): boolean; +begin + Result := FCriteria_Specified; +end; + +procedure Select.SetvarDataSet(Index: Integer; const AanyType: anyType); +begin + FvarDataSet := AanyType; + FvarDataSet_Specified := True; +end; + +function Select.varDataSet_Specified(Index: Integer): boolean; +begin + Result := FvarDataSet_Specified; +end; + +procedure pxStatus.SetIsOK(Index: Integer; const ABoolean: Boolean); +begin + FIsOK := ABoolean; + FIsOK_Specified := True; +end; + +function pxStatus.IsOK_Specified(Index: Integer): boolean; +begin + Result := FIsOK_Specified; +end; + +procedure pxStatus.SetMessage_(Index: Integer; const Astring: string); +begin + FMessage_ := Astring; + FMessage__Specified := True; +end; + +function pxStatus.Message__Specified(Index: Integer): boolean; +begin + Result := FMessage__Specified; +end; + +procedure pxStatus.SetInternalMessage(Index: Integer; const Astring: string); +begin + FInternalMessage := Astring; + FInternalMessage_Specified := True; +end; + +function pxStatus.InternalMessage_Specified(Index: Integer): boolean; +begin + Result := FInternalMessage_Specified; +end; + +procedure pxStatus.SetData(Index: Integer; const Astring: string); +begin + FData := Astring; + FData_Specified := True; +end; + +function pxStatus.Data_Specified(Index: Integer): boolean; +begin + Result := FData_Specified; +end; + +procedure pxSelectCriteria.SetStockType(Index: Integer; const Astring: string); +begin + FStockType := Astring; + FStockType_Specified := True; +end; + +function pxSelectCriteria.StockType_Specified(Index: Integer): boolean; +begin + Result := FStockType_Specified; +end; + +procedure pxSelectCriteria.SetActief(Index: Integer; const Astring: string); +begin + FActief := Astring; + FActief_Specified := True; +end; + +function pxSelectCriteria.Actief_Specified(Index: Integer): boolean; +begin + Result := FActief_Specified; +end; + +procedure pxSelectCriteria.SetKLNr(Index: Integer; const Astring: string); +begin + FKLNr := Astring; + FKLNr_Specified := True; +end; + +function pxSelectCriteria.KLNr_Specified(Index: Integer): boolean; +begin + Result := FKLNr_Specified; +end; + +procedure pxSelectCriteria.SetLevNr(Index: Integer; const Astring: string); +begin + FLevNr := Astring; + FLevNr_Specified := True; +end; + +function pxSelectCriteria.LevNr_Specified(Index: Integer): boolean; +begin + Result := FLevNr_Specified; +end; + +procedure pxSelectCriteria.SetZoek(Index: Integer; const Astring: string); +begin + FZoek := Astring; + FZoek_Specified := True; +end; + +function pxSelectCriteria.Zoek_Specified(Index: Integer): boolean; +begin + Result := FZoek_Specified; +end; + +procedure pxSelectCriteria.SetAt(Index: Integer; const Astring: string); +begin + FAt := Astring; + FAt_Specified := True; +end; + +function pxSelectCriteria.At_Specified(Index: Integer): boolean; +begin + Result := FAt_Specified; +end; + +procedure pxSelectCriteria.SetSubAt(Index: Integer; const Astring: string); +begin + FSubAt := Astring; + FSubAt_Specified := True; +end; + +function pxSelectCriteria.SubAt_Specified(Index: Integer): boolean; +begin + Result := FSubAt_Specified; +end; + +procedure pxSelectCriteria.SetFormatCompact(Index: Integer; const Astring: string); +begin + FFormatCompact := Astring; + FFormatCompact_Specified := True; +end; + +function pxSelectCriteria.FormatCompact_Specified(Index: Integer): boolean; +begin + Result := FFormatCompact_Specified; +end; + +procedure pxSelectCriteria.SetFormatExpand(Index: Integer; const Astring: string); +begin + FFormatExpand := Astring; + FFormatExpand_Specified := True; +end; + +function pxSelectCriteria.FormatExpand_Specified(Index: Integer): boolean; +begin + Result := FFormatExpand_Specified; +end; + +procedure pxSelectCriteria.SetLijnMax(Index: Integer; const AInt64: Int64); +begin + FLijnMax := AInt64; + FLijnMax_Specified := True; +end; + +function pxSelectCriteria.LijnMax_Specified(Index: Integer): boolean; +begin + Result := FLijnMax_Specified; +end; + +initialization + { ProdSelectServerSoap } + InvRegistry.RegisterInterface(TypeInfo(ProdSelectServerSoap), 'http://vhintra.vanhoecke.be', 'UTF-8'); + InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ProdSelectServerSoap), 'http://vhintra.vanhoecke.be/WS.Prod.Select.Select'); + InvRegistry.RegisterInvokeOptions(TypeInfo(ProdSelectServerSoap), ioDocument); + InvRegistry.RegisterInvokeOptions(TypeInfo(ProdSelectServerSoap), ioLiteral); + RemClassRegistry.RegisterXSClass(SelectResponse, 'http://vhintra.vanhoecke.be', 'SelectResponse'); + RemClassRegistry.RegisterXSClass(Select, 'http://vhintra.vanhoecke.be', 'Select'); + RemClassRegistry.RegisterXSClass(pxStatus, 'http://vhintra.vanhoecke.be', 'pxStatus'); + RemClassRegistry.RegisterExternalPropName(TypeInfo(pxStatus), 'Message_', '[ExtName="Message"]'); + RemClassRegistry.RegisterXSClass(anyType, 'http://vhintra.vanhoecke.be', 'anyType'); + RemClassRegistry.RegisterXSClass(pxSelectCriteria, 'http://vhintra.vanhoecke.be', 'pxSelectCriteria'); + +end. \ No newline at end of file Index: VerpakkingsDefinitie/UI/Subscherm.pas =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/UI/Subscherm.pas (.../Subscherm.pas) (revision 555) +++ VerpakkingsDefinitie/UI/Subscherm.pas (.../Subscherm.pas) (revision 556) @@ -7,7 +7,7 @@ System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ActnList, Vcl.ImgList, Vcl.ExtCtrls, Soap.InvokeRegistry, Soap.Rio, - Soap.SOAPHTTPClient, Data.DB, Datasnap.DBClient, Soap.SOAPConn, Agent, + Soap.SOAPHTTPClient, Data.DB, Datasnap.DBClient, Soap.SOAPConn, Main, ApplicationContext; type FishEye: Tag 556 refers to a dead (removed) revision in file `VerpakkingsDefinitie/WS/Agent.pas'. FishEye: No comparison available. Pass `N' to diff? Index: VerpakkingsDefinitie/WS/UserAgent.pas =================================================================== diff -u --- VerpakkingsDefinitie/WS/UserAgent.pas (revision 0) +++ VerpakkingsDefinitie/WS/UserAgent.pas (revision 556) @@ -0,0 +1,153 @@ +unit UserAgent; + +interface + +uses SysUtils, + ObserverPattern, ApplicationContext, UserServerService; + +// Resource strings are stored as resources and linked into the executable or +// library so that they can be modified without recompiling the program. +resourcestring + USER_SERVER_URL = 'http://cacheaccept2010:57772/csp/dev1/WS.Sys.Toegang.UserServer.cls'; + APPLICATION_NAME = 'vhintra'; + DOMAIN_NAME = '1'; + +type + TUserAgent = class + private + FUserServerSoap: UserServerService.UserServerSoap; + procedure RegistreerLoginGegevens(UserContext: TUserContext; pxLogInObj: pxLogIn); + procedure RegistreerMislukteLogin(UserContext: TUserContext; pxStatusObj: pxStatus); + procedure RegistreerLogout(UserContext: TUserContext); + procedure RegistreerMislukteLogout(UserContext: TUserContext; pxStatusObj: pxStatus); + public + Constructor Create(); + procedure GebruikerAanmelden(GebruikersNaam: string; Wachtwoord: string; UserContext: TUserContext); + procedure GebruikerAfmelden(UserContext: TUserContext); + end; + +implementation + +constructor TUserAgent.Create(); +begin + FUserServerSoap := UserServerService.GetUserServerSoap(false, USER_SERVER_URL, nil); +end; + +procedure TUserAgent.GebruikerAanmelden(GebruikersNaam: string; Wachtwoord: string; + UserContext: TUserContext); +var + LogInData: UserServerService.LogIn; + LogInResponseObj: UserServerService.LogInResponse; +begin + LogInData := nil; + LogInResponseObj := nil; + try + // Request + LogInData := UserServerService.LogIn.Create(); + LogInData.Application_ := APPLICATION_NAME; + LogInData.GebruikersNaam := GebruikersNaam; + LogInData.Wachtwoord := Wachtwoord; + LogInData.Domein := DOMAIN_NAME; + LogInData.pxLogIn := nil; // Ongebruikt + + LogInResponseObj := FUserServerSoap.LogIn(LogInData); + + // Response + if LogInResponseObj.LogInResult = nil then + begin + // Gelukt + RegistreerLoginGegevens(UserContext, LogInResponseObj.pxLogIn); + end + else + begin + // Mislukt + RegistreerMislukteLogin(UserContext, LogInResponseObj.LogInResult); + end; + finally + LogInData.Free(); + LogInResponseObj.Free(); + end; +end; + +procedure TUserAgent.RegistreerLoginGegevens(UserContext: TUserContext; pxLogInObj: pxLogIn); +begin + // Andere velden juist zetten + UserContext.IsOK := True; + UserContext.ErrorMessage := ''; + UserContext.InternalErrorMessage := ''; + + UserContext.SessionKey := pxLogInObj.SessionKey; + UserContext.GebruikersNaam := pxLogInObj.GebruikersNaam; + + UserContext.NotifyChanged(); +end; + +procedure TUserAgent.RegistreerMislukteLogin(UserContext: TUserContext; pxStatusObj: pxStatus); +begin + // Ander velden leegmaken + UserContext.SessionKey := ''; + UserContext.GebruikersNaam := ''; + + UserContext.IsOK := pxStatusObj.IsOK; + UserContext.ErrorMessage := pxStatusObj.Message_; + UserContext.InternalErrorMessage := pxStatusObj.InternalMessage; + + UserContext.NotifyChanged(); +end; + +procedure TUserAgent.GebruikerAfmelden(UserContext: TUserContext); +var + LogOutData: UserServerService.LogOut; + LogOutResponseObj: UserServerService.LogOutResponse; +begin + LogOutData := nil; + LogOutResponseObj := nil; + try + // Skip als de gebruikers nooit was ingelogd + if UserContext.SessionKey = '' then + exit; + + // Request + LogOutData := UserServerService.LogOut.Create(); + LogOutData.SessionKey := UserContext.SessionKey; + + LogOutResponseObj := FUserServerSoap.LogOut(LogOutData); + + // Response + if LogOutResponseObj.LogOutResult = nil then + begin + // Gelukt + RegistreerLogout(UserContext); + end + else + begin + // Mislukt + RegistreerMislukteLogout(UserContext, LogOutResponseObj.LogOutResult); + end; + finally + LogOutData.Free(); + LogOutResponseObj.Free(); + end; +end; + +procedure TUserAgent.RegistreerLogout(UserContext: TUserContext); +begin + UserContext.IsOK := True; + UserContext.ErrorMessage := ''; + UserContext.InternalErrorMessage := ''; + UserContext.SessionKey := ''; + UserContext.GebruikersNaam := ''; + + UserContext.NotifyChanged(); +end; + +procedure TUserAgent.RegistreerMislukteLogout(UserContext: TUserContext; pxStatusObj: pxStatus); +begin + UserContext.IsOK := pxStatusObj.IsOK; + UserContext.ErrorMessage := pxStatusObj.Message_; + UserContext.InternalErrorMessage := pxStatusObj.InternalMessage; + + UserContext.NotifyChanged(); +end; + +end. Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dproj =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 555) +++ VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 556) @@ -94,7 +94,7 @@
FormLogin
- + @@ -106,6 +106,8 @@ dfm + + Cfg_2 Base Index: VerpakkingsDefinitie/UI/LogInScherm.pas =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/UI/LogInScherm.pas (.../LogInScherm.pas) (revision 555) +++ VerpakkingsDefinitie/UI/LogInScherm.pas (.../LogInScherm.pas) (revision 556) @@ -7,7 +7,7 @@ System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Main, ApplicationContext, Subscherm, - Agent; + UserAgent; type TFormLogin = class(TFormSubscherm) @@ -24,24 +24,23 @@ procedure PanelLogInMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure PanelButtonEnableChange(Sender: TPanel); private - FAgent: TAgent; + FUserAgent: TUserAgent; procedure Login(); public - Constructor Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; Agent: TAgent); + Constructor Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; UserAgent: TUserAgent); end; implementation uses - Util, - UserServerService; + Util; {$R *.dfm} -constructor TFormLogin.Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; Agent: TAgent); +constructor TFormLogin.Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; UserAgent: TUserAgent); begin inherited Create(AOwner, Navigator, ApplicationContext); - self.FAgent := Agent; + self.FUserAgent := UserAgent; end; procedure TFormLogin.FormCreate(Sender: TObject); @@ -87,27 +86,27 @@ procedure TFormLogin.EditGebruikersnaamChange(Sender: TObject); begin // We kijken enkel naar gebruikersnaam, want leeg ww zou geldig kunnen zijn - PanelLogIn.Enabled := EditGebruikersnaam.Text <> EmptyStr; + PanelLogIn.Enabled := (Sender as TEdit).Text <> EmptyStr; PanelButtonEnableChange(PanelLogIn); end; procedure TFormLogin.Login(); var ErrorMessage: string; begin - FAgent.GebruikerAanmelden(EditGebruikersnaam.Text, EditWachtwoord.Text, ApplicationContext.UserServerServiceContext); + FUserAgent.GebruikerAanmelden(EditGebruikersnaam.Text, EditWachtwoord.Text, self.ApplicationContext.UserContext); - if ApplicationContext.UserServerServiceContext.IsOK then + if ApplicationContext.UserContext.IsOK then begin (self.Navigator as TFormMain).NavigeerNaar(Main.NAVZOEKPRODUCTEN); end else begin // Login gefaald - ErrorMessage := ApplicationContext.UserServerServiceContext.ErrorMessage; - if ApplicationContext.UserServerServiceContext.InternalErrorMessage <> '' then + ErrorMessage := ApplicationContext.UserContext.ErrorMessage; + if ApplicationContext.UserContext.InternalErrorMessage <> '' then begin - ErrorMessage := ErrorMessage + sLineBreak + ApplicationContext.UserServerServiceContext.InternalErrorMessage; + ErrorMessage := ErrorMessage + sLineBreak + ApplicationContext.UserContext.InternalErrorMessage; end; if MessageDlg(ErrorMessage, TMsgDlgType.mtInformation, [mbRetry, mbCancel], 0, mbCancel) = mrRetry then Index: VerpakkingsDefinitie/WS/ProductsAgent.pas =================================================================== diff -u --- VerpakkingsDefinitie/WS/ProductsAgent.pas (revision 0) +++ VerpakkingsDefinitie/WS/ProductsAgent.pas (revision 556) @@ -0,0 +1,99 @@ +unit ProductsAgent; + +interface + +uses SysUtils, + ObserverPattern, ApplicationContext, SelectService; + +// Resource strings are stored as resources and linked into the executable or +// library so that they can be modified without recompiling the program. +resourcestring + PROD_SERVER_URL = 'http://cacheaccept2010:57772/csp/dev1/WS.Prod.Select.CLS'; + KORTTEKST_FORMAT_COMPACT = 'KortTekst;IdentNr;StockType'; + KORTTEKST_FORMAT_EXPAND = 'KortTekst;IdentNr;StockType;LangTekstN'; + +type + TProductAgent = class + private + FProdSelectServerSoap: SelectService.ProdSelectServerSoap; + procedure RegistreerZoekresultaten(ProductsContext: TProductsContext; DataSet: anyType); + procedure RegistreerMislukteOpzoeking(ProductsContext: TProductsContext; pxStatusObj: pxStatus); + public + Constructor Create(); + procedure ZoekOpMetKortTekst(Zoek: string; KLNr: string; At: string; UserContext: TUserContext; + ProductsContext: TProductsContext); + end; + +implementation + +constructor TProductAgent.Create(); +begin + FProdSelectServerSoap := SelectService.GetProdSelectServerSoap(false, PROD_SERVER_URL, nil); +end; + +procedure TProductAgent.ZoekOpMetKortTekst(Zoek: string; KLNr: string; At: string; UserContext: TUserContext; + ProductsContext: TProductsContext); +var + ZoekData: SelectService.Select; + ZoekCriteria: SelectService.pxSelectCriteria; // Property van ZoekData + SelectResponseObj: SelectService.SelectResponse; +begin + ZoekData := nil; + ZoekCriteria := nil; + SelectResponseObj := nil; + try + // Request + ZoekData := SelectService.Select.Create(); + ZoekCriteria := SelectService.pxSelectCriteria.Create(); + ZoekData.SessionKey := UserContext.SessionKey; + ZoekCriteria.KLNr := KLNr; + ZoekCriteria.Zoek := Zoek; + ZoekCriteria.At := At; + ZoekCriteria.FormatCompact := KORTTEKST_FORMAT_COMPACT; + ZoekCriteria.FormatExpand := KORTTEKST_FORMAT_EXPAND; + ZoekData.Criteria := ZoekCriteria; + + SelectResponseObj := FProdSelectServerSoap.Select(ZoekData); + + // Response + if SelectResponseObj.SelectResult = nil then + begin + // Gelukt + RegistreerZoekresultaten(ProductsContext, SelectResponseObj.varDataSet); + end + else + begin + // Mislukt + RegistreerMislukteOpzoeking(ProductsContext, SelectResponseObj.SelectResult); + end; + finally + ZoekData.Free(); + SelectResponseObj.Free(); + end; +end; + +procedure TProductAgent.RegistreerZoekresultaten(ProductsContext: TProductsContext; DataSet: anyType); +begin + // Andere velden juist zetten + ProductsContext.IsOK := True; + ProductsContext.ErrorMessage := ''; + ProductsContext.InternalErrorMessage := ''; + + ProductsContext.DataSet := DataSet; + + ProductsContext.NotifyChanged(); +end; + +procedure TProductAgent.RegistreerMislukteOpzoeking(ProductsContext: TProductsContext; pxStatusObj: pxStatus); +begin + // Ander velden leegmaken + ProductsContext.DataSet := nil; + + ProductsContext.IsOK := pxStatusObj.IsOK; + ProductsContext.ErrorMessage := pxStatusObj.Message_; + ProductsContext.InternalErrorMessage := pxStatusObj.InternalMessage; + + ProductsContext.NotifyChanged(); +end; + +end. Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dpr =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 555) +++ VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 556) @@ -5,13 +5,15 @@ Main in 'Main.pas' {FormMain}, ApplicationContext in 'ApplicationContext.pas', LogInScherm in 'UI\LogInScherm.pas' {FormLogin}, - Agent in 'WS\Agent.pas', + UserAgent in 'WS\UserAgent.pas', Subscherm in 'UI\Subscherm.pas', UserServerService in 'WS\UserServerService.pas', ZoekProductenScherm in 'UI\ZoekProductenScherm.pas' {FormZoekProducten}, Util in 'UI\Util.pas', GebruikerScherm in 'UI\GebruikerScherm.pas' {FormGebruiker}, - ObserverPattern in 'UI\ObserverPattern.pas'; + ObserverPattern in 'UI\ObserverPattern.pas', + SelectService in 'WS\SelectService.pas', + ProductsAgent in 'WS\ProductsAgent.pas'; {$R *.res} Index: VerpakkingsDefinitie/UI/GebruikerScherm.pas =================================================================== diff -u -r555 -r556 --- VerpakkingsDefinitie/UI/GebruikerScherm.pas (.../GebruikerScherm.pas) (revision 555) +++ VerpakkingsDefinitie/UI/GebruikerScherm.pas (.../GebruikerScherm.pas) (revision 556) @@ -6,7 +6,7 @@ Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, ObserverPattern, - Agent, Main, ApplicationContext, Subscherm; + UserAgent, Main, ApplicationContext, Subscherm; type TFormGebruiker = class(TFormSubscherm) @@ -20,19 +20,19 @@ private FGebruikerSubject: TSubject; FGebruikerSubjectObserver: TSubjectObserver; - FUserAgent: TAgent; + FUserAgent: TUserAgent; procedure UpdateGui(Sender: TObject); public Constructor Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; - GebruikerSubject: TSubject; UserAgent: TAgent); + GebruikerSubject: TSubject; UserAgent: TUserAgent); end; implementation {$R *.dfm} constructor TFormGebruiker.Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; - GebruikerSubject: TSubject; UserAgent: TAgent); + GebruikerSubject: TSubject; UserAgent: TUserAgent); begin inherited Create(AOwner, Navigator, ApplicationContext); self.FGebruikerSubject := GebruikerSubject; @@ -54,14 +54,14 @@ procedure TFormGebruiker.UpdateGui(Sender: TObject); begin // Update with data from ApplicationContext - LabelGebruikersnaam.Caption := self.ApplicationContext.UserServerServiceContext.GebruikersNaam; + LabelGebruikersnaam.Caption := self.ApplicationContext.UserContext.GebruikersNaam; end; // Indrukken van button simuleren op panel: http://www.festra.com/wwwboard/messages/1006.html procedure TFormGebruiker.PanelLogInClick(Sender: TObject); begin try - FUserAgent.GebruikerAfmelden(self.ApplicationContext.UserServerServiceContext); + FUserAgent.GebruikerAfmelden(self.ApplicationContext.UserContext); finally // Als logout mislukt, gewoon naar inlog scherm gaan. De gebruiker kan dan opnieuw inloggen. self.Navigator.NavigeerNaar(Main.NAVLOGIN);