Index: PlanScan/Main.pas =================================================================== diff -u -r290 -r293 --- PlanScan/Main.pas (.../Main.pas) (revision 290) +++ PlanScan/Main.pas (.../Main.pas) (revision 293) @@ -41,6 +41,8 @@ procedure tsGebruikersShow(Sender: TObject); procedure btnGebruikerAfmeldenClick(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); private fUiContext: TUiContext; procedure VulDnaCodeGridMetData(DnaCodes: ArrayOfDnaCodeDnaCode); @@ -58,7 +60,7 @@ implementation uses - Agent, typinfo, System.StrUtils; + Agent, typinfo, System.StrUtils, LoginScherm; {$R *.dfm} @@ -179,9 +181,41 @@ procedure TfmMain.FormCreate(Sender: TObject); begin + UiContext := TUiContext.Create(); pcMain.ActivePage := tsDnaCodes; end; +procedure TfmMain.FormShow(Sender: TObject); +var + fLoginScherm: TfmLogin; + fGebruikerAanmeldenResponse: GebruikerAanmeldenResponse; +begin + fLoginScherm := TfmLogin.Create(self); + fLoginScherm.ShowModal; + if fLoginScherm.ModalResult = mrOk then begin + fGebruikerAanmeldenResponse := TAgent.Create(UiContext).GebruikerAanmelden(fLoginScherm.edtInitialen.Text, fLoginScherm.edtLoginCode.Text); + try + if fGebruikerAanmeldenResponse.Header.Status <> '200' then begin + ShowMessage(fGebruikerAanmeldenResponse.Header.Omschrijving); + Application.Terminate; + end else begin + UiContext.Initialen := fLoginScherm.edtInitialen.Text; + UiContext.LoginCode := fLoginScherm.edtLoginCode.Text; + end; + finally + fGebruikerAanmeldenResponse.Free; + end; + end else begin + Application.Terminate; + end; + fLoginScherm.Free; +end; + +procedure TfmMain.FormClose(Sender: TObject; var Action: TCloseAction); +begin + TAgent.Create(UiContext).GebruikerAfmelden(UiContext.Initialen, UiContext.LoginCode); +end; + function TfmMain.BepaalGeselecteerdeDnaCodes: TStringList; var DnaCodesStringList: TStringList; Index: PlanScan/UI/LoginScherm.dfm =================================================================== diff -u -r292 -r293 --- PlanScan/UI/LoginScherm.dfm (.../LoginScherm.dfm) (revision 292) +++ PlanScan/UI/LoginScherm.dfm (.../LoginScherm.dfm) (revision 293) @@ -1,8 +1,9 @@ object fmLogin: TfmLogin Left = 0 Top = 0 + ActiveControl = edtInitialen Caption = 'Login' - ClientHeight = 109 + ClientHeight = 120 ClientWidth = 313 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -45,6 +46,7 @@ Width = 75 Height = 25 Caption = 'Login' + Default = True Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Index: PlanScan/Main.dfm =================================================================== diff -u -r290 -r293 --- PlanScan/Main.dfm (.../Main.dfm) (revision 290) +++ PlanScan/Main.dfm (.../Main.dfm) (revision 293) @@ -11,7 +11,9 @@ Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False + OnClose = FormClose OnCreate = FormCreate + OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object CacheQuery1: TCacheQuery Index: PlanScan/PlanScan.dproj =================================================================== diff -u -r292 -r293 --- PlanScan/PlanScan.dproj (.../PlanScan.dproj) (revision 292) +++ PlanScan/PlanScan.dproj (.../PlanScan.dproj) (revision 293) @@ -91,6 +91,10 @@ + +
fmLogin
+ dfm +
Cfg_2 Index: PlanScan/PlanScan.dproj.local =================================================================== diff -u -r292 -r293 --- PlanScan/PlanScan.dproj.local (.../PlanScan.dproj.local) (revision 292) +++ PlanScan/PlanScan.dproj.local (.../PlanScan.dproj.local) (revision 293) @@ -2,13 +2,13 @@ 2020/02/17 10:05:16.000.600,=C:\Users\TomV\Documents\RAD Studio\Projects\Unit2.pas - 2020/02/17 10:06:02.000.921,E:\svn\Delphi\PlanScan\Main.pas=C:\Users\TomV\Documents\RAD Studio\Projects\Unit2.pas 2020/02/17 10:06:02.000.921,E:\svn\Delphi\PlanScan\Main.dfm=C:\Users\TomV\Documents\RAD Studio\Projects\Unit2.dfm + 2020/02/17 10:06:02.000.921,E:\svn\Delphi\PlanScan\Main.pas=C:\Users\TomV\Documents\RAD Studio\Projects\Unit2.pas 2020/02/17 10:06:12.000.996,E:\svn\Delphi\PlanScan\PlanScan.dproj=C:\Users\TomV\Documents\RAD Studio\Projects\Project2.dproj - 2020/02/17 11:09:31.000.812,=E:\svn\Delphi\PlanScan\WS\GebruikerService.pas - 2020/02/17 11:09:31.000.815,=E:\svn\Delphi\PlanScan\WS\__history 2020/02/17 11:09:31.000.808,=E:\svn\Delphi\PlanScan\WS\Agent.pas 2020/02/17 11:09:31.000.810,=E:\svn\Delphi\PlanScan\WS\DnaCodeService.pas + 2020/02/17 11:09:31.000.815,=E:\svn\Delphi\PlanScan\WS\__history + 2020/02/17 11:09:31.000.812,=E:\svn\Delphi\PlanScan\WS\GebruikerService.pas 2020/02/17 11:12:28.000.857,=E:\svn\Delphi\AAPClient\UI\UiContext.pas 2020/02/17 11:13:01.000.260,E:\svn\Delphi\AAPClient\UI\UiContext.pas= 2020/02/17 11:14:30.000.384,=E:\svn\Delphi\PlanScan\UI\UiContext.pas @@ -25,11 +25,16 @@ 2020/03/02 09:30:33.825,=E:\svn\Delphi\PlanScan\WS.pas 2020/03/02 09:30:46.906,E:\svn\Delphi\PlanScan\WS\GebruikerService.pas= 2020/03/02 09:31:23.040,E:\svn\Delphi\PlanScan\WS\GebruikerService.pas=E:\svn\Delphi\PlanScan\WS.pas + 2020/03/04 11:43:31.229,=E:\svn\Delphi\PlanScan\Unit1.pas + 2020/03/04 11:49:17.078,E:\svn\Delphi\PlanScan\UI\LoginScherm.pas=E:\svn\Delphi\PlanScan\Unit1.pas + 2020/03/04 11:49:17.078,E:\svn\Delphi\PlanScan\UI\LoginScherm.dfm=E:\svn\Delphi\PlanScan\Unit1.dfm + + Index: PlanScan/PlanScan.dpr =================================================================== diff -u -r292 -r293 --- PlanScan/PlanScan.dpr (.../PlanScan.dpr) (revision 292) +++ PlanScan/PlanScan.dpr (.../PlanScan.dpr) (revision 293) @@ -11,13 +11,15 @@ UiContext in 'UI\UiContext.pas', Images in 'UI\Images.pas', DnaCodeService in 'WS\DnaCodeService.pas', - GebruikerService in 'WS\GebruikerService.pas'; + GebruikerService in 'WS\GebruikerService.pas', + LoginScherm in 'UI\LoginScherm.pas' {fmLogin}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TfmMain, fmMain); + Application.CreateForm(TfmLogin, fmLogin); Application.Run; end.