frmMain.pas 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. {$MODE DELPHI}
  27. interface
  28. uses
  29. Classes,
  30. DB,
  31. StdCtrls,
  32. ExtCtrls,
  33. DBGrids,
  34. DBCtrls,
  35. Forms,
  36. DMClient;
  37. const
  38. URL_SERVER = 'http://localhost:8080';
  39. type
  40. TfrMain = class(TForm)
  41. btLoad: TButton;
  42. btSave: TButton;
  43. DataSource: TDataSource;
  44. DBGrid: TDBGrid;
  45. DBNavigator: TDBNavigator;
  46. pnBottom: TPanel;
  47. procedure btLoadClick(Sender: TObject);
  48. procedure btSaveClick(Sender: TObject);
  49. end;
  50. var
  51. frMain: TfrMain;
  52. implementation
  53. {$R *.lfm}
  54. procedure TfrMain.btLoadClick(Sender: TObject);
  55. begin
  56. Client.LoadPersons(URL_SERVER);
  57. btSave.Enabled := DataSource.DataSet.RecordCount > 0;
  58. end;
  59. procedure TfrMain.btSaveClick(Sender: TObject);
  60. begin
  61. Client.SavePersons(URL_SERVER);
  62. end;
  63. end.