Sei sulla pagina 1di 19

RAD​ ​Server​ ​Industry​ ​Template

Hospitality​ ​Survey​ ​Sample​ ​Application​ ​Setup​ ​Guide

The​ ​template​ ​consists​ ​of​ ​four​ ​different​ ​projects​ ​that​ ​interconnect​ ​with​ ​each​ ​other.​ ​The​ ​projects
are:

● Hospitality​ ​Survey​ ​Setup


● Hospitality​ ​Survey​ ​EMS
● Hospitality​ ​Survey​ ​Admin
● Hospitality​ ​Survey​ ​Client

You​ ​should​ ​deploy​ ​and​ ​run​ ​the​ ​projects​ ​in​ ​the​ ​following​ ​order:

1)​ ​The​ ​Hospitality​ ​Survey​ ​Setup​ ​app​ ​will​ ​help​ ​you​ ​set​ ​up​ ​your​ ​database,​ ​the​ ​tables​ ​and​ ​data,
and​ ​your​ ​EMS​ ​user​ ​accounts.

2)​ ​The​ ​Hospitality​ ​Survey​ ​EMS​ ​is​ ​the​ ​RAD​ ​Server​ ​side​ ​REST​ ​resource​ ​which​ ​both​ ​the
Hospitality​ ​Survey​ ​Client​ ​and​ ​the​ ​Hospitality​ ​Survey​ ​Admin​ ​interface​ ​with.​ ​It​ ​should​ ​be
deployable​ ​on​ ​Windows​ ​and​ ​Linux​ ​through​ ​IIS,​ ​Apache,​ ​or​ ​the​ ​standalone​ ​EMS​ ​server.

3)​ ​The​ ​Hospitality​ ​Survey​ ​Client​ ​is​ ​a​ ​RAD​ ​Studio​ ​client​ ​application​ ​for​ ​Android,​ ​iOS,​ ​macOS
and​ ​Windows.​ ​The​ ​client​ ​application​ ​should​ ​allow​ ​you​ ​to​ ​select​ ​a​ ​tenant​ ​from​ ​your​ ​RAD​ ​Server
and​ ​then​ ​log​ ​in​ ​as​ ​a​ ​user.​ ​Once​ ​logged​ ​in,​ ​it​ ​will​ ​download​ ​the​ ​survey​ ​data​ ​for​ ​your​ ​current
tenant​ ​and​ ​allow​ ​the​ ​survey​ ​to​ ​be​ ​filled​ ​out.​ ​Once​ ​the​ ​survey​ ​is​ ​complete​ ​it​ ​can​ ​be​ ​submitted
back​ ​to​ ​the​ ​server​ ​and​ ​a​ ​new​ ​survey​ ​can​ ​be​ ​started.

4)​ ​The​ ​Hospitality​ ​Survey​ ​Admin​ ​app​ ​is​ ​an​ ​AngularJS​ ​application​ ​for​ ​the​ ​web.​ ​You​ ​should​ ​be
able​ ​to​ ​log​ ​into​ ​the​ ​application​ ​with​ ​your​ ​Tenant​ ​ID​ ​and​ ​RAD​ ​Server​ ​user​ ​ID.​ ​The​ ​web​ ​app
should​ ​allow​ ​you​ ​to​ ​view​ ​statistics​ ​and​ ​graphs​ ​about​ ​the​ ​results​ ​of​ ​the​ ​survey​ ​questions​ ​and
each​ ​individual​ ​question​ ​and​ ​answer.​ ​You​ ​can​ ​also​ ​export​ ​a​ ​list​ ​of​ ​emails​ ​collected​ ​from​ ​the
surveys.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Quick​ ​Start​ ​Guide
I.​ ​HospitalitySurveySetup

You​ ​will​ ​need​ ​two​ ​tenant​ ​IDs​ ​already​ ​set​ ​up​ ​in​ ​RAD​ ​Server​ ​to​ ​be​ ​able​ ​to​ ​complete​ ​the​ ​setup
process.​ ​You​ ​need​ ​5​ ​user​ ​account​ ​spaces​ ​available​ ​(you​ ​should​ ​delete​ ​your​ ​test​ ​user).

Set​ ​up​ ​a​ ​user:


http://docwiki.embarcadero.com/RADStudio/Tokyo/en/EMS_Console_UI

Setup​ ​two​ ​tenants:


http://docwiki.embarcadero.com/RADStudio/Tokyo/en/RAD_Server_Multi-Tenancy_Support#EM
S_Multi-Tenant_Console

The​ ​default​ ​tenant​ ​1​ ​used​ ​in​ ​the​ ​setup​ ​is​ ​as​ ​follows​ ​with​ ​a​ ​password​ ​of​ ​"secret":
00000000-0000-0000-0000-000000000001

You​ ​should​ ​create​ ​a​ ​second​ ​tenant​ ​ID​ ​and​ ​enter​ ​it​ ​on​ ​Step​ ​2.

Step​ ​1:

You​ ​will​ ​need​ ​to​ ​set​ ​a​ ​path​ ​to​ ​your​ ​stores​ ​database.​ ​It​ ​will​ ​be​ ​created​ ​if​ ​it​ ​does​ ​not​ ​exist.​ ​The
default​ ​is:
C:\Users\Public\Documents\Embarcadero\EMS\HOSPITALITYSURVEY.IB

You​ ​will​ ​need​ ​to​ ​set​ ​a​ ​path​ ​to​ ​your​ ​EMSServer​ ​database.​ ​The​ ​default​ ​is:
C:\Users\Public\Documents\Embarcadero\EMS\EMSSERVER.IB

Step​ ​2:

When​ ​you​ ​run​ ​Setup​ ​Users​ ​you​ ​will​ ​need​ ​to​ ​provide​ ​the​ ​user​ ​account​ ​as​ ​mentioned​ ​above.

Step​ ​3:

Be​ ​sure​ ​to​ ​update​ ​the​ ​tenant​ ​IDs​ ​to​ ​to​ ​match​ ​your​ ​tenant​ ​IDs.​ ​You​ ​can​ ​skip​ ​this​ ​step​ ​if​ ​you​ ​don't
need​ ​to​ ​modify​ ​the​ ​existing​ ​survey​ ​questions.​ ​Otherwise​ ​customize​ ​them​ ​to​ ​your​ ​liking​ ​and
Re-Generate.

Step​ ​4:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Initialize​ ​All​ ​to​ ​create​ ​the​ ​store​ ​tables​ ​and​ ​insert​ ​the​ ​template​ ​questions.

At​ ​this​ ​point​ ​the​ ​tenants,​ ​users,​ ​database,​ ​tables,​ ​and​ ​data​ ​should​ ​now​ ​be​ ​setup​ ​for​ ​the
template.

II.​ ​HospitalitySurveyEMS

Step​ ​1:

Open​ ​the​ ​RADServerHospitalitySurvey​ ​project​ ​and​ ​configure​ ​the​ ​path​ ​to​ ​your​ ​EMS​ ​database
and​ ​your​ ​stores​ ​database​ ​in​ ​the​ ​TFDConnection​ ​component​ ​in​ ​both​ ​DataModules.

Step​ ​2:

Run​ ​the​ ​project​ ​to​ ​deploy​ ​your​ ​edge​ ​module​ ​into​ ​the​ ​EMS​ ​Development​ ​Server.

III.​ ​HospitalitySurveyClient

Step​ ​1:

Open​ ​the​ ​HospitalitySurvey​ ​project.

Step​ ​2:

Configure​ ​the​ ​EMS_SERVER​ ​and​ ​EMS_PORT​ ​const​ ​in​ ​uMainForm.pas​ ​to​ ​point​ ​at​ ​your
development​ ​server.​ ​The​ ​default​ ​is​ ​localhost​ ​8080.

Step​ ​3:
Run​ ​the​ ​project​ ​to​ ​deploy​ ​your​ ​client​ ​to​ ​Windows.​ ​You​ ​should​ ​be​ ​able​ ​to​ ​select​ ​your​ ​tenant,​ ​log
into​ ​the​ ​store,​ ​log​ ​into​ ​a​ ​user​ ​account,​ ​and​ ​complete​ ​a​ ​survey.

IV.​ ​HospitalitySurveyAdmin

Step​ ​1:

You​ ​should​ ​be​ ​able​ ​to​ ​open​ ​index.html​ ​in​ ​your​ ​browser​ ​and​ ​log​ ​in​ ​with​ ​your​ ​tenant​ ​and​ ​a
manager​ ​account​ ​(created​ ​in​ ​the​ ​Setup​ ​step).

If​ ​you​ ​selected​ ​the​ ​same​ ​tenant​ ​that​ ​you​ ​completed​ ​a​ ​survey​ ​in​ ​from​ ​the​ ​HospitalitySurveyClient
you​ ​should​ ​see​ ​your​ ​survey​ ​stats​ ​on​ ​the​ ​Dashboard​ ​and​ ​results​ ​in​ ​the​ ​Surveys​ ​tab.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Step​ ​2:

You​ ​can​ ​also​ ​deploy​ ​the​ ​HospitalitySurveyAdmin​ ​files​ ​to​ ​the​ ​same​ ​web​ ​server​ ​as​ ​your​ ​EMS
Server​ ​module​ ​or​ ​a​ ​different​ ​web​ ​server​ ​as​ ​long​ ​as​ ​your​ ​CORS​ ​permissions​ ​are​ ​setup​ ​correctly.

Hospitality​ ​Survey​ ​Setup


Start:​ ​Your​ ​EMS​ ​Server​ ​should​ ​already​ ​be​ ​setup​ ​and​ ​running.

Step​ ​1:​ ​Set​ ​a​ ​path​ ​for​ ​your​ ​stores​ ​database.​ ​Set​ ​the​ ​path​ ​to​ ​the​ ​EMSServer​ ​database.

The​ ​stores​ ​database​ ​is​ ​created,​ ​used,​ ​and​ ​populated​ ​with​ ​data​ ​in​ ​Step​ ​4.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


The​ ​EMSServer​ ​database​ ​link​ ​is​ ​used​ ​to​ ​populate​ ​the​ ​drop​ ​down​ ​of​ ​Tenant​ ​IDs​ ​in​ ​Step
3.

Step​ ​2:​ ​Setup​ ​the​ ​demo​ ​users​ ​on​ ​the​ ​EMS​ ​Server​ ​using​ ​the​ ​EMS​ ​API.

You​ ​will​ ​need​ ​your​ ​EMSServer​ ​Host,​ ​Port,​ ​and​ ​Tenant​ ​IDs​ ​in​ ​this​ ​step.​ ​The​ ​Setup​ ​will
connect​ ​to​ ​your​ ​EMSServer​ ​and​ ​create​ ​groups​ ​and​ ​users​ ​for​ ​the​ ​template.

You​ ​can​ ​create​ ​Tenant​ ​IDs​ ​using​ ​this​ ​tutorial:


http://docwiki.embarcadero.com/RADStudio/Tokyo/en/RAD_Server_Multi-Tenancy_Sup
port#EMS_Multi-Tenant_Console

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Step​ ​3:​ ​Customize​ ​the​ ​questions​ ​to​ ​be​ ​asked​ ​in​ ​the​ ​survey​ ​for​ ​each​ ​tenant.​ ​A​ ​blank
tenant_id​ ​will​ ​be​ ​asked​ ​to​ ​all​ ​tenants.

You​ ​can​ ​customize​ ​the​ ​questions​ ​in​ ​your​ ​survey​ ​on​ ​Step​ ​3.​ ​The​ ​fields​ ​are:

ID​​ ​-​ ​An​ ​ID​ ​for​ ​the​ ​question.


name​​ ​-​ ​A​ ​short​ ​name​ ​for​ ​the​ ​question​ ​with​ ​no​ ​spaces.
title​​ ​-​ ​The​ ​text​ ​of​ ​the​ ​question​ ​as​ ​it​ ​will​ ​appear​ ​in​ ​the​ ​survey.
type​​ ​-​ ​The​ ​type​ ​of​ ​question​ ​controls​ ​which​ ​question​ ​template​ ​is​ ​loaded​ ​on​ ​the​ ​client.​ ​The
existing​ ​types​ ​are:​ ​rating,​ ​yesno,​ ​edit,​ ​options
options​​ ​-​ ​If​ ​the​ ​type​ ​of​ ​the​ ​question​ ​is​ ​set​ ​to​ ​options​ ​this​ ​field​ ​is​ ​used​ ​to​ ​populate​ ​the
options.​ ​It's​ ​value​ ​is​ ​a​ ​JSON​ ​array​ ​of​ ​options.
value​​ ​-​ ​The​ ​value​ ​is​ ​where​ ​the​ ​user​ ​submitted​ ​data​ ​is​ ​stored.​ ​It​ ​can​ ​be​ ​left​ ​blank​ ​but
could​ ​be​ ​used​ ​to​ ​provide​ ​a​ ​default​ ​answer.
category​​ ​-​ ​The​ ​category​ ​of​ ​the​ ​question.​ ​This​ ​field​ ​is​ ​provided​ ​for​ ​expandability.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


tenant_id​​ ​-​ ​The​ ​tenant​ ​ID​ ​of​ ​the​ ​question.​ ​If​ ​the​ ​tenant_id​ ​field​ ​is​ ​blank​ ​all​ ​tenants​ ​will
get​ ​the​ ​question.​ ​If​ ​it​ ​is​ ​set​ ​to​ ​a​ ​tenant​ ​only​ ​that​ ​tenant​ ​will​ ​get​ ​the​ ​question.

Be​ ​sure​ ​to​ ​update​ ​the​ ​tenant​ ​IDs​ ​to​ ​to​ ​match​ ​your​ ​tenant​ ​IDs.

Pressing​ ​the​ ​Re-Generate​ ​button​ ​will​ ​create​ ​new​ ​INSERT​ ​queries​ ​on​ ​Step​ ​4.

Step​ ​4:​ ​Create​ ​the​ ​tables​ ​and​ ​insert​ ​the​ ​questions​ ​data​ ​into​ ​your​ ​stores​ ​database​ ​with​ ​the
Initialize​ ​All​ ​button.

This​ ​step​ ​contains​ ​the​ ​SQL​ ​setup​ ​queries​ ​for​ ​the​ ​stores​ ​database.​ ​There​ ​are​ ​three​ ​tables
which​ ​will​ ​be​ ​set​ ​up​ ​which​ ​are:​ ​SURVEYS,​ ​QUESTIONS,​ ​RESULTS

Each​ ​table​ ​will​ ​be​ ​dropped​ ​and​ ​re-created​ ​when​ ​the​ ​queries​ ​are​ ​run​ ​(any​ ​existing​ ​data​ ​in
the​ ​tables​ ​will​ ​be​ ​lost).​ ​In​ ​the​ ​third​ ​TMemo​ ​field​ ​the​ ​SQL​ ​queries​ ​from​ ​your​ ​questions
defined​ ​in​ ​Step​ ​3​ ​will​ ​appear.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Pressing​ ​the​ ​Initialize​ ​All​ ​button​ ​will​ ​execute​ ​the​ ​SQL​ ​queries​ ​against​ ​your​ ​defined​ ​stores
database​ ​from​ ​Step​ ​1.

Complete:​ ​After​ ​step​ ​4​ ​the​ ​databases​ ​and​ ​users​ ​should​ ​be​ ​setup​ ​and​ ​ready​ ​for​ ​you​ ​to​ ​use
the​ ​client​ ​and​ ​admin​ ​areas.

Your​ ​EMS​ ​database​ ​and​ ​users​ ​should​ ​be​ ​setup​ ​at​ ​this​ ​point.​ ​You​ ​should​ ​be​ ​able​ ​to
connect​ ​the​ ​Hospitality​ ​Survey​ ​EMS​ ​package​ ​to​ ​your​ ​new​ ​stores​ ​database​ ​and​ ​compile
the​ ​package.

Once​ ​your​ ​Hospitality​ ​Survey​ ​EMS​ ​package​ ​is​ ​running​ ​in​ ​the​ ​EMS​ ​Development​ ​Server
you​ ​should​ ​be​ ​able​ ​to​ ​open​ ​and​ ​compile​ ​the​ ​Hospitality​ ​Survey​ ​Client.

After​ ​you​ ​submit​ ​some​ ​survey​ ​results​ ​via​ ​the​ ​Hospitality​ ​Survey​ ​Client​ ​you​ ​should​ ​be
able​ ​to​ ​log​ ​into​ ​the​ ​Hospitality​ ​Survey​ ​Admin​ ​and​ ​see​ ​your​ ​results.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Hospitality​ ​Survey​ ​EMS
The​ ​Hospitality​ ​Survey​ ​EMS​ ​is​ ​the​ ​RAD​ ​Server​ ​module​ ​for​ ​the​ ​Hospitality​ ​Survey​ ​Client​ ​and​ ​the
Hospitality​ ​Survey​ ​Admin​ ​to​ ​interface​ ​with.

The​ ​end​ ​points​ ​mainly​ ​return​ ​the​ ​FireDAC​ ​JSON​ ​format​ ​which​ ​can​ ​be​ ​easily​ ​loaded​ ​in​ ​to​ ​a​ ​RAD
Studio​ ​client​ ​or​ ​access​ ​via​ ​standard​ ​JSON​ ​in​ ​a​ ​non-RAD​ ​Studio​ ​environment.

Endpoints:
● GET​ ​/survey/​​ ​-​ ​Download​ ​the​ ​survey​ ​questions​ ​in​ ​FireDAC​ ​JSON​ ​format.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


● GET​ ​/survey/results/*​​ ​-​ ​Download​ ​the​ ​survey​ ​results​ ​in​ ​a​ ​paged​ ​fashion​ ​in​ ​FireDAC
JSON​ ​format.​ ​The​ ​page​ ​number​ ​is​ ​placed​ ​where​ ​the​ ​*​ ​is.
● GET​ ​/survey/stats/all​​ ​-​ ​Download​ ​various​ ​stats​ ​about​ ​the​ ​survey​ ​results​ ​in​ ​FireDAC
JSON​ ​format.
● GET​ ​/survey/details/*​​ ​-​ ​Download​ ​the​ ​questions​ ​and​ ​answers​ ​from​ ​a​ ​specific​ ​survey​ ​ID
in​ ​FireDAC​ ​JSON​ ​format.​ ​The​ ​survey​ ​ID​ ​is​ ​placed​ ​where​ ​the​ ​*​ ​is.
● GET​ ​/survey/emails/csv​​ ​-​ ​Download​ ​a​ ​list​ ​of​ ​all​ ​of​ ​the​ ​email​ ​addresses​ ​from​ ​completed
surveys​ ​in​ ​CSV​ ​format.

● GET​ ​/tenants/​​ ​-​ ​Download​ ​a​ ​list​ ​of​ ​the​ ​server​ ​Tenants​ ​which​ ​are​ ​active​ ​in​ ​FireDAC
JSON​ ​format.

The​ ​endpoints​ ​are​ ​defined​ ​like​ ​this​ ​in​ ​code:

//​ ​SurveyModule.pas
[ResourceName('survey')]
//
procedure​ ​Get(const​ ​AContext:​ ​TEndpointContext;​ ​const​ ​ARequest:​ ​TEndpointRequest;​ ​const
AResponse:​ ​TEndpointResponse);
//
[ResourceSuffix('{query}/*')]
procedure​ ​GetData(const​ ​AContext:​ ​TEndpointContext;​ ​const​ ​ARequest:​ ​TEndpointRequest;
const​ ​AResponse:​ ​TEndpointResponse);
//
[ResourceSuffix('{query}')]
procedure​ ​PostData(const​ ​AContext:​ ​TEndpointContext;​ ​const​ ​ARequest:​ ​TEndpointRequest;
const​ ​AResponse:​ ​TEndpointResponse);
//
//
if​ ​ARequest.Params.Values['query']​ ​=​ ​'results'​ ​then
if​ ​ARequest.Params.Values['query']​ ​=​ ​'stats'​ ​then
if​ ​ARequest.Params.Values['query']​ ​=​ ​'details'​ ​then
if​ ​ARequest.Params.Values['query']​ ​=​ ​'emails'​ ​then
//
//
//​ ​TenantModule.pas
[ResourceName('tenants')]
procedure​ ​Get(const​ ​AContext:​ ​TEndpointContext;​ ​const​ ​ARequest:​ ​TEndpointRequest;​ ​const
AResponse:​ ​TEndpointResponse);

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


The​ ​variable​ ​in​ ​the​ ​/survey/results/*​ ​and​ ​/survey/details/*​ ​endpoints​ ​is​ ​accessed​ ​via
ARequest.Segments​ ​object​ ​like​ ​below:

​ ​ ​if​ ​ASegments.Count​ ​=​ ​3​ ​then​ ​//​ ​first​ ​segment​ ​is​ ​"survey"​ ​second​ ​is​ ​"results​ ​or​ ​"details"​ ​third
segment​ ​is​ ​the​ ​variable
​ ​ ​begin
​ ​ ​ ​ ​SurveyId​ ​:=​ ​ASegments.Items[2];
​ ​ ​end;

User​ ​permissions:

User​ ​permissions​ ​are​ ​governed​ ​by​ ​the​ ​{$DEFINE​ ​GROUPPERMISSIONS}.​ ​You​ ​can​ ​comment
or​ ​uncomment​ ​this​ ​line​ ​for​ ​dev​ ​and​ ​live​ ​deployments.​ ​User​ ​permissions​ ​are​ ​ignored​ ​when
{$DEFINE​ ​GROUPPERMISSIONS}​ ​is​ ​commented​ ​out.

Hospitality​ ​Survey​ ​Client


The​ ​Hospitality​ ​Survey​ ​Client​ ​connects​ ​to​ ​the​ ​Hospitality​ ​Survey​ ​EMS​ ​server​ ​on​ ​multiple​ ​end
points​ ​for​ ​downloading​ ​and​ ​upload​ ​data.​ ​It​ ​is​ ​built​ ​to​ ​be​ ​cross​ ​platform​ ​on​ ​Android,​ ​iOS,​ ​macOS,
and​ ​Windows​ ​using​ ​a​ ​single​ ​code​ ​base​ ​and​ ​single​ ​UI.

The​ ​survey​ ​is​ ​dynamically​ ​generated​ ​based​ ​on​ ​the​ ​questions​ ​that​ ​are​ ​downloaded​ ​from​ ​the
Hospitality​ ​Survey​ ​EMS​ ​server.​ ​Each​ ​question​ ​is​ ​assigned​ ​to​ ​a​ ​TFrame​ ​which​ ​displays​ ​that​ ​type
of​ ​question.

Architecture:
The​ ​architecture​ ​of​ ​the​ ​app​ ​is​ ​built​ ​in​ ​a​ ​rapid​ ​application​ ​development​ ​style​ ​using​ ​TTabControl
for​ ​handling​ ​pages​ ​and​ ​individual​ ​frames​ ​for​ ​each​ ​page.​ ​TActionList​ ​is​ ​used​ ​to​ ​consolidate​ ​much
of​ ​the​ ​code​ ​in​ ​the​ ​MainForm.

Forms:
uMainForm.pas​ ​-​ ​Contains​ ​the​ ​main​ ​form​ ​of​ ​the​ ​application​ ​including​ ​the​ ​TTabControl​ ​with​ ​the
design​ ​time​ ​frames.
uTenantListForm.pas​ ​-​ ​Contains​ ​a​ ​separate​ ​form​ ​for​ ​selecting​ ​the​ ​active​ ​Tenant​ ​ID.

DataModules:
uTenantsDM.pas​ ​-​ ​Contains​ ​the​ ​non​ ​visual​ ​components​ ​for​ ​downloading​ ​the​ ​Tenant​ ​list.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Design​ ​Time​ ​Frames:
uStoreLoginFrame.pas​ ​-​ ​Contains​ ​the​ ​store​ ​login​ ​frame.
uLoginFrame.pas​ ​-​ ​Contains​ ​the​ ​user​ ​login​ ​frame.
uMenuFrame.pas​ ​-​ ​Contains​ ​the​ ​main​ ​menu​ ​of​ ​the​ ​application​ ​including​ ​the​ ​Take​ ​Survey​ ​button.
uFinishFrame.pas​ ​-​ ​Contains​ ​the​ ​final​ ​frame​ ​of​ ​the​ ​application​ ​including​ ​the​ ​Thank​ ​You​ ​button
after​ ​a​ ​survey​ ​has​ ​been​ ​completed.
uBackendFrame.pas​ ​-​ ​Contains​ ​the​ ​non-visual​ ​components​ ​for​ ​downloading​ ​survey​ ​data​ ​and
uploading​ ​the​ ​results.
uProgressFrame.pas​ ​-​ ​Contains​ ​the​ ​animated​ ​progress​ ​controls​ ​which​ ​are​ ​displayed​ ​when​ ​the
application​ ​is​ ​doing​ ​work.

Dynamic​ ​Frames:
uComboBoxFrame.pas​ ​-​ ​Contains​ ​the​ ​combo​ ​box​ ​survey​ ​question​ ​type.
uCompleteFrame.pas​ ​-​ ​Contains​ ​the​ ​complete​ ​button​ ​for​ ​the​ ​survey.
uEditFrame.pas​ ​-​ ​Contains​ ​the​ ​edit​ ​survey​ ​question​ ​type.
uRatingBarFrame.pas​ ​-​ ​Contains​ ​the​ ​star​ ​rating​ ​track​ ​bar​ ​survey​ ​question​ ​type.
uSurveyHeaderFrame.pas​ ​-​ ​Contains​ ​the​ ​header​ ​for​ ​the​ ​top​ ​of​ ​the​ ​survey.
uYesNoFrame.pas​ ​-​ ​Contains​ ​the​ ​Yes/No​ ​survey​ ​question​ ​type.

If​ ​you​ ​want​ ​to​ ​make​ ​changes​ ​to​ ​the​ ​design​ ​time​ ​frames​ ​be​ ​sure​ ​to​ ​edit​ ​the​ ​frame​ ​itself​ ​and​ ​not
the​ ​version​ ​of​ ​it​ ​that​ ​is​ ​embedded​ ​in​ ​the​ ​MainForm.​ ​This​ ​will​ ​keep​ ​your​ ​changes​ ​consolidated​ ​in
one​ ​place.​ ​If​ ​you​ ​changes​ ​don't​ ​update​ ​in​ ​the​ ​MainForm​ ​you​ ​can​ ​delete​ ​the​ ​Frame​ ​from​ ​the
MainForm​ ​and​ ​re-add​ ​it.​ ​Be​ ​sure​ ​to​ ​add​ ​it​ ​to​ ​the​ ​correct​ ​Tab​ ​and​ ​set​ ​to​ ​Align​ ​Client​ ​after​ ​you​ ​add
the​ ​frame.

Credits:
Restaurant​ ​Image
http://www.freeimages.com/photo/restaurant-1233046
http://www.freeimages.com/search/restaurant

Store​ ​Login​ ​Frame:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Note:​​ ​You​ ​must​ ​log​ ​in​ ​with​ ​your​ ​Tenant​ ​ID​ ​as​ ​the​ ​Store​ ​ID​ ​and​ ​not​ ​the​ ​Tenant​ ​Name.

User​ ​Login​ ​Frame:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Main​ ​Menu​ ​Frame:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Dynamic​ ​Survey​ ​Tab:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Finish​ ​Survey​ ​Form:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Hospitality​ ​Survey​ ​Admin
You​ ​should​ ​be​ ​able​ ​to​ ​log​ ​into​ ​the​ ​Admin​ ​area​ ​using​ ​a​ ​Tenant​ ​ID​ ​and​ ​Tenant​ ​Secret​ ​plus​ ​the
login​ ​and​ ​password​ ​for​ ​a​ ​user​ ​in​ ​the​ ​Managers​ ​Group.​ ​For​ ​this​ ​template​ ​the​ ​default​ ​user​ ​is
Manager1.

Note:​​ ​You​ ​must​ ​log​ ​in​ ​with​ ​your​ ​Tenant​ ​ID​ ​as​ ​the​ ​Store​ ​ID​ ​and​ ​not​ ​the​ ​Tenant​ ​Name.

Installation:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Copy​ ​index.html​ ​and​ ​the​ ​img,​ ​js,​ ​and​ ​styles​ ​subdirectories​ ​to​ ​your​ ​web​ ​server.​ ​Optimally​ ​you
should​ ​place​ ​them​ ​on​ ​the​ ​same​ ​web​ ​server​ ​as​ ​your​ ​RAD​ ​Server​ ​DLL​ ​or​ ​Shared​ ​Object​ ​file.​ ​They
could​ ​be​ ​placed​ ​in​ ​an​ ​admin​ ​subdirectory.​ ​You​ ​can​ ​place​ ​them​ ​on​ ​a​ ​different​ ​web​ ​server​ ​than
RAD​ ​Server​ ​but​ ​you​ ​will​ ​need​ ​to​ ​make​ ​sure​ ​that​ ​your​ ​CORS​ ​Access-Control-Allow-Origin​ ​is​ ​set
up​ ​correctly.

Within​ ​the​ ​js/admin.js​ ​file​ ​you​ ​should​ ​configure​ ​the​ ​$scope.ServerURL​ ​variable​ ​to​ ​point​ ​to​ ​the
host​ ​where​ ​you​ ​RAD​ ​Server​ ​install​ ​is​ ​located.​ ​The​ ​default​ ​is:​ ​http://localhost:8080/

CORS​ ​Accept​ ​permissions:

Within​ ​the​ ​js/admin.js​ ​file​ ​you​ ​can​ ​configure​ ​the​ ​CORS​ ​settings​ ​for​ ​dev​ ​and​ ​live​ ​versions​ ​within
the​ ​$scope.getHeader​ ​function.​ ​By​ ​default​ ​it​ ​is​ ​setup​ ​for​ ​development.​ ​When​ ​you​ ​want​ ​to​ ​switch
to​ ​the​ ​live​ ​version​ ​(and​ ​enable​ ​user​ ​permissions)​ ​you​ ​can​ ​uncomment​ ​the​ ​line​ ​containing​ ​the
X-Embarcadero-Session-Token​ ​and​ ​comment​ ​out​ ​the​ ​line​ ​without​ ​it.​ ​Switch​ ​back​ ​and​ ​forth
between​ ​the​ ​two​ ​as​ ​needed.

There​ ​is​ ​a​ ​similar​ ​setting​ ​in​ ​the​ ​Hospitality​ ​Survey​ ​EMS​ ​server​ ​for​ ​configuring​ ​permissions​ ​for
dev​ ​or​ ​live.

REST​ ​Endpoints​ ​&​ ​FireDAC

The​ ​Hospitality​ ​Survey​ ​EMS​ ​endpoint​ ​returns​ ​FireDAC​ ​tables​ ​as​ ​JSON.​ ​This​ ​allows
interchangable​ ​compatibility​ ​between​ ​RAD​ ​Studio​ ​and​ ​clients​ ​like​ ​AngularJS.​ ​Here​ ​is​ ​an
example​ ​of​ ​walking​ ​through​ ​the​ ​FireDAC​ ​table​ ​JSON​ ​tree​ ​to​ ​get​ ​to​ ​the​ ​records:
data["FDBS"]["Manager"]["TableList"][0]["RowList"]

Admin​ ​Dashboard:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.


Admin​ ​Surveys:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2017​ ​Embarcadero​ ​Technologies,​ ​Inc.

Potrebbero piacerti anche