2
0

frmMain.pas 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. (* _ _
  2. * | |__ _ __ ___ ___ | | __
  3. * | '_ \| '__/ _ \ / _ \| |/ /
  4. * | |_) | | | (_) | (_) | <
  5. * |_.__/|_| \___/ \___/|_|\_\
  6. *
  7. * Microframework which helps to develop web Pascal applications.
  8. *
  9. * Copyright (c) 2012-2021 Silvio Clecio <[email protected]>
  10. *
  11. * Brook framework is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation; either
  14. * version 2.1 of the License, or (at your option) any later version.
  15. *
  16. * Brook framework is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with Brook framework; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *)
  25. unit frmMain;
  26. interface
  27. uses
  28. System.Classes,
  29. System.Rtti,
  30. System.Bindings.Outputs,
  31. Data.DB,
  32. Data.Bind.Controls,
  33. Data.Bind.EngExt,
  34. Data.Bind.Components,
  35. Data.Bind.Grid,
  36. Data.Bind.DBScope,
  37. FMX.Types,
  38. FMX.Controls,
  39. FMX.Controls.Presentation,
  40. FMX.StdCtrls,
  41. FMX.Grid,
  42. FMX.Grid.Style,
  43. FMX.ScrollBox,
  44. FMX.Forms,
  45. FMX.Layouts,
  46. Fmx.Bind.DBEngExt,
  47. Fmx.Bind.Grid,
  48. Fmx.Bind.Editors,
  49. Fmx.Bind.Navigator,
  50. DMClient;
  51. const
  52. URL_SERVER = 'http://localhost:8080';
  53. type
  54. TfrMain = class(TForm)
  55. pnBottom: TPanel;
  56. btLoad: TButton;
  57. btSave: TButton;
  58. DataSource: TDataSource;
  59. Grid1: TGrid;
  60. BindSourceDB: TBindSourceDB;
  61. BindingsList: TBindingsList;
  62. LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource;
  63. BindNavigator1: TBindNavigator;
  64. procedure btLoadClick(Sender: TObject);
  65. procedure btSaveClick(Sender: TObject);
  66. end;
  67. var
  68. frMain: TfrMain;
  69. implementation
  70. {$R *.fmx}
  71. procedure TfrMain.btLoadClick(Sender: TObject);
  72. begin
  73. Client.LoadPersons(URL_SERVER);
  74. btSave.Enabled := DataSource.DataSet.RecordCount > 0;
  75. end;
  76. procedure TfrMain.btSaveClick(Sender: TObject);
  77. begin
  78. Client.SavePersons(URL_SERVER);
  79. end;
  80. end.