Commit 6ec6e6bb by cam

removed last remaining envoy references and added image to login page

parent cd6b2e67
...@@ -7,7 +7,7 @@ uses ...@@ -7,7 +7,7 @@ uses
XData.Web.Client; XData.Web.Client;
const const
TOKEN_NAME = 'WEBENVOYCALLS_TOKEN'; TOKEN_NAME = 'KG_ORDERS_WEB_TOKEN';
type type
TOnLoginSuccess = reference to procedure; TOnLoginSuccess = reference to procedure;
......
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1> <h1 class="page-header pt-3" id="view.edituser.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4"> <div class="container mt-4">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
......
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Calls</h1> <h1 class="page-header pt-3" id="view.items.title" style="font-size: 24px;">Items</h1>
<div class="container mt-4"> <div class="container mt-4">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
......
// Displays calls and their associated recordings in the grid. Allows the user // Displays items in the grid. Allows the user
// to sort the entries, filter their search, and search for a specific person. // to sort the entries, filter their search, and search for a specific person.
// Authors: // Authors:
// Cameron Hayes // Cameron Hayes
...@@ -35,7 +35,6 @@ type ...@@ -35,7 +35,6 @@ type
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string); [async] procedure Search(searchOptions: string);
[async] procedure GetCalls(searchOptions: string);
[async] procedure GetItems(searchOptions: string); [async] procedure GetItems(searchOptions: string);
[async] procedure getUser(); [async] procedure getUser();
[async] procedure AddItem(itemOptions: string); [async] procedure AddItem(itemOptions: string);
...@@ -340,58 +339,8 @@ begin ...@@ -340,58 +339,8 @@ begin
end; end;
end; end;
procedure TFViewItems.GetCalls(searchOptions: string);
// Retrieves list of calls from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on
// user input.
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
{if PageNumber > 0 then
begin
asm
startSpinner();
end;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCalls',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
asm
setTimeout(endSpinner, 2000);
end;
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < callListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
end
else
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
end;
GeneratePagination(TotalPages);
end; }
end;
procedure TFViewItems.btnApplyClick(Sender: TObject); procedure TFViewItems.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetCalls() button // Button that effectively functions as a GetItems() button
var var
itemOptions: string; itemOptions: string;
begin begin
...@@ -451,7 +400,7 @@ begin ...@@ -451,7 +400,7 @@ begin
end; end;
procedure TFViewItems.btnSearchClick(Sender: TObject); procedure TFViewItems.btnSearchClick(Sender: TObject);
// calls Search method // item Search method
begin begin
//Search(edtSearch.Text); //Search(edtSearch.Text);
end; end;
...@@ -466,7 +415,7 @@ begin ...@@ -466,7 +415,7 @@ begin
end; end;
function TFViewItems.GenerateSearchOptions(): string; function TFViewItems.GenerateSearchOptions(): string;
// Generates searchOptions for get calls. // Generates searchOptions for GetItems.
var var
searchOptions: string; searchOptions: string;
begin begin
......
...@@ -19,6 +19,220 @@ object FViewLogin: TFViewLogin ...@@ -19,6 +19,220 @@ object FViewLogin: TFViewLogin
Transparent = False Transparent = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebImageControl1: TWebImageControl
Left = 22
Top = 68
Width = 200
Height = 200
ElementID = 'kgpicture'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ChildOrder = 5
Picture.Data = {
0954506E67496D61676589504E470D0A1A0A0000000D49484452000000560000
006B0806000000EDB27584000000017352474200AECE1CE90000000467414D41
0000B18F0BFC6105000000097048597300000EC300000EC301C76FA864000018
DD4944415478DAED5D077C14D5D73D5BD26909A1041129D2A48348938E60A424
101034F48EA058E8288AA27F50448AB490108AD221F4264DA426108A94D02148
098140207DB33BDF3B6F0926BB1BD804DC2CF97DE7E7BA66776676E6CC7DF7DD
7BEE7DA36AF2F76B95E99376C2495314D64181A2E8E53BA012FFA82C6CA2702B
F1955A6CA1366E672318942428A9D7B1CC711DCAAAEEDBEC77D3E3BC8F3F5459
25D6A0A4204177117A71011A952B346AD70CDF2B4AAAF82E5EBC12E0A42E0A27
6D51A8554E36BB28B5F8DDBCFAF398EBB01DA555B13625340DD92296A4DD4DDC
01AFE2CE7073731156A9CDB88162802E3509F1F14978185D10791C2A41ABCE67
B38B72561EA2B4FE28BE733884575571B6E4F309B2456CAAE111A21242D0B173
4354AB5111F9F2999376FBF66D1C3A780C87FF8C451E6D4D38A80BD8ECA2F22B
31A867D88DC1DAB328A24AB4D9EFA6C773113B61E227F0EBD806254A9430DBE6
EFBFFF46E0BCDFB06CC131B8AAABDB94D8C2CA1DF81A42D0417B0B1E2A9DCD7E
373D7221B10A8A2B37304859807A9A64E451196C48E7BFC875C41A946494512E
E37BD5EF28A156E068BB602403721DB17A431CCA291108D286C05990AAB6299D
FF22D711EB60B88B1ACA49FCEAB0D3A6449A22D711EBA95C47432514A3B5E136
25D214B98ED892868BF056FE422F878B3625D214B98ED88ACA19F86237DA6B6E
DA944853E43A626B2B47E1AF6C467D6D924D893445AE2296DA442BE53086A877
A0584E85038F91AB8835E8A3D0517518A3B4876D4EA4297215B12E8648416C28
3ED61CB33991A6C855C416379C41075518BA6ACEDB9C4853E42A62AB19C2D05E
10FB9EE686CD893445AE22B699619720F608EA687246DC4E8F5C432CAB16EF63
137C55E128AB4ECD1132D3C30E8955F0A496F6A44EA63C7ECF5CAA4AD5C76288
6A33DAAB4FC13D87432DBB245667B80FBD21111A95331C341E52064C353C94DF
B1BC9359ED2C29F526C66976888CEB1C3439CDAABD119BA0BB0C38454251DD47
72B20E29C9B455BD2C5E3A69BC90CFB1261C359E16F654E0AE3F8B619A7D7847
7D2DA739B51F62491E75D447FA03A859B7302A572D09474747A4A4A420222202
278E9FC2C3BB1EF0706E26882D68B6BF4A1CA192D8B79FE628EAA9A3729A537B
21D6208E178FB89433285CF20E060DEE8A4E9D3AA160C182888B8BC39C3973B1
62E9765C3BEF88024E6F0957E06891D866FAADF840731A55D539D3476077C4B2
B92231F51AEEA6ACC3D8B15FA04B97CE285BB62C1E3E7C8843870E61E8D091B8
7BAD30F239D5103E36BFC56390583FC36AF8AACFA39C3A3EA739B50F62137497
A0770E47F35655307CF817A858B12212131371F0E0418C183102D1D73DE1A0AF
0027AD9720D0F2B4A416563FD81080E6EA1B28A6CE99E2A15D119B947A037A87
F378BD9282493F4E40952A55E0E0E080DDBB7763EA2FB311B6FFA6D8B7061CD5
45840B70B6782EB2EBC6700F33354B5143152DEB5CF6801C2396615582FE244A
5754C1BF7B1B0C1A34080683410EFFC58B9663D5D23D7055D585B3F695A7B727
0957A2D65FC122874D2897437D5A7642AC22FCAA0E0F538EC3C3EB1EFC3A37C2
A79F7E0A7777779C3A750A73E7CCC7960D61487CE085FC4EB5F0AC663AAD120F
4FFD694C75D893637D5A7641AC22484DD6472126652BFA7FD4010306F4439932
6570FFFE7D7CFCF1C7D8B7E702521F9596939535705362F18608B5463B1C4371
957D4C5C362796F16A8A3E1A771236A175BBBAE83FA0071A376E2C499D316306
962FDB8CF8E85270D35412C3DFC5AA737157EEA1B9612B7A6A2FA3B02A67CB31
39466CB2FE0E52D46750ACD4238C1E330C4D9A34464C4C0C56AF0E117E75351E
4679416B2823262B4FABCE83288A28F81B96A2A5E63EDC55392FBED89C582602
3AD525142C7E0FBDFBFAE1FDF7DF874AA5C2860D1B316BE602445E70425E07DE
00F7C78DCACF069B9F4BE03A46280B5145A313939D62D57EB98658675579241B
6EC0BDE85DBCE35D1DE3C78F8746A3C18E1D3BB078E14AECD87A16855DDBC890
CA5A5209839288D2868B98AE59064FB19BD6EA3D7305B1E130A40A7FE9780D2D
BCDFC037DF7C8372E5CAE1F8F1E398306102B66D38034F97771F8B2B590B42A9
7A95379CC552C7F539CDA36D899D17B0108B83772121E9063A757E0F7DFBF540
BD7AF5E0E4E48473E7CE0992BFC3C635A750C8B925B49AAC0BE1799428D456C2
3149BB2FA779B42DB1010181089AB704CD5B3440CF5EDDD0A2450BE4CF6FCCF7
A905CC9E3D07BF2FD88E3B911E22BCAA86AC5AAC97720D4D9503F8547B2AA779
B41DB1D7AE5DC31F7FFC813D7BF6A07DFBF6A85FBF3EBCBCBC326CB36FDF3E04
CF5F8A901587E0AE6D09B5DA2D4B3EB68C721E6D943FE1AFBD9AD33CDA8ED807
0F1E487253535351BE7C79E4C993C76C1B5AED9A356BF0C377D3107FA7A2485F
CB406365FC4A54514EA123B6C35B732FA779B41DB1972F5FC681030750B46851
D4AA554BA6AC9670E2C40931C92D4070E07A783AB511935811AB4FBEBE128A9E
CA3A54B7A770E0BF26F6F4E9D3F8EDB7DFA43BF8F2CB2F658665895C5AEDFEFD
07D0AD6B4F38E91AC3592DAC569DE799E74011A71D42314AB3172E76A268D984
581915CC9B87E0E0C5F0F1698B8103FBE3EDB7DF36DB8E8A56646424264F9E8C
4D6B4F40175B0EAE0E659E790E6AFD4DF8A9C2305C1B6AF65D8AC813A20CC075
458547E2152FFE8E15AF4726522DD7271412498593EAD99E5D2DB62DA1368897
8846ACB891FF71B8351FC141EB50B090133E193A00DDBAF9A350A14266DB2624
24C8ED877E321CD722F20A0BAC0AAD3AEF53CFC1DD70091D108601DABF8DC710
C45D31A870550FDC51A9F1C0D91571F9DCA1CD5F00A98ECE4872708453419354
39250588897E26B1C9C9C978101D8D6AB1D168AAD6A1B815F3EB7F9C202CC692
E050C427DF44EBB6F5D06F803F5AB66C99E971070F1E8C3F3647202EDA0B6E8E
159E1A2194319C947D5A3E9ACBD23A2FA40261AE0570265F413C702F08771181
F0BC5E7BED35299E2B8A82D2A54BCBFFE6823FC6D2ACA99D3FFFEC3EAF68416A
E85F7FA154D87E74D6C7A182E6D9A9B34D525A45EF02C73CB7D1E9C3FA983265
8AD4082C213C3C5C646313B173F315918D79CBDE82CCF096E1A0ECD32AA7BA83
19892AACD501359AB7C0071F7C8056AD5A3D09ED48E8993367F0D7DEBD888A8A
8257B16268D6AC99942A4DCF83DBA67F4FC3952B57B0685E00921705C13731C6
7E8875565540A22102556A3BE1B3CF07C0DBDB5B6A05A6A04B9832E517FC2692
8607B7D947500599250DDECA36BCA63F828BE23027BD4AA0F7679FE3CD3A75F0
CA2BAF488BA465C6C7C7232828087B4342E0107905250CA908536951A64143F8
F9FBE3DD77DFCD70CC23478E60F9F2E5D8B9F3DF1537458A1491C7BB7A2E0275
AE5EC087AA24FB2196EA964E7F17CEEED7F176B357306DDA34E4CD9B572404E6
439D17353F702936AC094761D7B68FCBDD19C9A5F85253BF55B88B0B88ABF006
7C070D4693264D50B8706149A8DC464C8AAB57AFC696A040B8851D40D3D478B8
8BC35C143E78977B5194F0ED886EFDFBA372E5CA4F8E7BF3E64DF9FBB366FE8A
5BE2FC9B1B12F17A5E37E85CDC9092108F4ABA24D452EB5138E77DECBFC4AAE1
8004C31978148FC4F4193FA176ED372D2E6EBE73E70E962E5D861FFF17005542
5D386BCC6B5E29E2261548F903A52A68D0C0BFABF4CDF499E96F944EA7C38001
03E0B4732BDE7D701B8D1D8C569624DEE627AB70B9465D34E8DD0FBD7AF5CA70
6C2EAE5EBF6E1D7E9F3615DEB7AFA2AE81CB4615796BF3897FE557C1AAD58E36
15BAD93F0097BFE1EDC352F730BCFEFAEB16FDED5F62A298F2F32CECDE7605EE
4E6F4B8D36BDD526E8AE40D184A19D5F2D8CFEFA6BB3DFD7EBF5888D8D858F18
EA1DCE1F879F462749494378AA0ADB0BBD8AE4361DF0CB2FBF98FD3E5DD2679F
7D86B86D9BF16ECC0DB475CCBACE6B5362F56208A7E8AFE2917A3356AD5A8E86
0D1B4A4B330567EBBD7BF789F8B7238AB874818BB684A0F5DFF4EA4172284A57
D4A1471F6375D7144C3AC24243F1E34703D1F3F665789B10735744110B142784
D76B86CD9B379B5F9F48C38F1E3D8A6FC78C41E583BB31DA359BC406CF0B5416
07FF6EF5C31A92539270FAC2717CF5F518F8B6F77D0AB18BF07BF03E382A651F
C7A56C278A45ACEE00BAF8B742BFFEBD50B76E5DB37DE91F2F5CB880112346E2
C4E164A4C4796638B758416C9B0E35D1BBEFFB68DEBCB9D9FE77EFDEC5D62D5B
307FDC5768191D893ADA8CC4B080B3264585883A8D650F83291815D06A3F1D3A
140FD7AE844FCA2378A9B3466E5CFB0FA03A776EA272F1C2CF62583A58B5534C
8C41F8C907E8DDFB0731C3FB654AEC922541381FB1026FD77745C182C663A7EA
75881641F9C68D1EF0F71F89AE5DBB5A146828E27022F972CC8FA856255AA4C4
4E7016C6FD20169836E30EDAF9F440DF7E3D51B56A55B37D6FDDBA85C58B1763
BEF09379EEDC42210B930D13893C35DE14E7B844C6BA6CC233C5F7DF7F8FED8B
17417FF902F266B1EC53B35317A8F4CAD7E21E8DB77AA75B37818103800EED27
A3458B4E9912BB7A7580B0D1B9E8D94B274EDEF8B9707F82346090D8BFE46BBD
45DC39086FBEF9A6D9FE1C8EF4937DFAF441D9F27BD0B9732CCA5700CE9E057A
7403FC3A8C45BF7EFD2429A6F8E79F7F3077EE5C040404C8C93033F0A6FCFAEB
AF522472757535FB3E383818818181524CCA2ABA74B131B169983B07083D5459
5C5C2FD94F9016269962E6CC99080D0D428D5AC704B92254DA057C3516E8DBF7
7B49ACA514F94511BB72E54A790CD6E65E1A62C56815C31C888FEB28E35A664A
962204C69623460C17BE79093EFF02D8B801080C20B15FA1BF88438B172FFEFF
C4A6870833B1720570F85055942BDB47C6A296B231C6A3B367CFC691A381C23A
FF164403DBB791D811D26219B2FD57C4D24FD315EC15E9B04D89550CF5E1E151
5A6651A6E0E413137301B56A1F439FBE7A587085B87409581B921F07F6D513F1
E42C998E5A9A44A8212C5F11800DEBE7C2455C7F84F0B3DDBB0F94165BA38679
2B92B5C4D6AE5D1BCB962DC3ABAFBE6AD11551D758B0608134129B101B1303FC
3A43CCAC57181A010EE65C4097A2119990039A344B025372916D9A81AADD1611
460605BE82D6EF8D869F5F47999B9B8271ED8A152B3061C2372246BD2E2635A0
6DDBF69258D37C5FDE78E167162D5A84A953A7CA4C2A333468D0400AF1A6599B
3C7F3152860D1B26B2C0A552DDB209B11CC6D7AE028CEDDD3D44D86241F027F9
919100E716BE2C18A2444404B07A950BB66CAA88E9D367A37AF51A16AD275404
FCB366CDC2C2850BE5DFB454BA02A6ADA6A4DCBB770F5BB76EC5E8D1A371FDFA
758BBFCBDFA0CAC5ED4CC1389AFB7DF4D147161388FF8C58224D5953A99E6F9B
E464E05838D0DE47252C7226DAB4F141B162C5CCB67BF4E8910CE67D7C7CE4DF
F489CCF3274E9C68160753D56269C8DFDF1F172F5A7ED206DD4E870E1DC4CD9C
6EE19C9265F583EE84ADA53625F64581E4FF238C6AD2244608ADD0ADEB1778E7
9D77CCB663FECF268FE1C38763FFFEFD9268666D4C699964A4072D8E69ADAFAF
AFB474B6DE9BA24E9D3AD295F4EEDD3BC3E75CA9436BE548E0BEFC9D97925842
1818C28F023F4C282432B9E1F8F0C3EE167D2DDB3DE91339C45905E6CA1AFAC9
3122A7679B7DFA999D3782020B271F5A6F7A70826453DEA851A350A952A5279F
3329612A4D0D978550FA56DE249B11CBE17BFA142FD4E86FB30B5737806168C9
9240521230F463F1998B9F18EE032C5A2D2F9CD1065D0043205AA5A7A7A7B44C
3685D0EF3261D06AB532DFE71A3192B47EFD7A590520D9942AAB55AB861E3D7A
881BF8219C9D8D550AEA0BAC346CDBB64D4E7C9CF4F87BD945B68815E780893F
400C190F7147F340ABC97A613F39255984690FD0BC453CBAF7307EB66A251380
122853BA07468E1C0D1717CBCD1BF48B24ECE4C993F26F2616AC4A74ECD8116F
BDF59614BC0B1428200966F35D484888242C49DC3DA6C0F4BD8D1A3592DBD01F
F30651CD6242B071E3468BAEC326C4326B62AE5FB9F20054ADD2485E485671F1
E2051C3EBC0465CBEFC38891C6CF18468DFB5285A8DBEF89613A1E356BD6B498
8D314E6528C4324A1A1819B8B9B9496B6CD7AE9D1CEA9C04492E2D356D48F378
4C4418C27162FBF3CF3F25998C55194D6477E8BF18621F2708EF794F409326ED
E50C9B55D0DA42427E8267E10D1839CAF819059AE5CB80DDBBCAA09857177CFB
EDB716CB379C60A821CC9F3F3FC3ACCD6DE967995191788654248C37223DD8FA
C4A14FCBA4D043DF4D99F07986FE0B25B651C3516266F6366B76B306F467DBB7
8B6CEBD5ED4F8825C4DC8195CB5DB179537971723D24896CA7E7859BEE4F52D3
2700A54A959291021B4358CB62E6455740BF9C1E6944FE97C816B15151C08861
103EB29920B502F2E5CDFAD38C598ABE79EB006AD63A87211FFFFB39B3B13DBB
81DF163B8959BFA48C292F5FBE2B26A23819966506A6A59CC4FCFCFC50A14205
1C3B764C06F89CB47202D9229606B06881D1BAE29F63051023AA868D844B699D
F173FADA1B378084C7C716F30AD686007F6C373F06873F5352C6B28C3D29A8DC
103B737263A6C61BF8D210CBA09EEE88EFCA73ACA7E0BC4441CB54D4323DEEF4
A9109910702EC2FC188C1CD8264A25EA8D37DE904433FE5CBB76ADF4D1A6FED5
AE89B535C67F0D04CC35BA205350B2E444C50B4913BD19565DBD7A5576C5D00F
BFC849C95AD83DB14C46E8CF83028D4984291801B0799982775AC5972113C9A5
96BA61C3063981310AB025EC9E580ADB2387034B9758FE9E9A2A737A5330F362
C4C038954BF4398925A5BB334C0C18CBA607BF67F8C5288456AE3C879FB37B62
0F1DA4860064A6DEB110C915E396AA0F692081F4BBE975554E6A8C67D383845E
BA74498672FC6F260CBC01D97125764FEC8AE54651FDC07ECBDF333BDBB56B97
940E3323979697F64AFF99A52C8B9F317666B84657C27AD7D3C4F29796D8C93F
028B17B1F5DEF2F77CCC094B28CCFD2DF5826507249D56CE4226051C8A3259D5
65ED9ED84F8600EBD689B83693A889424AD3A64D3172E44833E9F045800A199B
3A7EFAE92799AC58EB77ED9E58DF76C64C2C2E93FF650CE356C6B27DFBF6950A
57F5EAD52D6AB9D9056B5F9CFCD8FB4092E926AC81DD124BC3E035346A60CCBC
AC014B2DEC9CE10A1D4A811459329BDDE98F2978F345ABE7BB25C187E084C612
3CB33953DDE1A523362991D222E0FF41E6FED5144C67A9C9F29DDA2A573E72F6
D75950E32990B32781591BCB335C384DD9D11218215058A7F6C00AF04B4D2C0D
63D74E60F44863FF4166A03448925811604ACB92CD962D5B642845158B43D792
C5723FFA639249DDB673E7CE68DBB6AD24DA1469C549DEB4CCAABE2F0DB10C39
97FC0E4C9DC24A85E56D3C3C3C64E64517C0098CF12C1B30685DBA2CD68C2890
53C861B9C6B44A4C77C208812E86A9F24B4D2CB59349138DE59A680BCD2CF489
ACB4F6ECD9535A1B2F9EC5411601E3E2B2F73F47E36A1B3E51C9B4098416CFE4
825AAFB532A4DD124B49B24F4FE0C44996C5CDBFA7F8C2A222CBE11CD2AC4870
6929CB2CD905DD002D76DCB871193EA73BA1A5728D9A69B69619EC9658C6E32D
9A095F7BDF28519A82C3969D306CB72758FF62D722DD4176C1E8A075EBD6D2EA
D38391007B64F97B7409D6C02E89A57B3C7A0468DED41872598AC919B0F342F9
60090E55A69F73E6CC910D74D9050B8F6CBD376D3B6264C191C0FE85A735D9D9
3DB18C0876EF023A773236DD9982C5CB9F7FFE59FA5682F93DEB5B7C31C77F1E
7012A4F6901E6CE260C99D623AD52F6B6097C4B28B71D52A60CC28CBC45278E1
9390DAB46923FFA6C5329F67E5362C2C2CDBBFCB108C8F5749DF0897F6BCC521
438648D58B69ED4B4B2CDB8DC4A84670906537C0D0E8BBEFBE9371671AB11CBE
93264D92FA6B76C1F08D372BADA39160064737C0268FACC02E89150913A64C06
36ACB74C2C5D019F6FC0932748ECD9B367654F17D5A8EC82CFAE258163C78E7D
F219AD95FE9BE96C566097C46EDE048CFB4A845AC72D13CB120CAD93E1569A54
C8EC88CB87E81258A5CD0EF8086BC6C2743504272D3685F0B98BD6A6B2764DEC
B2A546B990CDCB99A17BF7EEB20D93DD8669607F162D6BDDBA7556AB5069A056
C0E30D1C3850A6B9F4A5ECE626B15C829A55D81DB14C9AE85B3FFBF4E9DBA505
F30CB9D23A715830A44EC0A14BA9CF9ABA157BB9B83F89E08B1D8B8C5B5947A3
A592D4F86C344FD81DB1EC1D604576CACFCFDE964F9D6393065B3869659402A9
44910CC69C4C43D9384CEB352DC3705BEAB84C0AA8E3B28199220E873F3B0FF9
7840FAEDEC761EDA1DB12CB806CE03E6073E7B5B864794FE98DFB3B5888DC8B4
5092419FB84AC46C0C9D98EE9AEAA8145A98B575EBD64D567A1911300666ACCA
B64F26021472B25BA9B53B623789547F5E8071A19C3560E3309BE148122D9842
09DD04DD00C925410C9918D8A7AD47609F17873F97517122647CCAA76BD05259
25A0D5B2F5335795BF83E71B97831EC9629C4FA2F8301D1617F94E8BA44ECBE1
CE61CFC928AD8F8B7FB38780A433F76766C517BF4F4A7A314F4DB63B6227FD4F
2407B333D760AD01C9E4C374482ECBE2D400D283931C433212696DA925ABB02B
62D9783C62B8B0D8D996DB895E26D815B11CA92CC5B08FE079BA18ED017645EC
99D3C0F86FB85231A7CFE4F96157C4322298FA8B51327CD96157C44E9B0A2C5C
009C3C91D367F2FCB02B62870F03D6AC362E807ED96157C4F6EA695C667F37EB
ABD8ED0E925883B242109BF333C69AD5E51079CD0D5914A6EC12D476FF0FA62D
A3F3F4F969570000000049454E44AE426082}
end
object edtUsername: TWebEdit object edtUsername: TWebEdit
Left = 240 Left = 240
Top = 136 Top = 136
......
<nav class="navbar navbar-light bg-light login-navbar"> <nav class="navbar navbar-light bg-light login-navbar">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="#">Envoy Calls</a> <a class="navbar-brand" href="#">Koehler-Gibson Orders</a>
</div> </div>
</nav> </nav>
<div class="container mt-5"> <div class="container mt-5">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-auto">
<img id="kgpicture"style="width: 250px; height: 250px;">
</div>
<div class="col-md-6 col-lg-4"> <div class="col-md-6 col-lg-4">
<div class="card login-card"> <div class="card login-card">
<div class="card-header"> <div class="card-header">
......
...@@ -6,7 +6,7 @@ uses ...@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON,
JS, XData.Web.Connection, WEBLib.ExtCtrls, JS, XData.Web.Connection, WEBLib.ExtCtrls,
App.Types, ConnectionModule, XData.Web.Client; App.Types, ConnectionModule, XData.Web.Client, Vcl.Imaging.pngimage;
type type
TFViewLogin = class(TWebForm) TFViewLogin = class(TWebForm)
...@@ -18,6 +18,7 @@ type ...@@ -18,6 +18,7 @@ type
lblMessage: TWebLabel; lblMessage: TWebLabel;
btnCloseNotification: TWebButton; btnCloseNotification: TWebButton;
XDataWebClient: TXDataWebClient; XDataWebClient: TXDataWebClient;
WebImageControl1: TWebImageControl;
procedure btnLoginClick(Sender: TObject); procedure btnLoginClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject); procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
......
...@@ -59,7 +59,7 @@ object FViewMain: TFViewMain ...@@ -59,7 +59,7 @@ object FViewMain: TFViewMain
Transparent = False Transparent = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblCallsList: TWebLinkLabel object lblItemsList: TWebLinkLabel
Left = 560 Left = 560
Top = 69 Top = 69
Width = 29 Width = 29
...@@ -68,7 +68,7 @@ object FViewMain: TFViewMain ...@@ -68,7 +68,7 @@ object FViewMain: TFViewMain
ElementFont = efCSS ElementFont = efCSS
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = lblCallsListClick OnClick = lblItemsListClick
Caption = 'Items' Caption = 'Items'
end end
object lblUsers: TWebLinkLabel object lblUsers: TWebLinkLabel
......
<div id="wrapper"> <div id="wrapper">
<nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;"> <nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;">
<div class="container-fluid"> <div class="container-fluid">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Envoy Calls</a> <a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<div class="collapse navbar-collapse show" id="navbarNavDropdown"> <div class="collapse navbar-collapse show" id="navbarNavDropdown">
<ul class="navbar-nav ms-auto"> <ul class="navbar-nav ms-auto">
<li class="nav-item dropdown"> <li class="nav-item dropdown">
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a> <a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a>
</li> </li>
<li> <li>
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-home fa-fw"></i><span> Orders</span></a> <a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
</li> </li>
<li> <li>
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-phone fa-fw"></i><span> Items</span></a> <a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li> </li>
<li> <li>
<a class="dropdown-item" id="dropdown.menu.users" href="#"><i class="fas fa-address-book fa-fw"></i><span> Users</span></abbr></a> <a class="dropdown-item" id="dropdown.menu.users" href="#"><i class="fas fa-address-book fa-fw"></i><span> Users</span></abbr></a>
......
...@@ -19,7 +19,7 @@ type ...@@ -19,7 +19,7 @@ type
lblAppTitle: TWebLabel; lblAppTitle: TWebLabel;
WebMemo1: TWebMemo; WebMemo1: TWebMemo;
XDataWebClient: TXDataWebClient; XDataWebClient: TXDataWebClient;
lblCallsList: TWebLinkLabel; lblItemsList: TWebLinkLabel;
lblUsers: TWebLinkLabel; lblUsers: TWebLinkLabel;
lblorders: TWebLabel; lblorders: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
...@@ -27,7 +27,7 @@ type ...@@ -27,7 +27,7 @@ type
procedure wllblUserProfileClick(Sender: TObject); procedure wllblUserProfileClick(Sender: TObject);
procedure wllblLogoutClick(Sender: TObject); procedure wllblLogoutClick(Sender: TObject);
procedure lblHomeClick(Sender: TObject); procedure lblHomeClick(Sender: TObject);
procedure lblCallsListClick(Sender: TObject); procedure lblItemsListClick(Sender: TObject);
procedure lblUsersClick(Sender: TObject); procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject); procedure lblordersClick(Sender: TObject);
private private
...@@ -100,7 +100,7 @@ begin ...@@ -100,7 +100,7 @@ begin
ShowForm(TFViewUsers); ShowForm(TFViewUsers);
end; end;
procedure TFViewMain.lblCallsListClick(Sender: TObject); procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin begin
ShowForm(TFViewItems); ShowForm(TFViewItems);
end; end;
......
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Orders</h1> <h1 class="page-header pt-3" id="view.orders.title" style="font-size: 24px;">Orders</h1>
<div class="container mt-4"> <div class="container mt-4">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
......
// Displays calls and their associated recordings in the grid. Allows the user // Displays orders in the grid. Allows the user
// to sort the entries, filter their search, and search for a specific person. // to sort the entries, filter their search, and search for a specific person.
// Authors: // Authors:
// Cameron Hayes // Cameron Hayes
...@@ -49,7 +49,7 @@ type ...@@ -49,7 +49,7 @@ type
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string); [async] procedure Search(searchOptions: string);
[async] procedure GetCalls(searchOptions: string); [async] procedure GetOrders(searchOptions: string);
[async] procedure getUser(); [async] procedure getUser();
var var
PageNumber: integer; PageNumber: integer;
...@@ -84,7 +84,7 @@ begin ...@@ -84,7 +84,7 @@ begin
PageNumber := 1; PageNumber := 1;
TotalPages := 1; // Initial total pages TotalPages := 1; // Initial total pages
wcbPageSize.Text := '10'; wcbPageSize.Text := '10';
getCalls(GenerateSearchOptions()); getOrders(GenerateSearchOptions());
end; end;
procedure TFViewOrders.getUser(); procedure TFViewOrders.getUser();
...@@ -285,7 +285,7 @@ begin ...@@ -285,7 +285,7 @@ begin
if PageNumber > 1 then if PageNumber > 1 then
begin begin
Dec(PageNumber); Dec(PageNumber);
GetCalls(GenerateSearchOptions()); GetOrders(GenerateSearchOptions());
end; end;
end); end);
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
...@@ -325,7 +325,7 @@ begin ...@@ -325,7 +325,7 @@ begin
begin begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText); PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum; PageNumber := PageNum;
GetCalls(GenerateSearchOptions()); GetOrders(GenerateSearchOptions());
end); end);
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem); PaginationElement.appendChild(PageItem);
...@@ -364,7 +364,7 @@ begin ...@@ -364,7 +364,7 @@ begin
begin begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText); PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum; PageNumber := PageNum;
GetCalls(GenerateSearchOptions()); GetOrders(GenerateSearchOptions());
end); end);
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem); PaginationElement.appendChild(PageItem);
...@@ -401,7 +401,7 @@ begin ...@@ -401,7 +401,7 @@ begin
begin begin
PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText); PageNum := StrToInt((Event.currentTarget as TJSHTMLElement).innerText);
PageNumber := PageNum; PageNumber := PageNum;
GetCalls(generateSearchOptions()); GetOrders(generateSearchOptions());
end); end);
end; end;
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
...@@ -421,7 +421,7 @@ begin ...@@ -421,7 +421,7 @@ begin
if PageNumber < TotalPages then if PageNumber < TotalPages then
begin begin
Inc(PageNumber); Inc(PageNumber);
GetCalls(GenerateSearchOptions()); GetOrders(GenerateSearchOptions());
end; end;
end); end);
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
...@@ -430,8 +430,8 @@ begin ...@@ -430,8 +430,8 @@ begin
end; end;
procedure TFViewOrders.GetCalls(searchOptions: string); procedure TFViewOrders.GetOrders(searchOptions: string);
// Retrieves list of calls from the server that meet the criteria searchOptions // Retrieves list of orders from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on // searchOptions: information about how to generate the SQL statement based on
// user input. // user input.
var var
...@@ -487,7 +487,7 @@ begin ...@@ -487,7 +487,7 @@ begin
end; end;
procedure TFViewOrders.btnApplyClick(Sender: TObject); procedure TFViewOrders.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetCalls() button // Button that effectively functions as a GetOrders() button
var var
searchOptions: string; searchOptions: string;
begin begin
...@@ -497,7 +497,7 @@ begin ...@@ -497,7 +497,7 @@ begin
searchOptions := '&pagenumber=' + IntToStr(PageNumber) + searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) + '&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy; '&orderby=' + OrderBy;
GetCalls(searchOptions); GetOrders(searchOptions);
end; end;
procedure TFViewOrders.Search(searchOptions: string); procedure TFViewOrders.Search(searchOptions: string);
...@@ -531,7 +531,7 @@ begin ...@@ -531,7 +531,7 @@ begin
end; end;
procedure TFViewOrders.btnSearchClick(Sender: TObject); procedure TFViewOrders.btnSearchClick(Sender: TObject);
// calls Search method // orders Search method
begin begin
Search(edtSearch.Text); Search(edtSearch.Text);
end; end;
...@@ -546,7 +546,7 @@ begin ...@@ -546,7 +546,7 @@ begin
end; end;
function TFViewOrders.GenerateSearchOptions(): string; function TFViewOrders.GenerateSearchOptions(): string;
// Generates searchOptions for get calls. // Generates searchOptions for GetOrders.
var var
searchOptions: string; searchOptions: string;
begin begin
......
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1> <h1 class="page-header pt-3" id="view.users.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4 px-0"> <div class="container mt-4 px-0">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
......
...@@ -20,34 +20,6 @@ const ...@@ -20,34 +20,6 @@ const
API_MODEL = 'Api'; API_MODEL = 'Api';
type type
TCallItem = class
// Class of the info we want from the database from a specific call.
// callSid: SID of the call, 34 digit string.
// fromNumber: Who the phone call was from. (xxx) xxx-xxxx
// toNumber: Who the phone call was to. (xxx) xxx-xxxx
// dateCreated: Date the phone call was created. mm/dd/yyyy hh:nn:ss am/pm
// mediaURL: Link to the recording audio
// duration: Length of the entire call and recording.
// transcription: Transcription of the recording. Not always present due to
// the call being answerered or caller did not leave a message.
public
callSid: string;
fromNumber: string;
toNumber: string;
dateCreated: string;
mediaUrl: string;
duration: string;
transcription: string;
end;
// List of call items
// count: Total amount of records that fit the SQL query
// data: List of retrieved calls
TCallList = class
public
count: integer;
data: TList<TCallItem>;
end;
TUserItem = class TUserItem = class
public public
...@@ -114,8 +86,7 @@ type ...@@ -114,8 +86,7 @@ type
[ServiceContract] [ServiceContract]
ILookupService = interface(IInvokable) ILookupService = interface(IInvokable)
['{F24E1468-5279-401F-A877-CD48B44F4416}'] ['{F24E1468-5279-401F-A877-CD48B44F4416}']
[HttpGet] function GetCalls(searchOptions: string): TCallList; [HttpGet] function Search(phoneNum: string): TOrderList;
[HttpGet] function Search(phoneNum: string): TCallList;
[HttpGet] function GetUsers(searchOptions: string): TUserList; [HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList; [HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList; [HttpGet] function GetOrders(searchOptions: string): TOrderList;
......
...@@ -19,14 +19,13 @@ type ...@@ -19,14 +19,13 @@ type
[ServiceImplementation] [ServiceImplementation]
TLookupService = class(TInterfacedObject, ILookupService) TLookupService = class(TInterfacedObject, ILookupService)
strict private strict private
callsDB: TFDatabaseModule; ordersDB: TFDatabaseModule;
private private
function GetItems(searchOptions: string): TItemList; function GetItems(searchOptions: string): TItemList;
function GetUsers(searchOptions: string): TUserList; function GetUsers(searchOptions: string): TUserList;
function GetCalls(searchOptions: string): TCallList;
function GetOrders(searchOptions: string): TOrderList; function GetOrders(searchOptions: string): TOrderList;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TCallList; function Search(phoneNum: string): TOrderList;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function DelUser(username: string): string; function DelUser(username: string): string;
...@@ -44,17 +43,17 @@ uses ...@@ -44,17 +43,17 @@ uses
procedure TLookupService.AfterConstruction; procedure TLookupService.AfterConstruction;
begin begin
inherited; inherited;
callsDB := TFDatabaseModule.Create(nil); ordersDB := TFDatabaseModule.Create(nil);
end; end;
procedure TLookupService.BeforeDestruction; procedure TLookupService.BeforeDestruction;
begin begin
callsDB.Free; ordersDB.Free;
inherited; inherited;
end; end;
function TLookupService.Search(phoneNum: string): TCallList; function TLookupService.Search(phoneNum: string): TOrderList;
// Searchs the database for a specific from phone number then returns a list of // Searchs the database for a specific from phone number then returns a list of
// calls from said number // calls from said number
// SQL: String of the sql query used to retrieve info from the database // SQL: String of the sql query used to retrieve info from the database
...@@ -62,146 +61,34 @@ function TLookupService.Search(phoneNum: string): TCallList; ...@@ -62,146 +61,34 @@ function TLookupService.Search(phoneNum: string): TCallList;
// Return: A list of calls // Return: A list of calls
var var
SQL: string; SQL: string;
call: TCallItem; order: TOrderItem;
begin begin
SQL := 'select * ' + SQL := 'select * ' +
'from calls inner join recordings on calls.sid = recordings.call_sid ' + 'from calls inner join recordings on calls.sid = recordings.call_sid ' +
'where from_formatted = ' + QuotedStr(PhoneNum) + ' order by calls.date_created desc'; 'where from_formatted = ' + QuotedStr(PhoneNum) + ' order by calls.date_created desc';
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result:= TCallList.Create; Result:= TOrderList.Create;
Result.data := TList<TCallItem>.Create; Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do while not ordersDB.UniQuery1.Eof do
begin begin
call := TCallItem.Create; order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( call ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( order );
Result.data.Add( call ); Result.data.Add( order );
call.callSid := callsDB.UniQuery1.FieldByName('sid').AsString; //TODO
call.fromNumber := callsDB.UniQuery1.FieldByName('from_formatted').AsString;
call.ToNumber := callsDB.UniQuery1.FieldByName('to_formatted').AsString;
call.dateCreated := callsDB.UniQuery1.FieldByName('date_created').AsString;
call.mediaUrl := callsDB.UniQuery1.FieldByName('media_url').AsString;
call.duration := callsDB.UniQuery1.FieldByName('duration').AsString;
call.transcription := callsDB.UniQuery1.FieldByName('transcription').AsString;
callsDB.UniQuery1.Next;
end; end;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from calls inner join ' + SQL:= '';
'recordings on calls.sid = recordings.call_sid where ' +
'from_formatted = ' + QuotedStr(PhoneNum);
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger; Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
end; end;
function TLookupService.GetCalls(searchOptions: string): TCallList;
// Retrieves a list of calls from the database then sends it to the client.
// searchOptions: csv string representing all the search options the client sent.
// Format: Phone Number, Page Number, Page Size, Start Date, End Date, SortBy.
// Returns a TCallList containing PageSize amount of entries.
var
params: TStringList;
SQL: string;
DBString: string;
call: TCallItem;
offset: string;
limit: string;
PhoneNum: string;
PageNum: integer;
PageSize: integer;
StartDate: string;
EndDate: string;
OrderBy: string;
whereSQL: string;
orderBySQL: string;
Caller: string;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
// parse the searchOptions
params.Delimiter := '&';
params.DelimitedText := searchOptions;
PhoneNum := params.Values['phonenumber'];
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
StartDate := params.Values['startdate'];
EndDate := params.Values['enddate'];
OrderBy := params.Values['orderby'];
Caller := params.Values['caller'];
// We want entries for the "page" the client is on.
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
whereSQL := 'where ';
if PhoneNum <> '' then
whereSQL := whereSQL + 'to_formatted = ' + QuotedStr(PhoneNum);
if StartDate <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'calls.date_created > ' + QuotedStr(StartDate)
else
whereSQL := whereSQL + 'AND calls.date_created > ' + QuotedStr(StartDate);
if EndDate <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'calls.date_created < ' + QuotedStr(EndDate)
else
whereSQL := whereSQL + 'AND calls.date_created < ' + QuotedStr(EndDate);
if Caller <> '' then
if whereSQL = 'where ' then
whereSQL := whereSQL + 'from_formatted = ' + QuotedStr(Caller)
else
whereSQL := whereSQL + 'AND from_formatted = ' + QuotedStr(Caller);
if whereSQL = 'where ' then
whereSQL := '';
if (OrderBy = '') or (OrderBy = 'Date') then
orderBySQL := 'order by calls.date_created desc'
else
orderBySQL := 'order by calls.from_formatted desc';
//this SQL will enventually be modifed for more generic work
SQL := 'select * ' +
'from calls inner join recordings on calls.sid = recordings.call_sid ' +
whereSQL + ' ' + orderBySQL + ' ' + 'limit ' + limit + ' offset ' + offset;
doQuery(callsDB.UniQuery1, SQL);
Result:= TCallList.Create;
Result.data := TList<TCallItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do
begin
call := TCallItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( call );
Result.data.Add( call );
call.callSid := callsDB.UniQuery1.FieldByName('sid').AsString;
call.fromNumber := callsDB.UniQuery1.FieldByName('from_formatted').AsString;
call.ToNumber := callsDB.UniQuery1.FieldByName('to_formatted').AsString;
call.dateCreated := callsDB.UniQuery1.FieldByName('date_created').AsString;
call.mediaUrl := callsDB.UniQuery1.FieldByName('media_url').AsString;
call.duration := callsDB.UniQuery1.FieldByName('duration').AsString;
call.transcription := callsDB.UniQuery1.FieldByName('transcription').AsString;
callsDB.UniQuery1.Next;
end;
callsDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from calls inner join recordings on calls.sid = recordings.call_sid ' +
whereSQL;
doQuery(callsDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close;
end;
function TLookupService.GetOrders(searchOptions: string): TOrderList; function TLookupService.GetOrders(searchOptions: string): TOrderList;
var var
params: TStringList; params: TStringList;
...@@ -271,52 +158,32 @@ begin ...@@ -271,52 +158,32 @@ begin
'ORDER BY o.ORDER_DATE DESC ' + 'ORDER BY o.ORDER_DATE DESC ' +
'LIMIT ' + limit + ' OFFSET ' + offset; 'LIMIT ' + limit + ' OFFSET ' + offset;
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result:= TOrderList.Create; Result:= TOrderList.Create;
Result.data := TList<TOrderItem>.Create; Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not ordersDB.UniQuery1.Eof do
while not callsDB.UniQuery1.Eof do
begin begin
Order := TOrderItem.Create; Order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order );
Result.data.Add( Order ); Result.data.Add( Order );
order.ID := callsDB.UniQuery1.FieldByName('ORDER_ID').AsString; order.ID := ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString;
order.companyName := callsDB.UniQuery1.FieldByName('COMPANY_NAME').AsString; order.companyName := ordersDB.UniQuery1.FieldByName('COMPANY_NAME').AsString;
order.jobName := callsDB.UniQuery1.FieldByName('JOB_NAME').AsString; order.jobName := ordersDB.UniQuery1.FieldByName('JOB_NAME').AsString;
order.orderDate := callsDB.UniQuery1.FieldByName('ORDER_DATE').AsString; order.orderDate := ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsString;
order.proofDue := callsDB.UniQuery1.FieldByName('PROOF_DUE').AsString; order.proofDue := ordersDB.UniQuery1.FieldByName('PROOF_DUE').AsString;
order.proofDone := callsDB.UniQuery1.FieldByName('PROOF_DONE').AsString; order.proofDone := ordersDB.UniQuery1.FieldByName('PROOF_DONE').AsString;
order.artDue := callsDB.UniQuery1.FieldByName('ART_DUE').AsString; order.artDue := ordersDB.UniQuery1.FieldByName('ART_DUE').AsString;
order.artDone := callsDB.UniQuery1.FieldByName('ART_DONE').AsString; order.artDone := ordersDB.UniQuery1.FieldByName('ART_DONE').AsString;
order.mountDue := callsDB.UniQuery1.FieldByName('MOUNT_DUE').AsString; order.mountDue := ordersDB.UniQuery1.FieldByName('MOUNT_DUE').AsString;
order.mountDone := callsDB.UniQuery1.FieldByName('MOUNT_DONE').AsString; order.mountDone := ordersDB.UniQuery1.FieldByName('MOUNT_DONE').AsString;
order.shipDue := callsDB.UniQuery1.FieldByName('SHIP_DUE').AsString; order.shipDue := ordersDB.UniQuery1.FieldByName('SHIP_DUE').AsString;
order.shipDone := callsDB.UniQuery1.FieldByName('SHIP_DONE').AsString; order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := callsDB.UniQuery1.FieldByName('PRICE').AsString; order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := callsDB.UniQuery1.FieldByName('QB_REF_NUM').AsString; order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').AsString;
{SQL := 'SELECT oss.STATUS_DATE ' + if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
'FROM orders_status_schedule oss ' +
'WHERE oss.ORDER_ID = ' + IntToStr(order.ID) + ' ' +
'AND oss.ORDER_STATUS = ' + QuotedStr('PROOF');
//select oss.STATUS_DATE from orders_status_schedule oss JOIN orders o where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = 'PROOF';
SQL := 'select oss.STATUS_DATE from orders_status_schedule oss where oss.ORDER_ID = ' + IntToStr(order.ID) + ' and oss.ORDER_STATUS = ' + quotedStr('PROOF');
doQuery(callsDB.UniQuery2, SQL);
order.proofDue := callsDB.UniQuery2.FieldByName('STATUS_DATE').AsString;
SQL := '(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = ' + IntToStr(order.ID) + ' and os.ORDER_STATUS = ' + quotedStr('PROOF') + ' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS PROOF_DONE';
doQuery(callsDB.UniQuery2, SQL);
order.proofDone := '???';
order.artDue := callsDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
order.artDone := '???';
order.mountDue := '???';
order.mountDone := '???';
order.shipDue := callsDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
order.shipDone := '???';
order.qbRefNum := -1; }
if callsDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin begin
colorType := 'quantity_and_colors_qty_colors'; colorType := 'quantity_and_colors_qty_colors';
SQL := 'Select quantity_and_colors_qty_colors from web_plate_orders where order_id = ' + order.ID; SQL := 'Select quantity_and_colors_qty_colors from web_plate_orders where order_id = ' + order.ID;
...@@ -329,17 +196,23 @@ begin ...@@ -329,17 +196,23 @@ begin
doQuery(callsDB.UniQuery2, SQL); doQuery(ordersDB.UniQuery2, SQL);
colors := callsDB.UniQuery2.FieldByName(ColorType).AsString; colors := ordersDB.UniQuery2.FieldByName(ColorType).AsString;
order.colors := colors; order.colors := colors;
callsDB.UniQuery1.Next; ordersDB.UniQuery1.Next;
end; end;
callsDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from web_plate_orders'; ordersDB.UniQuery1.Close;
doQuery(callsDB.UniQuery1, SQL); SQL := 'SELECT COUNT(*) AS total_count '+
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger; 'FROM orders o ' +
callsDB.UniQuery1.Close; 'JOIN customers c ON c.CUSTOMER_ID = o.COMPANY_ID ' +
'LEFT JOIN qb_sales_orders qb ON qb.ORDER_ID = o.ORDER_ID';
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
ordersDB.UniQuery1.Close;
end; end;
function TLookupService.GetItems(searchOptions: string): TItemList; function TLookupService.GetItems(searchOptions: string): TItemList;
...@@ -368,29 +241,29 @@ begin ...@@ -368,29 +241,29 @@ begin
SQL := 'select * from qb_items ' + 'limit ' + limit + ' offset ' + offset; SQL := 'select * from qb_items ' + 'limit ' + limit + ' offset ' + offset;
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result:= TItemList.Create; Result:= TItemList.Create;
Result.data := TList<TItemItem>.Create; Result.data := TList<TItemItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do while not ordersDB.UniQuery1.Eof do
begin begin
item := TItemItem.Create; item := TItemItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( item ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( item );
Result.data.Add( item ); Result.data.Add( item );
item.ID := callsDB.UniQuery1.FieldByName('qb_items_id').AsString; item.ID := ordersDB.UniQuery1.FieldByName('qb_items_id').AsString;
item.name := callsDB.UniQuery1.FieldByName('qb_item_name').AsString; item.name := ordersDB.UniQuery1.FieldByName('qb_item_name').AsString;
item.description := callsDB.UniQuery1.FieldByName('item_desc').AsString; item.description := ordersDB.UniQuery1.FieldByName('item_desc').AsString;
item.status := callsDB.UniQuery1.FieldByName('status').AsString; item.status := ordersDB.UniQuery1.FieldByName('status').AsString;
callsDB.UniQuery1.Next; ordersDB.UniQuery1.Next;
end; end;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from qb_items'; SQL:= 'select count(*) as total_count from qb_items';
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger; Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
end; end;
function TLookupService.GetUsers(searchOptions: string): TUserList; function TLookupService.GetUsers(searchOptions: string): TUserList;
...@@ -402,34 +275,34 @@ begin ...@@ -402,34 +275,34 @@ begin
SQL := 'select * from users order by NAME ASC' SQL := 'select * from users order by NAME ASC'
else else
SQL := 'select * from users where username=' + quotedStr(searchOptions); SQL := 'select * from users where username=' + quotedStr(searchOptions);
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result:= TUserList.Create; Result:= TUserList.Create;
Result.data := TList<TUserItem>.Create; Result.data := TList<TUserItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do while not ordersDB.UniQuery1.Eof do
begin begin
user := TUserItem.Create; user := TUserItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( user ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( user );
Result.data.Add( user ); Result.data.Add( user );
user.userID := callsDB.UniQuery1.FieldByName('USER_ID').AsString; user.userID := ordersDB.UniQuery1.FieldByName('USER_ID').AsString;
user.username := callsDB.UniQuery1.FieldByName('USER_NAME').AsString; user.username := ordersDB.UniQuery1.FieldByName('USER_NAME').AsString;
user.password := callsDB.UniQuery1.FieldByName('PASSWORD').AsString; user.password := ordersDB.UniQuery1.FieldByName('PASSWORD').AsString;
user.full_name := callsDB.UniQuery1.FieldByName('NAME').AsString; user.full_name := ordersDB.UniQuery1.FieldByName('NAME').AsString;
user.status := callsDB.UniQuery1.FieldByName('STATUS').AsString; user.status := ordersDB.UniQuery1.FieldByName('STATUS').AsString;
user.email_address := callsDB.UniQuery1.FieldByName('EMAIL').AsString; user.email_address := ordersDB.UniQuery1.FieldByName('EMAIL').AsString;
user.AType := callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString; user.AType := ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString;
user.rights := callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger; user.rights := ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger;
user.perspectiveID := callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString; user.perspectiveID := ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString;
user.QBID := callsDB.UniQuery1.FieldByName('QB_ID').AsString; user.QBID := ordersDB.UniQuery1.FieldByName('QB_ID').AsString;
callsDB.UniQuery1.Next; ordersDB.UniQuery1.Next;
end; end;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from users'; SQL:= 'select count(*) as total_count from users';
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger; Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
end; end;
function TLookupService.EditUser(const editOptions: string): string; function TLookupService.EditUser(const editOptions: string): string;
...@@ -468,57 +341,57 @@ begin ...@@ -468,57 +341,57 @@ begin
newUser := params.Values['newuser']; newUser := params.Values['newuser'];
SQL := 'select * from users where USER_NAME = ' + QuotedStr(user); SQL := 'select * from users where USER_NAME = ' + QuotedStr(user);
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
if callsDB.UniQuery1.IsEmpty then if ordersDB.UniQuery1.IsEmpty then
Result := 'Failure:No such user found' Result := 'Failure:No such user found'
else else
begin begin
callsDB.UniQuery1.Edit; ordersDB.UniQuery1.Edit;
//user.password := callsDB.UniQuery1.FieldByName('PASSWORD').AsString; //user.password := ordersDB.UniQuery1.FieldByName('PASSWORD').AsString;
if (not (newUser.IsEmpty)) then if (not (newUser.IsEmpty)) then
callsDB.UniQuery1.FieldByName('USER_NAME').AsString := newUser; ordersDB.UniQuery1.FieldByName('USER_NAME').AsString := newUser;
if (not (full_name.IsEmpty)) then if (not (full_name.IsEmpty)) then
callsDB.UniQuery1.FieldByName('NAME').AsString := full_name; ordersDB.UniQuery1.FieldByName('NAME').AsString := full_name;
if (not (status.IsEmpty)) then if (not (status.IsEmpty)) then
begin begin
if( StrToBool(status) ) then if( StrToBool(status) ) then
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE' ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else else
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE' ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE'
end; end;
if (not (email.IsEmpty)) then if (not (email.IsEmpty)) then
callsDB.UniQuery1.FieldByName('EMAIL').AsString := email; ordersDB.UniQuery1.FieldByName('EMAIL').AsString := email;
if (not (access.IsEmpty)) then if (not (access.IsEmpty)) then
callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access; ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
if (not (rights.IsEmpty)) then if (not (rights.IsEmpty)) then
callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights); ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
if (not (perspective.IsEmpty)) then if (not (perspective.IsEmpty)) then
callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective; ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
if (not (QB.IsEmpty)) then if (not (QB.IsEmpty)) then
callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB; ordersDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
{if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then {if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then
begin begin
hashString := callsDB.UniQuery1.FieldByName('date_created').AsString + password; hashString := ordersDB.UniQuery1.FieldByName('date_created').AsString + password;
hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper; hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
callsDB.UniQuery1.FieldByName('password').AsString := hashPW; ordersDB.UniQuery1.FieldByName('password').AsString := hashPW;
end;} end;}
callsDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
Result := 'Success:Edit Successful'; Result := 'Success:Edit Successful';
end; end;
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
end; end;
...@@ -558,31 +431,31 @@ begin ...@@ -558,31 +431,31 @@ begin
//hashString := DateTimeToStr(dateCreated) + params.Values['password']; //hashString := DateTimeToStr(dateCreated) + params.Values['password'];
//hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper; //hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
SQL := 'select * from users where USER_NAME = ' + QuotedStr(params.Values['username'].toLower); SQL := 'select * from users where USER_NAME = ' + QuotedStr(params.Values['username'].toLower);
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
callsDB.UniQuery1.SQL.Text := SQL; ordersDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.Open; ordersDB.UniQuery1.Open;
if callsDB.UniQuery1.IsEmpty then if ordersDB.UniQuery1.IsEmpty then
begin begin
callsDB.UniQuery1.Insert; ordersDB.UniQuery1.Insert;
callsDB.UniQuery1.FieldByName('USER_NAME').AsString := user; ordersDB.UniQuery1.FieldByName('USER_NAME').AsString := user;
callsDB.UniQuery1.FieldByName('PASSWORD').AsString := password; ordersDB.UniQuery1.FieldByName('PASSWORD').AsString := password;
//THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper; //THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
//callsDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated); //ordersDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated);
callsDB.UniQuery1.FieldByName('NAME').AsString := full_name; ordersDB.UniQuery1.FieldByName('NAME').AsString := full_name;
if( StrToBool(status) ) then if( StrToBool(status) ) then
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE' ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else else
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE'; ordersDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE';
callsDB.UniQuery1.FieldByName('EMAIL').AsString := email; ordersDB.UniQuery1.FieldByName('EMAIL').AsString := email;
callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access; ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights); ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective; ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB; ordersDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
callsDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
Result := 'Success:User successfully added'; Result := 'Success:User successfully added';
end end
else else
...@@ -609,19 +482,19 @@ begin ...@@ -609,19 +482,19 @@ begin
SQL := 'select * from qb_items where qb_item_name = ' + QuotedStr(Name); SQL := 'select * from qb_items where qb_item_name = ' + QuotedStr(Name);
doQuery(callsDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
if callsDB.UniQuery1.IsEmpty then if ordersDB.UniQuery1.IsEmpty then
begin begin
callsDB.UniQuery1.Insert; ordersDB.UniQuery1.Insert;
callsDB.UniQuery1.FieldByName('qb_item_name').AsString := Name; ordersDB.UniQuery1.FieldByName('qb_item_name').AsString := Name;
callsDB.UniQuery1.FieldByName('item_desc').AsString := Description; ordersDB.UniQuery1.FieldByName('item_desc').AsString := Description;
if Status then if Status then
callsDB.UniQuery1.FieldByName('status').AsString := 'ACTIVE' ordersDB.UniQuery1.FieldByName('status').AsString := 'ACTIVE'
else else
callsDB.UniQuery1.FieldByName('status').AsString := 'INACTIVE'; ordersDB.UniQuery1.FieldByName('status').AsString := 'INACTIVE';
callsDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
Result := 'Success:Item successfully added'; Result := 'Success:Item successfully added';
end end
else else
...@@ -635,18 +508,18 @@ SQL: string; ...@@ -635,18 +508,18 @@ SQL: string;
params: TStringList; params: TStringList;
begin begin
SQL := 'select * from users where username = ' + QuotedStr(username.toLower); SQL := 'select * from users where username = ' + QuotedStr(username.toLower);
callsDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
callsDB.UniQuery1.SQL.Text := SQL; ordersDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.Open; ordersDB.UniQuery1.Open;
if callsDB.UniQuery1.IsEmpty then if ordersDB.UniQuery1.IsEmpty then
begin begin
Result := 'Failure:User does not exist'; Result := 'Failure:User does not exist';
end end
else else
begin begin
SQL:= 'DELETE FROM users where username = ' + QuotedStr(username.toLower); SQL:= 'DELETE FROM users where username = ' + QuotedStr(username.toLower);
callsDB.UniQuery1.SQL.Text := SQL; ordersDB.UniQuery1.SQL.Text := SQL;
callsDB.UniQuery1.ExecSQL; ordersDB.UniQuery1.ExecSQL;
Result := 'Success:User deleted'; Result := 'Success:User deleted';
end; end;
end; end;
......
unit Main; unit Main;
//Main form of the program. This program gets calls/recordings/transcriptions from
//twilio and stores them in a database. From there it is able to be accessed by the client.
//Has access to every visual form for debugging purposes.
//Authors: //Authors:
//Elias Sarraf //Elias Sarraf
//Mac ... //Mac ...
......
...@@ -156,6 +156,6 @@ begin ...@@ -156,6 +156,6 @@ begin
Application.MainFormOnTaskbar := True; Application.MainFormOnTaskbar := True;
Application.CreateForm(TFMain, FMain); Application.CreateForm(TFMain, FMain);
Logger.AddAppender(TMemoLogAppender.Create( 5, FMain.memoinfo )); Logger.AddAppender(TMemoLogAppender.Create( 5, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create( 5, 'envoyCallsServer' )); Logger.AddAppender(TFileLogAppender.Create( 5, 'kgOrdersServer' ));
Application.Run; Application.Run;
end. end.
[Options] [Options]
LogFileNum=92 LogFileNum=98
UpdateTimerLength=0 UpdateTimerLength=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment