no message

This commit is contained in:
Daniele Teti 2023-09-04 11:29:05 +02:00
parent ac94f2d070
commit 7ebb0681d5
7 changed files with 25 additions and 40 deletions

View File

@ -7,7 +7,6 @@ uses
type
TBaseBO = class
private
protected
procedure Clone(Source: TBaseBO); virtual; abstract;
public

View File

@ -1,19 +1,17 @@
unit uServices;
// services module which provides binding between the data model and the persistence layer
// for sample app this will persist data into a json file
// in a proper application this would be making calls to a persistent layer like a database etc
// Services module which provides binding between the data model and the persistence layer
// for sample app this will persist data into a json file.
// In a proper application this would be making calls to a persistent layer like a database etc
interface
uses
Spring, Spring.Collections, Spring.Collections.Lists,
System.Generics.Collections, uData.Model,
System.Generics.Collections,
uData.Model,
System.SysUtils,
JsonDataObjects;
type
TServiceBase = class abstract
public
end;
@ -37,7 +35,7 @@ type
function UpdateMovie(const Movie: TMovie; InsertMode: Boolean): Boolean;
function DeleteMovie(const MovieID: Integer): Boolean;
function GetNextID: Integer;
function ListAll2: IList<TMovie>;
function ListAll2: TObjectList<TMovie>;
end;
implementation
@ -80,12 +78,11 @@ begin
end;
end;
function TMovieService.ListAll2: IList<TMovie>;
// using Spring 4 D
function TMovieService.ListAll2: TObjectList<TMovie>;
var
Movie: TMovie;
begin
Result := TCollections.CreateObjectList<TMovie>;
Result := TObjectList<TMovie>.Create;
Movie := TMovie.Create;
Movie.MovieID := 1;
Movie.MovieName := 'gone';

View File

@ -71,9 +71,13 @@ type
implementation
uses Spring, Spring.Collections, Spring.Collections.Lists,
MVCFramework.Utils, System.SysUtils,
MVCFramework.Serializer.JsonDataObjects, uServices, System.Generics.Collections, uData.Model,
uses
MVCFramework.Utils,
System.SysUtils,
MVCFramework.Serializer.JsonDataObjects,
uServices,
System.Generics.Collections,
uData.Model,
MVCFramework.Serializer.Defaults,
MVCFramework.HTMX;
@ -107,7 +111,8 @@ begin
else
begin
// just a normal form render
PageData.S['Explanation'] := 'Loaded via a full page reload, watch for the flicker in the title bar and see the calls in the browser Dev Tools console (network tab)';
PageData.S['Explanation'] :=
'Loaded via a full page reload, watch for the flicker in the title bar and see the calls in the browser Dev Tools console (network tab)';
RenderForm(['Header', 'Movie', 'Footer']);
end;
finally
@ -146,7 +151,7 @@ begin
sleep(500);
// now tell the web page to delay doing the content swap for another 1 second
Context.Response.SetReswap(soInnerHTML, 1000);
Render( Format('... Button was clicked at %s', [FormatDateTime('hh:mm:ss', Now)]));
Render(Format('... Button was clicked at %s', [FormatDateTime('hh:mm:ss', Now)]));
end;
procedure TMovieController.GetEditPanel(MovieID: Integer);

View File

@ -17,7 +17,8 @@ uses
uBase.Controller in 'Controllers\uBase.Controller.pas',
uMovie.Controller in 'Controllers\uMovie.Controller.pas',
uData.Model in 'Classes\uData.Model.pas',
uServices in 'Classes\uServices.pas';
uServices in 'Classes\uServices.pas',
MVCFramework.HTMX in 'MVCFramework.HTMX.pas';
{$R *.res}

View File

@ -18,16 +18,6 @@
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSX64' and '$(Base)'=='true') or '$(Base_OSX64)'!=''">
<Base_OSX64>true</Base_OSX64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSXARM64' and '$(Base)'=='true') or '$(Base_OSXARM64)'!=''">
<Base_OSXARM64>true</Base_OSXARM64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
@ -81,12 +71,6 @@
<PropertyGroup Condition="'$(Base_Linux64)'!=''">
<DCC_UsePackage>DataSnapServer;fmx;emshosting;DbxCommonDriver;bindengine;FireDACCommonODBC;emsclient;FireDACCommonDriver;IndyProtocols;dbxcds;emsedge;inetdb;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;soapmidas;dbexpress;FireDACInfxDriver;inet;DataSnapCommon;dbrtl;FireDACOracleDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;dsnapxml;DataSnapClient;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;xmlrtl;dsnap;CloudService;FireDACDb2Driver;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_OSX64)'!=''">
<DCC_UsePackage>DataSnapServer;fmx;DbxCommonDriver;bindengine;IndyIPCommon;FireDACCommonODBC;emsclient;FireDACCommonDriver;IndyProtocols;IndyIPClient;dbxcds;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;soapmidas;fmxFireDAC;dbexpress;DBXMySQLDriver;inet;DataSnapCommon;fmxase;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;ibxbindings;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;RESTComponents;DBXSqliteDriver;IndyIPServer;dsnapxml;DataSnapClient;DataSnapProviderClient;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;DBXInformixDriver;fmxobj;DataSnapNativeClient;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_OSXARM64)'!=''">
<DCC_UsePackage>DataSnapServer;fmx;DbxCommonDriver;bindengine;IndyIPCommon;FireDACCommonODBC;emsclient;FireDACCommonDriver;IndyProtocols;IndyIPClient;dbxcds;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;soapmidas;fmxFireDAC;dbexpress;DBXMySQLDriver;inet;DataSnapCommon;fmxase;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;ibxbindings;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;RESTComponents;DBXSqliteDriver;IndyIPServer;dsnapxml;DataSnapClient;DataSnapProviderClient;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;DBXInformixDriver;fmxobj;DataSnapNativeClient;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;soapmidas;vclactnband;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;EurekaLogCore;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;OmniThreadLibraryRuntime;FireDACMongoDBDriver;IndySystem;BossExperts;FireDACTDataDriver;vcldb;ibxbindings;ADOCluster_RT;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;dmvcframeworkDT;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
@ -120,8 +104,8 @@
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
<VerInfo_Build>2</VerInfo_Build>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.2;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Build>3</VerInfo_Build>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.3;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
@ -141,6 +125,7 @@
<DCCReference Include="Controllers\uMovie.Controller.pas"/>
<DCCReference Include="Classes\uData.Model.pas"/>
<DCCReference Include="Classes\uServices.pas"/>
<DCCReference Include="MVCFramework.HTMX.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
@ -926,8 +911,6 @@
</Deployment>
<Platforms>
<Platform value="Linux64">False</Platform>
<Platform value="OSX64">False</Platform>
<Platform value="OSXARM64">False</Platform>
<Platform value="Win32">False</Platform>
<Platform value="Win64">True</Platform>
</Platforms>

View File

@ -106,7 +106,7 @@ type
///<summary>Helper class to expose HTMX options as native functions on WebResponse objects</summary>
THTMXResponseHelper = class helper for TMVCWebResponse
THTMXResponseHelper = class helper for TMVCWebResponse
public type
TClientEventType = (etReceived, etSettled, etSwapped);
TSwapOption = (soInnerHTML, soOuterHTML, soBeforeBegin, soAfterBegin, soBeforeEnd, soAfterEnd, soDelete, soNone);

View File

@ -1 +1 @@
[{"MovieID":1,"MovieName":"Star Wars - A New Hope","Rating":10,"GenreID":5,"GenreName":"Sci-Fi","Current":false,"ReleaseDate":"1977-05-25"},{"MovieID":2,"MovieName":"Hunt for Red October","Rating":7,"GenreID":3,"GenreName":"Action","Current":false,"ReleaseDate":"1990-03-02"},{"MovieID":3,"MovieName":"Oppenheimer","Rating":7,"GenreID":6,"GenreName":"Drama","Current":true,"ReleaseDate":"2023-08-01"},{"MovieID":4,"MovieName":"The Trouble With Harry","Rating":10,"GenreID":2,"GenreName":"Comedy","Current":false,"ReleaseDate":"1955-09-30"},{"MovieID":5,"MovieName":"Ms Information","Rating":10,"GenreID":7,"GenreName":"Documentary","Current":true,"ReleaseDate":"2023-07-28"}]
[{"MovieID":1,"MovieName":"Star Wars - A New Hope","Rating":10,"GenreID":5,"GenreName":"Sci-Fi","Current":false,"ReleaseDate":"1977-05-25"},{"MovieID":2,"MovieName":"Hunt for Red October","Rating":7,"GenreID":3,"GenreName":"Action","Current":false,"ReleaseDate":"1990-03-02"},{"MovieID":3,"MovieName":"Oppenheimer","Rating":7,"GenreID":6,"GenreName":"Drama","Current":true,"ReleaseDate":"2023-08-01"},{"MovieID":4,"MovieName":"The Trouble With Harry","Rating":10,"GenreID":2,"GenreName":"Comedy","Current":false,"ReleaseDate":"1955-09-30"},{"MovieID":5,"MovieName":"Ms Information","Rating":10,"GenreID":7,"GenreName":"Documentary","Current":true,"ReleaseDate":"2023-07-28"},{"MovieID":6,"MovieName":"dfgdfgdfg","Rating":4,"GenreID":1,"GenreName":"","Current":true,"ReleaseDate":"2023-09-04"}]