Index: VerpakkingsDefinitie/ApplicationContext.pas =================================================================== diff -u -r563 -r564 --- VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 563) +++ VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 564) @@ -10,7 +10,7 @@ uses ObserverPattern, System.Generics.Collections, - OptiServerService; + OptiServerService, SysUtils; // SUB CONTEXTS: klassen die overeenkomen met bepaalde sub-context (bv. alles gerelateerd met authenticatie). @@ -42,13 +42,18 @@ FKol2: string; FKol3: string; FKol4: string; + function GetOmschrijving1(): string; + function GetOmschrijving2(): string; public property ProductNr: Integer read FProductNr write FProductNr; property Tekst: string read FTekst write FTekst; property Kol1: string read FKol1 write FKol1; property Kol2: string read FKol2 write FKol2; property Kol3: string read FKol3 write FKol3; property Kol4: string read FKol4 write FKol4; + + property Omschrijving1: string read GetOmschrijving1; + property Omschrijving2: string read GetOmschrijving2; end; TProductsContext = class(TSubject) @@ -106,17 +111,56 @@ implementation +// USER procedure TUserContext.NotifyChanged(); begin self.Change(); end; +// PRODUCT constructor TProductsContext.Create(); begin inherited Create(); FProducten := TList.Create(); end; +function TProductInformatie.GetOmschrijving1(): string; +var + S: string; +begin + if FKol4 = '' then + begin + Result := ''; + end + else + begin + try + Result := copy(FKol4, 0, Pos(',', FKol4) - 1); + except + Result := ''; + end; + + end; +end; + +function TProductInformatie.GetOmschrijving2(): string; +begin + if FKol4 = '' then + begin + Result := ''; + end + else + begin + try + Result := copy(FKol4, Pos(',', FKol4) + 2); + Result := copy(Result, 0, Pos(',', Result) - 1); // Tweede deel na de komma + except + Result := ''; + end; + + end; +end; + procedure TProductsContext.NotifyChanged(); begin self.Change(); @@ -127,6 +171,7 @@ self.Change(); end; +// APPLICATION CONTEXT constructor TApplicationContext.Create(); begin FUserContext := TUserContext.Create();