Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KGOrders
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cam Hayes
KGOrders
Commits
f1a2333b
Commit
f1a2333b
authored
Dec 16, 2024
by
Elias Sarraf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up code
parent
3ff5c8d6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
135 additions
and
505 deletions
+135
-505
.gitignore
.gitignore
+1
-1
View.Orders.pas
kgOrdersClient/View.Orders.pas
+17
-7
webKGOrders.dpr
kgOrdersClient/webKGOrders.dpr
+1
-1
Api.Database.dfm
kgOrdersServer/Source/Api.Database.dfm
+1
-1
Api.Database.pas
kgOrdersServer/Source/Api.Database.pas
+15
-59
Api.Server.Module.dfm
kgOrdersServer/Source/Api.Server.Module.dfm
+0
-2
Auth.Database.pas
kgOrdersServer/Source/Auth.Database.pas
+6
-52
Auth.Server.Module.dfm
kgOrdersServer/Source/Auth.Server.Module.dfm
+0
-1
Data.pas
kgOrdersServer/Source/Data.pas
+4
-4
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+0
-0
Main.pas
kgOrdersServer/Source/Main.pas
+22
-5
rOrders.dfm
kgOrdersServer/Source/rOrders.dfm
+1
-106
rOrders.pas
kgOrdersServer/Source/rOrders.pas
+11
-11
uLibrary.pas
kgOrdersServer/Source/uLibrary.pas
+26
-228
kgOrdersServer.dpr
kgOrdersServer/kgOrdersServer.dpr
+24
-22
kgOrdersServer.dproj
kgOrdersServer/kgOrdersServer.dproj
+2
-2
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+4
-3
No files found.
.gitignore
View file @
f1a2333b
...
@@ -7,9 +7,9 @@ kgOrdersClient/css/__history/
...
@@ -7,9 +7,9 @@ kgOrdersClient/css/__history/
kgOrdersClient/config/__history/
kgOrdersClient/config/__history/
kgOrdersServer/__history
kgOrdersServer/__history
kgOrdersServer/__recovery
kgOrdersServer/__recovery
kgOrdersServer/*.log
kgOrdersServer/*.txt
kgOrdersServer/*.txt
kgOrdersServer/doc/
kgOrdersServer/doc/
kgOrdersServer/logs
kgOrdersServer/Win32/
kgOrdersServer/Win32/
kgOrdersServer/Source/__history/
kgOrdersServer/Source/__history/
kgOrdersServer/Source/__recovery/
kgOrdersServer/Source/__recovery/
...
...
kgOrdersClient/View.Orders.pas
View file @
f1a2333b
...
@@ -78,7 +78,7 @@ type
...
@@ -78,7 +78,7 @@ type
procedure
orderEntry
(
orderInfo
,
customerInfo
,
mode
:
string
);
procedure
orderEntry
(
orderInfo
,
customerInfo
,
mode
:
string
);
procedure
HideNotification
();
procedure
HideNotification
();
procedure
ShowNotification
(
Notification
:
string
);
procedure
ShowNotification
(
Notification
:
string
);
procedure
Show
OrderList
Form
();
procedure
Show
AddOrder
Form
();
[
async
]
procedure
Search
(
searchOptions
:
string
);
[
async
]
procedure
Search
(
searchOptions
:
string
);
[
async
]
procedure
GetOrders
(
searchOptions
:
string
);
[
async
]
procedure
GetOrders
(
searchOptions
:
string
);
[
async
]
procedure
getUser
();
[
async
]
procedure
getUser
();
...
@@ -126,7 +126,6 @@ begin
...
@@ -126,7 +126,6 @@ begin
end
;
end
;
procedure
TFViewOrders
.
WebFormCreate
(
Sender
:
TObject
);
procedure
TFViewOrders
.
WebFormCreate
(
Sender
:
TObject
);
// Initializes important values:
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
...
@@ -145,6 +144,7 @@ begin
...
@@ -145,6 +144,7 @@ begin
getOrders
(
GenerateSearchOptions
());
getOrders
(
GenerateSearchOptions
());
end
;
end
;
procedure
TFViewOrders
.
WebFormShow
(
Sender
:
TObject
);
procedure
TFViewOrders
.
WebFormShow
(
Sender
:
TObject
);
begin
begin
console
.
log
(
info
);
console
.
log
(
info
);
...
@@ -154,6 +154,7 @@ begin
...
@@ -154,6 +154,7 @@ begin
HideNotification
();
HideNotification
();
end
;
end
;
procedure
TFViewOrders
.
getUser
();
procedure
TFViewOrders
.
getUser
();
var
var
xdcResponse
:
TXDataClientResponse
;
xdcResponse
:
TXDataClientResponse
;
...
@@ -167,6 +168,7 @@ begin
...
@@ -167,6 +168,7 @@ begin
user
:=
TJSObject
(
data
[
0
]);
user
:=
TJSObject
(
data
[
0
]);
end
;
end
;
class
function
TFViewOrders
.
CreateForm
(
AElementID
,
Info
:
string
):
TWebForm
;
class
function
TFViewOrders
.
CreateForm
(
AElementID
,
Info
:
string
):
TWebForm
;
var
var
localInfo
:
string
;
localInfo
:
string
;
...
@@ -184,7 +186,7 @@ begin
...
@@ -184,7 +186,7 @@ begin
end
;
end
;
procedure
TFViewOrders
.
Show
OrderList
Form
();
procedure
TFViewOrders
.
Show
AddOrder
Form
();
var
var
newform
:
TFAddOrder
;
newform
:
TFAddOrder
;
begin
begin
...
@@ -208,8 +210,6 @@ begin
...
@@ -208,8 +210,6 @@ begin
end
;
end
;
procedure
TFViewOrders
.
GeneratePagination
(
TotalPages
:
Integer
);
procedure
TFViewOrders
.
GeneratePagination
(
TotalPages
:
Integer
);
// Generates pagination for the table.
// Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search
// TotalPages: Total amount of pages generated by the search
...
@@ -440,14 +440,16 @@ end;
...
@@ -440,14 +440,16 @@ end;
procedure
TFViewOrders
.
btnAddOrderClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnAddOrderClick
(
Sender
:
TObject
);
begin
begin
Show
OrderList
Form
();
Show
AddOrder
Form
();
end
;
end
;
procedure
TFViewOrders
.
orderEntry
(
orderInfo
,
customerInfo
,
mode
:
string
);
procedure
TFViewOrders
.
orderEntry
(
orderInfo
,
customerInfo
,
mode
:
string
);
begin
begin
FViewMain
.
ViewOrderEntry
(
orderInfo
,
customerInfo
,
mode
);
FViewMain
.
ViewOrderEntry
(
orderInfo
,
customerInfo
,
mode
);
end
;
end
;
procedure
TFViewOrders
.
btnApplyClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnApplyClick
(
Sender
:
TObject
);
// Button that effectively functions as a GetOrders() button
// Button that effectively functions as a GetOrders() button
var
var
...
@@ -465,16 +467,19 @@ begin
...
@@ -465,16 +467,19 @@ begin
GetOrders
(
searchOptions
);
GetOrders
(
searchOptions
);
end
;
end
;
procedure
TFViewOrders
.
btnCloseNotificationClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnCloseNotificationClick
(
Sender
:
TObject
);
begin
begin
HideNotification
();
HideNotification
();
end
;
end
;
procedure
TFViewOrders
.
btnConfirmClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnConfirmClick
(
Sender
:
TObject
);
begin
begin
//orderEntry('', 'ADD');
//orderEntry('', 'ADD');
end
;
end
;
procedure
TFViewOrders
.
btnFiltersClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnFiltersClick
(
Sender
:
TObject
);
var
var
filterSection
:
TJSHTMLElement
;
filterSection
:
TJSHTMLElement
;
...
@@ -495,6 +500,7 @@ begin
...
@@ -495,6 +500,7 @@ begin
end
;
end
;
end
;
end
;
procedure
TFViewOrders
.
Search
(
searchOptions
:
string
);
procedure
TFViewOrders
.
Search
(
searchOptions
:
string
);
// Search method that searches the database for a specific phone number
// Search method that searches the database for a specific phone number
var
var
...
@@ -525,12 +531,14 @@ begin
...
@@ -525,12 +531,14 @@ begin
end
;
end
;
end
;
end
;
procedure
TFViewOrders
.
btnSearchClick
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btnSearchClick
(
Sender
:
TObject
);
// orders Search method
// orders Search method
begin
begin
Search
(
edtSearch
.
Text
);
Search
(
edtSearch
.
Text
);
end
;
end
;
procedure
TFViewOrders
.
ClearTable
();
procedure
TFViewOrders
.
ClearTable
();
// clears the table
// clears the table
var
var
...
@@ -540,6 +548,7 @@ begin
...
@@ -540,6 +548,7 @@ begin
tbody
.
innerHTML
:=
''
;
tbody
.
innerHTML
:=
''
;
end
;
end
;
function
TFViewOrders
.
GenerateSearchOptions
():
string
;
function
TFViewOrders
.
GenerateSearchOptions
():
string
;
// Generates searchOptions for GetOrders.
// Generates searchOptions for GetOrders.
var
var
...
@@ -561,12 +570,14 @@ begin
...
@@ -561,12 +570,14 @@ begin
Result
:=
searchOptions
;
Result
:=
searchOptions
;
end
;
end
;
procedure
TFViewOrders
.
HideNotification
;
procedure
TFViewOrders
.
HideNotification
;
begin
begin
pnlMessage
.
ElementHandle
.
hidden
:=
True
;
pnlMessage
.
ElementHandle
.
hidden
:=
True
;
info
:=
''
;
info
:=
''
;
end
;
end
;
procedure
TFViewOrders
.
ShowNotification
(
Notification
:
string
);
procedure
TFViewOrders
.
ShowNotification
(
Notification
:
string
);
begin
begin
if
Notification
<>
''
then
if
Notification
<>
''
then
...
@@ -597,5 +608,4 @@ begin
...
@@ -597,5 +608,4 @@ begin
end
;
end
;
end
.
end
.
kgOrdersClient/webKGOrders.dpr
View file @
f1a2333b
...
@@ -67,5 +67,5 @@ begin
...
@@ -67,5 +67,5 @@ begin
Application.MainFormOnTaskbar := True;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection);
Application.CreateForm(TDMConnection, DMConnection);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
//
Application.Run;
Application.Run;
end.
end.
kgOrdersServer/Source/
KGOrders
.Database.dfm
→
kgOrdersServer/Source/
Api
.Database.dfm
View file @
f1a2333b
object
KGOrdersDatabase: TKGOrders
Database
object
ApiDatabase: TApi
Database
OnCreate = DataModuleCreate
OnCreate = DataModuleCreate
Height = 358
Height = 358
Width = 519
Width = 519
...
...
kgOrdersServer/Source/
KGOrders
.Database.pas
→
kgOrdersServer/Source/
Api
.Database.pas
View file @
f1a2333b
// Where the database is kept. Only used by Lookup.ServiceImpl to retrieve info
// Where the database is kept. Only used by Lookup.ServiceImpl to retrieve info
// from the data base and send it to the client.
// from the data base and send it to the client.
// Author: ???
// Author: ???
unit
KGOrders
.
Database
;
unit
Api
.
Database
;
interface
interface
...
@@ -11,7 +11,7 @@ uses
...
@@ -11,7 +11,7 @@ uses
Common
.
Logging
,
Vcl
.
Forms
,
MySQLUniProvider
;
Common
.
Logging
,
Vcl
.
Forms
,
MySQLUniProvider
;
type
type
T
KGOrders
Database
=
class
(
TDataModule
)
T
Api
Database
=
class
(
TDataModule
)
ucKG
:
TUniConnection
;
ucKG
:
TUniConnection
;
UniQuery1
:
TUniQuery
;
UniQuery1
:
TUniQuery
;
MySQLUniProvider1
:
TMySQLUniProvider
;
MySQLUniProvider1
:
TMySQLUniProvider
;
...
@@ -113,79 +113,35 @@ type
...
@@ -113,79 +113,35 @@ type
end
;
end
;
var
var
KGOrdersDatabase
:
TKGOrders
Database
;
ApiDatabase
:
TApi
Database
;
implementation
implementation
uses
uLibrary
;
{%CLASSGROUP 'Vcl.Controls.TControl'}
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
{$R *.dfm}
procedure
TKGOrdersDatabase
.
DataModuleCreate
(
Sender
:
TObject
);
procedure
TApiDatabase
.
DataModuleCreate
(
Sender
:
TObject
);
var
iniFile
:
TIniFile
;
iniStr
:
string
;
begin
begin
Logger
.
Log
(
5
,
'TKGOrders
Database.DataModuleCreate'
);
Logger
.
Log
(
3
,
'TApi
Database.DataModuleCreate'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
LoadDatabaseSettings
(
ucKG
,
'kgOrdersServer.ini'
);
try
try
Logger
.
Log
(
5
,
'--iniFile entries:'
);
ucKG
.
Connect
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
except
if
iniStr
.
IsEmpty
then
on
E
:
Exception
do
Logger
.
Log
(
5
,
'----Database->Server: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Server: '
+
iniStr
);
ucKG
.
Server
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Database: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Database: '
+
iniStr
);
ucKG
.
Database
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Username: Entry not found'
)
else
begin
begin
Logger
.
Log
(
5
,
'----Database->Username: '
+
iniStr
);
Logger
.
Log
(
3
,
'--TApiDatabase.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
ucKG
.
Username
:=
iniStr
;
end
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Password: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Password: xxxxxxxx'
);
ucKG
.
Password
:=
iniStr
;
end
;
try
ucKG
.
Connect
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
3
,
'--TKGOrdersDatabase.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
end
;
end
;
Logger
.
Log
(
1
,
''
);
finally
iniFile
.
Free
;
end
;
end
;
end
;
end
;
class
procedure
T
KGOrders
Database
.
ExecSQL
(
const
SQL
:
string
);
class
procedure
T
Api
Database
.
ExecSQL
(
const
SQL
:
string
);
var
var
DB
:
T
KGOrders
Database
;
DB
:
T
Api
Database
;
begin
begin
DB
:=
T
KGOrders
Database
.
Create
(
nil
);
DB
:=
T
Api
Database
.
Create
(
nil
);
try
try
DB
.
UniQuery1
.
SQL
.
Text
:=
SQL
;
DB
.
UniQuery1
.
SQL
.
Text
:=
SQL
;
DB
.
UniQuery1
.
ExecSQL
;
DB
.
UniQuery1
.
ExecSQL
;
...
...
kgOrdersServer/Source/Api.Server.Module.dfm
View file @
f1a2333b
...
@@ -2,12 +2,10 @@ object ApiServerModule: TApiServerModule
...
@@ -2,12 +2,10 @@ object ApiServerModule: TApiServerModule
Height = 273
Height = 273
Width = 230
Width = 230
object SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher
object SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher
Active = True
Left = 86
Left = 86
Top = 30
Top = 30
end
end
object XDataServer: TXDataServer
object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/kgOrders/api/'
Dispatcher = SparkleHttpSysDispatcher
Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Api'
ModelName = 'Api'
EntitySetPermissions = <>
EntitySetPermissions = <>
...
...
kgOrdersServer/Source/Auth.Database.pas
View file @
f1a2333b
...
@@ -38,62 +38,16 @@ uses
...
@@ -38,62 +38,16 @@ uses
{$R *.dfm}
{$R *.dfm}
procedure
TAuthDatabase
.
DataModuleCreate
(
Sender
:
TObject
);
procedure
TAuthDatabase
.
DataModuleCreate
(
Sender
:
TObject
);
var
iniFile
:
TIniFile
;
iniStr
:
string
;
begin
begin
Logger
.
Log
(
5
,
'TAuthDatabase.DataModuleCreate'
);
Logger
.
Log
(
3
,
'TAuthDatabase.DataModuleCreate'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
LoadDatabaseSettings
(
ucKG
,
'kgOrdersServer.ini'
);
try
try
Logger
.
Log
(
5
,
'--iniFile entries:'
);
ucKG
.
Connect
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
except
if
iniStr
.
IsEmpty
then
on
E
:
Exception
do
Logger
.
Log
(
5
,
'----Database->Server: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Server: '
+
iniStr
);
ucKG
.
Server
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Database: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Database: '
+
iniStr
);
ucKG
.
Database
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Username: Entry not found'
)
else
begin
begin
Logger
.
Log
(
5
,
'----Database->Username: '
+
iniStr
);
Logger
.
Log
(
3
,
'--TAuthDatabase.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
ucKG
.
Username
:=
iniStr
;
end
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Password: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Password: xxxxxxxx'
);
ucKG
.
Password
:=
iniStr
;
end
;
try
ucKG
.
Connect
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
3
,
'--TAuthDatabase.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
end
;
end
;
Logger
.
Log
(
1
,
''
);
finally
iniFile
.
Free
;
end
;
end
;
end
;
end
;
...
...
kgOrdersServer/Source/Auth.Server.Module.dfm
View file @
f1a2333b
...
@@ -6,7 +6,6 @@ object AuthServerModule: TAuthServerModule
...
@@ -6,7 +6,6 @@ object AuthServerModule: TAuthServerModule
Top = 16
Top = 16
end
end
object XDataServer: TXDataServer
object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/kgOrders/auth/'
Dispatcher = SparkleHttpSysDispatcher
Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Auth'
ModelName = 'Auth'
EntitySetPermissions = <>
EntitySetPermissions = <>
...
...
kgOrdersServer/Source/Data.pas
View file @
f1a2333b
...
@@ -14,7 +14,7 @@ uses
...
@@ -14,7 +14,7 @@ uses
BaseGrid
,
AdvGrid
,
DBAdvGrid
,
MemDS
,
DBAccess
,
Uni
,
Vcl
.
StdCtrls
,
Vcl
.
Mask
,
BaseGrid
,
AdvGrid
,
DBAdvGrid
,
MemDS
,
DBAccess
,
Uni
,
Vcl
.
StdCtrls
,
Vcl
.
Mask
,
vcl
.
wwdbedit
,
vcl
.
wwdotdot
,
vcl
.
wwdbcomb
,
REST
.
Client
,
REST
.
Types
,
System
.
JSON
,
vcl
.
wwdbedit
,
vcl
.
wwdotdot
,
vcl
.
wwdbcomb
,
REST
.
Client
,
REST
.
Types
,
System
.
JSON
,
System
.
Generics
.
Collections
,
AdvEdit
,
vcl
.
wwdblook
,
vcl
.
wwdbdatetimepicker
,
System
.
Generics
.
Collections
,
AdvEdit
,
vcl
.
wwdblook
,
vcl
.
wwdbdatetimepicker
,
System
.
Hash
;
System
.
Hash
,
Api
.
Database
;
type
type
TFData
=
class
(
TForm
)
TFData
=
class
(
TForm
)
...
@@ -39,6 +39,7 @@ type
...
@@ -39,6 +39,7 @@ type
procedure
btnFindClick
(
Sender
:
TObject
);
procedure
btnFindClick
(
Sender
:
TObject
);
procedure
btnPDFClick
(
Sender
:
TObject
);
procedure
btnPDFClick
(
Sender
:
TObject
);
private
private
kgDB
:
TApiDatabase
;
accountSID
:
string
;
accountSID
:
string
;
authHeader
:
string
;
authHeader
:
string
;
public
public
...
@@ -52,7 +53,7 @@ implementation
...
@@ -52,7 +53,7 @@ implementation
{$R *.dfm}
{$R *.dfm}
uses
KGOrders
.
Database
,
uLibrary
,
rOrders
;
uses
uLibrary
,
rOrders
;
procedure
TFData
.
btnPDFClick
(
Sender
:
TObject
);
procedure
TFData
.
btnPDFClick
(
Sender
:
TObject
);
begin
begin
...
@@ -62,7 +63,7 @@ end;
...
@@ -62,7 +63,7 @@ end;
procedure
TFData
.
FormCreate
(
Sender
:
TObject
);
procedure
TFData
.
FormCreate
(
Sender
:
TObject
);
begin
begin
KGOrdersDatabase
:=
TKGOrders
Database
.
Create
(
Self
);
kgDB
:=
TApi
Database
.
Create
(
Self
);
end
;
end
;
procedure
TFData
.
btnFindClick
(
Sender
:
TObject
);
procedure
TFData
.
btnFindClick
(
Sender
:
TObject
);
...
@@ -108,5 +109,4 @@ begin
...
@@ -108,5 +109,4 @@ begin
end
;
end
;
end
.
end
.
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
f1a2333b
This diff is collapsed.
Click to expand it.
kgOrdersServer/Source/Main.pas
View file @
f1a2333b
...
@@ -41,7 +41,7 @@ uses
...
@@ -41,7 +41,7 @@ uses
Common
.
Logging
,
Common
.
Logging
,
Common
.
Config
,
Common
.
Config
,
Sparkle
.
Utils
,
Sparkle
.
Utils
,
KGOrders
.
Database
,
Api
.
Database
,
Data
;
Data
;
{$R *.dfm}
{$R *.dfm}
...
@@ -110,7 +110,7 @@ begin
...
@@ -110,7 +110,7 @@ begin
try
try
Logger
.
Log
(
1
,
'iniFile: '
+
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
Logger
.
Log
(
1
,
'iniFile: '
+
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
Logger
.
Log
(
1
,
'LogLevels are displayed here. They were set in kgOrders.dpr, it executes first'
);
Logger
.
Log
(
1
,
'LogLevels are displayed here. They were set in kgOrders
Server
.dpr, it executes first'
);
iniStr
:=
iniFile
.
ReadString
(
'Settings'
,
'MemoLogLevel'
,
''
);
iniStr
:=
iniFile
.
ReadString
(
'Settings'
,
'MemoLogLevel'
,
''
);
if
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'--Settings->memoLogLevel: Entry not found - default: 3'
)
Logger
.
Log
(
1
,
'--Settings->memoLogLevel: Entry not found - default: 3'
)
...
@@ -130,11 +130,29 @@ begin
...
@@ -130,11 +130,29 @@ begin
else
else
Logger
.
Log
(
1
,
'--Settings->LogFileNum: '
+
IntToStr
(
StrToInt
(
iniStr
)
-
1
)
);
Logger
.
Log
(
1
,
'--Settings->LogFileNum: '
+
IntToStr
(
StrToInt
(
iniStr
)
-
1
)
);
Logger
.
Log
(
1
,
''
);
iniStr
:=
IniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
iniStr
:=
IniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
if
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'--Database->Server: Entry not found'
)
Logger
.
Log
(
1
,
'--Database->Server: Entry not found'
)
else
else
Logger
.
Log
(
1
,
'--Database->Server: '
+
iniStr
);
Logger
.
Log
(
1
,
'--Database->Server: '
+
iniStr
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'----Database->Database: Entry not found'
)
else
Logger
.
Log
(
1
,
'----Database->Database: '
+
iniStr
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'----Database->Username: Entry not found'
)
else
Logger
.
Log
(
1
,
'----Database->Username: '
+
iniStr
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'----Database->Password: Entry not found'
)
else
Logger
.
Log
(
1
,
'----Database->Password: xxxxxxxx'
);
Logger
.
Log
(
1
,
''
);
Logger
.
Log
(
1
,
''
);
finally
finally
...
@@ -149,6 +167,8 @@ begin
...
@@ -149,6 +167,8 @@ begin
AppServerModule
:=
TAppServerModule
.
Create
(
Self
);
AppServerModule
:=
TAppServerModule
.
Create
(
Self
);
AppServerModule
.
StartAppServer
(
serverConfig
.
url
);
AppServerModule
.
StartAppServer
(
serverConfig
.
url
);
UpdateGUI
;
end
;
end
;
procedure
TFMain
.
FormClose
(
Sender
:
TObject
;
var
Action
:
TCloseAction
);
procedure
TFMain
.
FormClose
(
Sender
:
TObject
;
var
Action
:
TCloseAction
);
...
@@ -160,9 +180,6 @@ begin
...
@@ -160,9 +180,6 @@ begin
end
;
end
;
procedure
TFMain
.
UpdateGUI
;
procedure
TFMain
.
UpdateGUI
;
const
cHttp
=
'http://+'
;
cHttpLocalhost
=
'http://localhost'
;
begin
begin
if
AuthServerModule
.
SparkleHttpSysDispatcher
.
Active
then
if
AuthServerModule
.
SparkleHttpSysDispatcher
.
Active
then
memoInfo
.
Lines
.
Add
(
'AuthServer started at: '
+
AuthServerModule
.
XDataServer
.
BaseUrl
)
memoInfo
.
Lines
.
Add
(
'AuthServer started at: '
+
AuthServerModule
.
XDataServer
.
BaseUrl
)
...
...
kgOrdersServer/Source/rOrders.dfm
View file @
f1a2333b
...
@@ -3,7 +3,7 @@ object rptOrders: TrptOrders
...
@@ -3,7 +3,7 @@ object rptOrders: TrptOrders
Height = 480
Height = 480
Width = 640
Width = 640
object frxOrders: TfrxReport
object frxOrders: TfrxReport
Version = '202
4.2.1
'
Version = '202
5.1.3
'
DotMatrixReport = False
DotMatrixReport = False
IniFile = '\Software\Fast Reports'
IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
...
@@ -1212,7 +1212,6 @@ object rptOrders: TrptOrders
...
@@ -1212,7 +1212,6 @@ object rptOrders: TrptOrders
Database = 'kg_order_entry'
Database = 'kg_order_entry'
Username = 'root'
Username = 'root'
Server = '192.168.102.130'
Server = '192.168.102.130'
Connected = True
LoginPrompt = False
LoginPrompt = False
Left = 289
Left = 289
Top = 99
Top = 99
...
@@ -1242,7 +1241,6 @@ object rptOrders: TrptOrders
...
@@ -1242,7 +1241,6 @@ object rptOrders: TrptOrders
' 3 AS COLORS'
' 3 AS COLORS'
'FROM DUAL'
'FROM DUAL'
'')
'')
Active = True
Left = 415
Left = 415
Top = 136
Top = 136
end
end
...
@@ -1258,108 +1256,5 @@ object rptOrders: TrptOrders
...
@@ -1258,108 +1256,5 @@ object rptOrders: TrptOrders
DataSetOptions = []
DataSetOptions = []
Left = 424
Left = 424
Top = 224
Top = 224
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'COMPANY_ID'
end
item
FieldName = 'USER_ID'
end
item
FieldName = 'ORDER_DATE'
FieldType = fftString
end
item
FieldName = 'START_DATE'
FieldType = fftDateTime
end
item
FieldName = 'END_DATE'
FieldType = fftDateTime
end
item
FieldName = 'ORDER_STATUS'
FieldType = fftString
end
item
FieldName = 'SCHED_JSON'
FieldType = fftString
Size = 4096
end
item
FieldName = 'LOCATION'
FieldType = fftString
end
item
FieldName = 'JOB_NAME'
FieldType = fftString
Size = 15
end
item
FieldName = 'COMPANY_NAME'
FieldType = fftString
Size = 14
end
item
FieldName = 'PROOF_DUE'
FieldType = fftString
Size = 16
end
item
FieldName = 'PROOF_DONE'
FieldType = fftString
Size = 16
end
item
FieldName = 'ART_DUE'
FieldType = fftString
end
item
FieldName = 'ART_DONE'
FieldType = fftString
Size = 16
end
item
FieldName = 'PLATE_DUE'
FieldType = fftString
Size = 16
end
item
FieldName = 'PLATE_DONE'
FieldType = fftString
Size = 16
end
item
FieldName = 'PRICE'
end
item
FieldName = 'QB_REF_NUM'
end
item
FieldName = 'MOUNT_DUE'
FieldType = fftString
Size = 16
end
item
FieldName = 'MOUNT_DONE'
FieldType = fftString
Size = 16
end
item
FieldName = 'SHIP_DUE'
FieldType = fftString
Size = 16
end
item
FieldName = 'SHIP_DONE'
FieldType = fftString
Size = 16
end
item
FieldName = 'COLORS'
end>
end
end
end
end
kgOrdersServer/Source/rOrders.pas
View file @
f1a2333b
...
@@ -16,6 +16,7 @@ type
...
@@ -16,6 +16,7 @@ type
frxReportTableObject1
:
TfrxReportTableObject
;
frxReportTableObject1
:
TfrxReportTableObject
;
frxDBOrders
:
TfrxDBDataset
;
frxDBOrders
:
TfrxDBDataset
;
procedure
DataModuleCreate
(
Sender
:
TObject
);
procedure
DataModuleCreate
(
Sender
:
TObject
);
private
private
public
public
...
@@ -29,21 +30,24 @@ var
...
@@ -29,21 +30,24 @@ var
implementation
implementation
uses
uLibrary
;
{%CLASSGROUP 'Vcl.Controls.TControl'}
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
{$R *.dfm}
procedure
TrptOrders
.
DataModuleCreate
(
Sender
:
TObject
);
procedure
TrptOrders
.
DataModuleCreate
(
Sender
:
TObject
);
var
iniFile
:
TIniFile
;
begin
begin
// Load database connection settings from INI file
Logger
.
Log
(
3
,
'TAuthDatabase.DataModuleCreate'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
LoadDatabaseSettings
(
ucKG
,
'kgOrdersServer.ini'
);
try
try
ucKG
.
Server
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
ucKG
.
Connect
;
ucKG
.
Connect
;
finally
except
iniFile
.
Free
;
on
E
:
Exception
do
begin
Logger
.
Log
(
3
,
'--TrptOrders.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
end
;
end
;
end
;
end
;
end
;
...
@@ -103,9 +107,5 @@ begin
...
@@ -103,9 +107,5 @@ begin
end
;
end
;
end
.
end
.
kgOrdersServer/Source/uLibrary.pas
View file @
f1a2333b
...
@@ -5,46 +5,43 @@ interface
...
@@ -5,46 +5,43 @@ interface
uses
uses
System
.
Classes
,
Uni
;
System
.
Classes
,
Uni
;
const
procedure
LoadDatabaseSettings
(
uc
:
TUniConnection
;
iniFilename
:
string
);
ADD_REC_AUDIT_ENTRY
=
'0'
;
EDIT_REC_AUDIT_ENTRY
=
'1'
;
DEL_REC_AUDIT_ENTRY
=
'2'
;
REVIEW_REC_AUDIT_ENTRY
=
'3'
;
VIEW_REC_AUDIT_ENTRY
=
'4'
;
FIND_REC_AUDIT_ENTRY
=
'5'
;
PRINT_REC_AUDIT_ENTRY
=
'6'
;
OTHER_REC_AUDIT_ENTRY
=
'99'
;
function
GetServerTimeStamp
(
uq
:
TUniQuery
):
TDateTime
;
procedure
DoQuery
(
uq
:
TUniQuery
;
sql
:
string
);
procedure
DoQuery
(
uq
:
TUniQuery
;
sql
:
string
);
function
CalculateAge
(
const
dob
,
dt
:
TDateTime
):
Integer
;
function
CalculateAge
(
const
dob
,
dt
:
TDateTime
):
Integer
;
function
GetNextSeqVal
(
uq
:
TUniQuery
;
sequence
:
string
):
string
;
function
FormatNamePersonnel
(
uq
:
TUniQuery
;
format
:
string
):
string
;
function
FormatBkNum
(
bkNum
:
string
):
string
;
function
GetAssociatedNumber
(
uq
:
TUniQuery
;
numberType
:
string
):
string
;
function
FormatBookingAddress
(
uq
:
TUniQuery
;
format
:
string
):
string
;
function
SetMasterAuditEntry
(
uq
:
TUniQuery
;
const
entryId
,
auditType
,
linkId
,
agency
,
personnelId
,
recUser
,
details
,
searchKey
,
execSource
:
string
):
Boolean
;
function
SetDetailAuditEntry
(
uq
:
TUniQuery
;
const
entryId
,
title
,
auditType
:
string
;
auditList
:
TStringList
):
Boolean
;
function
GetOfficerName
(
agency
,
officer
:
string
;
uq
:
TUniQuery
):
string
;
function
GetRiciOfficerName
(
agency
,
officer
:
string
;
uq
:
TUniQuery
):
string
;
implementation
implementation
uses
uses
System
.
SysUtils
,
System
.
SysUtils
,
System
.
IniFiles
,
Vcl
.
Forms
,
Data
.
DB
;
Data
.
DB
;
function
GetServerTimeStamp
(
uq
:
TUniQuery
):
TDateTime
;
procedure
LoadDatabaseSettings
(
uc
:
TUniConnection
;
iniFilename
:
string
)
;
var
var
sql
:
string
;
iniFile
:
TIniFile
;
serverDateTime
:
TDateTime
;
iniStr
:
string
;
begin
begin
sql
:=
'select sysdate as currentdatetime from dual'
;
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
iniFilename
);
try
DoQuery
(
uq
,
sql
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
serverDateTime
:=
uq
.
FieldByName
(
'CURRENTDATETIME'
).
AsDateTime
;
if
not
iniStr
.
IsEmpty
then
uq
.
Close
;
uc
.
Server
:=
iniStr
;
Result
:=
serverDateTime
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Database
:=
iniStr
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Username
:=
iniStr
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Password
:=
iniStr
;
finally
iniFile
.
Free
;
end
;
end
;
end
;
procedure
DoQuery
(
uq
:
TUniQuery
;
sql
:
string
);
procedure
DoQuery
(
uq
:
TUniQuery
;
sql
:
string
);
...
@@ -82,204 +79,5 @@ begin
...
@@ -82,204 +79,5 @@ begin
Result
:=
age
Result
:=
age
end
;
end
;
function
GetNextSeqVal
(
uq
:
TUniQuery
;
sequence
:
string
):
string
;
var
sql
:
string
;
begin
sql
:=
'select '
+
sequence
+
'.NEXTVAL as nextseqval from dual'
;
uq
.
Close
;
uq
.
SQL
.
Text
:=
sql
;
uq
.
Open
;
Result
:=
uq
.
FieldByName
(
'NEXTSEQVAL'
).
AsString
;
end
;
function
FormatNamePersonnel
(
uq
:
TUniQuery
;
format
:
string
):
string
;
var
leng
:
Integer
;
i
:
Integer
;
officerText
:
String
;
begin
leng
:=
Length
(
format
);
for
i
:=
0
to
leng
-
1
do
begin
case
format
[
i
+
1
]
of
'S'
:
officerText
:=
officerText
+
uq
.
FieldByName
(
'PF_LNAME'
).
AsString
;
'F'
:
if
not
uq
.
FieldByName
(
'PF_FNAME'
).
AsString
.
IsEmpty
then
officerText
:=
TrimRight
(
officerText
+
uq
.
FieldByName
(
'PF_FNAME'
).
AsString
)
;
'M'
:
if
not
uq
.
FieldByName
(
'PF_MI'
).
AsString
.
IsEmpty
then
officerText
:=
TrimRight
(
officerText
+
uq
.
FieldByName
(
'PF_MI'
).
AsString
);
','
:
officerText
:=
officerText
+
','
;
'.'
:
officerText
:=
officerText
+
'.'
;
' '
:
officerText
:=
officerText
+
' '
;
end
;
end
;
Result
:=
officerText
;
end
;
function
FormatBkNum
(
bkNum
:
string
):
string
;
var
bkNumStr
:
string
;
begin
bkNumStr
:=
bkNum
;
Result
:=
bkNumStr
.
Insert
(
4
,
'-'
);
end
;
function
GetAssociatedNumber
(
uq
:
TUniQuery
;
numberType
:
string
):
string
;
var
TLocateOptions
:
set
of
TLocateOption
;
begin
if
uq
.
Locate
(
'OTHER_AGENCY_CODE'
,
numberType
,
TLocateOptions
)
then
Result
:=
uq
.
FieldByName
(
'IDENTIFICATION'
).
AsString
end
;
function
FormatBookingAddress
(
uq
:
TUniQuery
;
format
:
string
):
string
;
var
addressText
:
AnsiString
;
leng
:
Integer
;
i
:
Integer
;
begin
leng
:=
Length
(
format
);
for
i
:=
0
to
leng
-
1
do
begin
case
format
[
i
+
1
]
of
'S'
:
begin
addressText
:=
addressText
+
uq
.
FieldByName
(
'STREET_NUM'
).
AsString
;
if
uq
.
FieldByName
(
'STREET_NUM_HALF'
).
AsString
=
'Y'
then
addressText
:=
addressText
+
' 1/2'
;
if
uq
.
FieldByName
(
'STREET_DIRECTION'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
uq
.
FieldByName
(
'STREET_DIRECTION'
).
AsString
;
if
uq
.
FieldByName
(
'STREET_NAME'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'STREET_NAME'
).
AsString
);
if
uq
.
FieldByName
(
'STREET_TYPE'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'STREET_TYPE'
).
AsString
);
if
uq
.
FieldByName
(
'APARTMENT_NUM'
).
AsString
<>
''
then
addressText
:=
addressText
+
' APT: '
+
TrimRight
(
uq
.
FieldByName
(
'APARTMENT_NUM'
).
AsString
);
end
;
'C'
:
if
uq
.
FieldByName
(
'CITY'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'CITY'
).
AsString
);
'T'
:
if
uq
.
FieldByName
(
'STATE'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'STATE'
).
AsString
);
'Z'
:
if
uq
.
FieldByName
(
'ZIP_CODE'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'ZIP_CODE'
).
AsString
);
'R'
:
if
uq
.
FieldByName
(
'COUNTRY'
).
AsString
<>
''
then
addressText
:=
addressText
+
' '
+
TrimRight
(
uq
.
FieldByName
(
'COUNTRY'
).
AsString
);
','
:
addressText
:=
addressText
+
','
;
'.'
:
addressText
:=
addressText
+
'.'
;
' '
:
addressText
:=
addressText
+
' '
;
end
;
end
;
Result
:=
addressText
;
end
;
function
SetMasterAuditEntry
(
uq
:
TUniQuery
;
const
entryId
,
auditType
,
linkId
,
agency
,
personnelId
,
recUser
,
details
,
searchKey
,
execSource
:
string
)
:
Boolean
;
var
sql
:
string
;
begin
sql
:=
'insert into auditmaster '
;
sql
:=
sql
+
'( AUDITMASTERID, SOURCEID, AUDITTYPE, AGENCY, PERSONNELID, RECUSER, RECDATE, DETAILS, SEARCHKEY, EXECSRC) '
;
sql
:=
sql
+
'values ('
;
sql
:=
sql
+
entryID
+
', '
;
sql
:=
sql
+
QuotedStr
(
linkID
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
auditType
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
agency
)
+
', '
;
sql
:=
sql
+
personnelid
+
', '
;
sql
:=
sql
+
QuotedStr
(
recUser
)
+
', '
;
sql
:=
sql
+
'sysdate, '
;
sql
:=
sql
+
QuotedStr
(
details
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
searchKey
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
execSource
)
+
')'
;
uq
.
Close
;
uq
.
SQL
.
Text
:=
sql
;
uq
.
Execute
;
uq
.
Close
;
Result
:=
True
;
end
;
function
SetDetailAuditEntry
(
uq
:
TUniQuery
;
const
entryId
,
title
,
auditType
:
string
;
auditList
:
TStringList
)
:
Boolean
;
var
i
:
Integer
;
sql
:
string
;
begin
for
i
:=
0
to
auditList
.
Count
-
1
do
begin
sql
:=
'insert into auditdetail values ('
;
sql
:=
sql
+
entryId
+
', '
;
sql
:=
sql
+
QuotedStr
(
auditList
.
Names
[
i
]
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
''
)
+
', '
;
sql
:=
sql
+
QuotedStr
(
auditList
.
ValueFromIndex
[
i
]
)
+
', '
;
sql
:=
sql
+
auditType
+
')'
;
uq
.
Close
;
uq
.
SQL
.
Text
:=
sql
;
uq
.
Execute
;
uq
.
Close
;
end
;
Result
:=
True
;
end
;
function
GetOfficerName
(
agency
,
officer
:
string
;
uq
:
TUniQuery
):
string
;
var
sql
:
string
;
begin
if
agency
.
IsEmpty
or
officer
.
IsEmpty
then
Exit
;
sql
:=
'select a.agency_id, p.agency, p.pf_nameid, pf_lname, pf_fname, pf_mi, pf_badge '
;
sql
:=
sql
+
'from personnel p '
;
sql
:=
sql
+
'join agencycodes a on a.agency = p.agency '
;
sql
:=
sql
+
'where a.agency_id = '
+
agency
+
' and p.pf_nameid = '
+
officer
;
uq
.
Close
;
uq
.
SQL
.
Text
:=
sql
;
uq
.
Open
;
if
uq
.
IsEmpty
then
Result
:=
agency
+
'-'
+
officer
+
': not found'
else
begin
Result
:=
uq
.
FieldByName
(
'pf_lname'
).
AsString
+
', '
+
uq
.
FieldByName
(
'pf_fname'
).
AsString
;
Result
:=
Result
+
' '
+
uq
.
FieldByName
(
'pf_mi'
).
AsString
+
' ('
+
uq
.
FieldByName
(
'pf_badge'
).
AsString
+
')'
;
end
;
end
;
function
GetRiciOfficerName
(
agency
,
officer
:
string
;
uq
:
TUniQuery
):
string
;
var
sql
:
string
;
begin
if
agency
.
IsEmpty
or
officer
.
IsEmpty
then
Exit
;
sql
:=
'select * from rici.officer@rici_link where agency = '
+
agency
+
' and empno = '
+
QuotedStr
(
officer
);
uq
.
Close
;
uq
.
SQL
.
Text
:=
sql
;
uq
.
Open
;
if
uq
.
IsEmpty
then
Result
:=
agency
+
'-'
+
officer
+
': not found'
else
Result
:=
uq
.
FieldByName
(
'surname'
).
AsString
+
', '
+
uq
.
FieldByName
(
'given1'
).
AsString
+
' ('
+
uq
.
FieldByName
(
'empno'
).
AsString
+
')'
;
end
;
end
.
end
.
kgOrdersServer/kgOrdersServer.dpr
View file @
f1a2333b
...
@@ -9,7 +9,7 @@ uses
...
@@ -9,7 +9,7 @@ uses
Api.Server.Module in 'Source\Api.Server.Module.pas' {ApiServerModule: TDataModule},
Api.Server.Module in 'Source\Api.Server.Module.pas' {ApiServerModule: TDataModule},
Main in 'Source\Main.pas' {FMain},
Main in 'Source\Main.pas' {FMain},
Common.Logging in 'Source\Common.Logging.pas',
Common.Logging in 'Source\Common.Logging.pas',
KGOrders.Database in 'Source\KGOrders.Database.pas' {KGOrders
Database: TDataModule},
Api.Database in 'Source\Api.Database.pas' {Api
Database: TDataModule},
Common.Middleware.Logging in 'Source\Common.Middleware.Logging.pas',
Common.Middleware.Logging in 'Source\Common.Middleware.Logging.pas',
Common.Config in 'Source\Common.Config.pas',
Common.Config in 'Source\Common.Config.pas',
Auth.Server.Module in 'Source\Auth.Server.Module.pas' {AuthServerModule: TDataModule},
Auth.Server.Module in 'Source\Auth.Server.Module.pas' {AuthServerModule: TDataModule},
...
@@ -38,7 +38,7 @@ type
...
@@ -38,7 +38,7 @@ type
TFileLogAppender = class( TInterfacedObject, ILogAppender )
TFileLogAppender = class( TInterfacedObject, ILogAppender )
private
private
FLogLevel: Integer;
FLogLevel: Integer;
F
Filenam
e: string;
F
LogFil
e: string;
FCriticalSection: TCriticalSection;
FCriticalSection: TCriticalSection;
public
public
constructor Create(ALogLevel: Integer; AFilename: string);
constructor Create(ALogLevel: Integer; AFilename: string);
...
@@ -90,14 +90,18 @@ constructor TFileLogAppender.Create(ALogLevel: integer; AFilename: string);
...
@@ -90,14 +90,18 @@ constructor TFileLogAppender.Create(ALogLevel: integer; AFilename: string);
var
var
iniFile: TIniFile;
iniFile: TIniFile;
fileNum: integer;
fileNum: integer;
logsDir: string;
begin
begin
FLogLevel := ALogLevel;
FLogLevel := ALogLevel;
FCriticalSection := TCriticalSection.Create;
FCriticalSection := TCriticalSection.Create;
logsDir := ExtractFilePath(Application.ExeName) + 'logs\';
if not DirectoryExists(logsDir) then
CreateDir(logsDir);
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try
try
fileNum := iniFile.ReadInteger( 'Settings', 'LogFileNum', 0 );
fileNum := iniFile.ReadInteger( 'Settings', 'LogFileNum', 0 );
// FFilename := AFilename + Format('%.*d',[4, fileNum]);
FLogFile := logsDir + AFilename + Format( '%.4d', [fileNum] ) + '.log';
FFilename := AFilename + Format('%.4d',[fileNum]);
iniFile.WriteInteger( 'Settings', 'LogFileNum', fileNum + 1 );
iniFile.WriteInteger( 'Settings', 'LogFileNum', fileNum + 1 );
finally
finally
iniFile.Free;
iniFile.Free;
...
@@ -112,35 +116,33 @@ end;
...
@@ -112,35 +116,33 @@ end;
procedure TFileLogAppender.Send(logLevel: integer; Log: ILog);
procedure TFileLogAppender.Send(logLevel: integer; Log: ILog);
var
var
FormattedMessage: string;
formattedMessage: string;
LogFile: string;
logTime: TDateTime;
LogTime: TDateTime;
logMsg: string;
LogMsg: string;
txtFile: TextFile;
FLogFile: TextFile;
begin
begin
FCriticalSection.Acquire;
FCriticalSection.Acquire;
try
try
LogTime := Now;
logTime := Now;
LogFile := ExtractFilePath(Application.ExeName) + FFilename + '.log';
FormattedMessage := FormatDateTime('[yyyy-mm-dd HH:nn:ss.zzz]', L
ogTime);
formattedMessage := FormatDateTime('[yyyy-mm-dd HH:nn:ss.zzz]', l
ogTime);
L
ogMsg := Log.GetMessage;
l
ogMsg := Log.GetMessage;
if
L
ogMsg.IsEmpty then
if
l
ogMsg.IsEmpty then
F
ormattedMessage := ''
f
ormattedMessage := ''
else
else
FormattedMessage := FormattedMessage + '[' + IntToStr(logLevel) +'] ' + L
ogMsg;
formattedMessage := formattedMessage + '[' + IntToStr(logLevel) +'] ' + l
ogMsg;
try
try
AssignFile(
FLogFile,
LogFile );
AssignFile(
txtFile, F
LogFile );
if FileExists(LogFile) then
if FileExists(
F
LogFile) then
Append(
FLog
File )
Append(
txt
File )
else
else
ReWrite(
FLog
File );
ReWrite(
txt
File );
if logLevel <= FLogLevel then
if logLevel <= FLogLevel then
WriteLn(
FLogFile, F
ormattedMessage );
WriteLn(
txtFile, f
ormattedMessage );
finally
finally
CloseFile(
FLog
File);
CloseFile(
txt
File);
end;
end;
finally
finally
FCriticalSection.Release;
FCriticalSection.Release;
...
...
kgOrdersServer/kgOrdersServer.dproj
View file @
f1a2333b
...
@@ -133,8 +133,8 @@
...
@@ -133,8 +133,8 @@
<Form>FMain</Form>
<Form>FMain</Form>
</DCCReference>
</DCCReference>
<DCCReference Include="Source\Common.Logging.pas"/>
<DCCReference Include="Source\Common.Logging.pas"/>
<DCCReference Include="Source\
KGOrders
.Database.pas">
<DCCReference Include="Source\
Api
.Database.pas">
<Form>
KGOrders
Database</Form>
<Form>
Api
Database</Form>
<FormType>dfm</FormType>
<FormType>dfm</FormType>
<DesignClass>TDataModule</DesignClass>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
</DCCReference>
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
f1a2333b
[Settings]
[Settings]
MemoLogLevel
=
5
MemoLogLevel
=
5
FileLogLevel
=
5
FileLogLevel
=
5
LogFileNum
=
23
LogFileNum
=
30
webClientVersion
=
1.0.0
webClientVersion
=
1.0.0
[Database]
[Database]
--Server
=
192.168.159.132
--Server
=
192.168.159.132
Server
=
192.168.
198.131
Server
=
192.168.
60.129
--Server
=
192.168.75.133
--Server
=
192.168.75.133
--Database
=
--Database
=
--Username
=
--Username
=
--Password
=
Password
=
emsys!012
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment