UsersDBProvider.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. unit UsersDBProvider;
  2. interface
  3. //uses
  4. // System.Classes, BaseDataProvider, InterfaceDataProvider;
  5. //
  6. //type
  7. // TUsersDBProvider = class(TBaseDataProvider, IAppIconProvider)
  8. // protected
  9. // function GetTableName: string; override;
  10. // function GetCreateTableSQL: string; override;
  11. // public
  12. // procedure Insert(ATeamID, AUID: WideString); stdcall;
  13. // procedure Delete(ATeamID, AUID: WideString); overload; stdcall;
  14. // procedure Delete(ATeamID: WideString); overload; stdcall;
  15. // procedure Find(ATeamID, AUID: WideString); overload; stdcall;
  16. // procedure Find(ATeamID: WideString); overload; stdcall;
  17. // end;
  18. implementation
  19. //uses
  20. // FireDAC.Comp.Client, BaseDataModule, System.SysUtils, System.VarUtils, System.Variants,
  21. // Data.DB, LoggerImport;
  22. //
  23. //const
  24. // TABLE_NAME: string = 'Users';
  25. // CREATE_TABLE: string = 'CREATE TABLE Users('+
  26. // 'LoginName string(50), ' +
  27. // 'ServerID string(50), ' +
  28. // 'BranchID string(50), ' +
  29. // 'DisplayName string(50), ' +
  30. // 'TrueName string(50), ' +
  31. // 'Mobile string(50), ' +
  32. // 'Email string(50), ' +
  33. // 'HeadImageFileType integer, ' +
  34. // 'Province string(50), ' +
  35. // 'Company string(50), ' +
  36. // 'HeadImageHashValue string(50), ' +
  37. // 'Calling string(50), ' +
  38. // 'LeaveMessage string(50), ' +
  39. // 'Tel string(50), ' +
  40. // 'Watchword string(50), ' +
  41. // 'HomeAddress string(50), ' +
  42. // 'Post string(50), ' +
  43. // 'RemarkMobile string(50), ' +
  44. // 'Country string(50), ' +
  45. // 'Branch string(50), ' +
  46. // 'ShortMobile string(50), ' +
  47. // 'Sex integer, ' +
  48. // 'City string(50), ' +
  49. // 'Duty string(50), ' +
  50. // 'Intro string(50), ' +
  51. // 'HeadImageFile string(50), ' +
  52. // 'Version integer, ' +
  53. // 'CreateTime Double)';
  54. // INSERT_ONE_SQL: string = 'INSERT INTO Users('+
  55. // ':LoginName, ' +
  56. // ':ServerID, ' +
  57. // ':BranchID, ' +
  58. // ':DisplayName, ' +
  59. // ':TrueName, ' +
  60. // ':Mobile, ' +
  61. // ':Email, ' +
  62. // ':HeadImageFileType, ' +
  63. // ':Province, ' +
  64. // ':Company, ' +
  65. // ':HeadImageHashValue, ' +
  66. // ':Calling, ' +
  67. // ':LeaveMessage, ' +
  68. // ':Tel, ' +
  69. // ':Watchword, ' +
  70. // ':HomeAddress, ' +
  71. // ':Post, ' +
  72. // ':RemarkMobile, ' +
  73. // ':Country, ' +
  74. // ':Branch, ' +
  75. // ':ShortMobile, ' +
  76. // ':Sex, ' +
  77. // ':City, ' +
  78. // ':Duty, ' +
  79. // ':Intro, ' +
  80. // ':HeadImageFile, ' +
  81. // ':Version, ' +
  82. // ':CreateTime) VALUES('+
  83. // ':LoginName, ' +
  84. // ':ServerID, ' +
  85. // ':BranchID, ' +
  86. // ':DisplayName, ' +
  87. // ':TrueName, ' +
  88. // ':Mobile, ' +
  89. // ':Email, ' +
  90. // ':HeadImageFileType, ' +
  91. // ':Province, ' +
  92. // ':Company, ' +
  93. // ':HeadImageHashValue, ' +
  94. // ':Calling, ' +
  95. // ':LeaveMessage, ' +
  96. // ':Tel, ' +
  97. // ':Watchword, ' +
  98. // ':HomeAddress, ' +
  99. // ':Post, ' +
  100. // ':RemarkMobile, ' +
  101. // ':Country, ' +
  102. // ':Branch, ' +
  103. // ':ShortMobile, ' +
  104. // ':Sex, ' +
  105. // ':City, ' +
  106. // ':Duty, ' +
  107. // ':Intro, ' +
  108. // ':HeadImageFile, ' +
  109. // ':Version, ' +
  110. // ':CreateTime)';
  111. // DELETE_ONE_SQL: string = 'DELETE FROM Users WHERE ServerID = :ServerID and LoginName = :LoginName';
  112. // DELETE_ALL: string = 'DELETE FROM Users WHERE ServerID = :ServerID';
  113. //
  114. //
  115. //// public string TeamID { get; set; }
  116. //// public string UID { get; set; }
  117. //// public string Nickname { get; set; }
  118. //// public DateTime JoinDate { get; set; }
  119. //// public MemberType Type { get; set; }
  120. //
  121. //{ TAppIconProvider }
  122. //
  123. //procedure TUsersDBProvider.FindIcon(AAppKey: WideString; var ABuffer); stdcall;
  124. //var
  125. // AQuery: TFDQuery;
  126. // ACode: string;
  127. //begin
  128. // if (AAppKey = '') then
  129. // Exit;
  130. // ACode := Format('TAppIconProvider.FindIcon(%s)', [AAppKey]);
  131. //
  132. // try
  133. // AQuery := BaseDataModel.GetQuery;
  134. // AQuery.Connection.Connected := True;
  135. // AQuery.Open(APPICON_FINDICON, [AAppKey]);
  136. // AQuery.First;
  137. // if not AQuery.Eof then
  138. // TBytes(ABuffer) := AQuery.FieldByName('Icon').AsBytes;
  139. // except
  140. // on E: Exception do
  141. // begin
  142. // Error(E.Message, ACode);
  143. // BaseDataModel.GiveBackQuery(AQuery);
  144. // end;
  145. // end;
  146. // BaseDataModel.GiveBackQuery(AQuery);
  147. //end;
  148. //
  149. //function TUsersDBProvider.GetCreateTableSQL: string;
  150. //begin
  151. // Result := CREATE_TABLE;
  152. //end;
  153. //
  154. //function TUsersDBProvider.GetTableName: string;
  155. //begin
  156. // Result := TABLE_NAME;
  157. //end;
  158. //
  159. //procedure TUsersDBProvider.Insert(ATeamID, AUID: WideString);
  160. //var
  161. // AConnection: TFDCustomConnection;
  162. // ALen: Cardinal;
  163. //begin
  164. // ALen := Length(TBytes(ABuffer));
  165. // if (AAppKey = '') or (ALen = 0) then
  166. // Exit;
  167. // AConnection := BaseDataModel.GetConnection;
  168. // try
  169. // AConnection.Connected := True;
  170. // AConnection.ExecSQL(APPICON_DELETE, [AAppKey]);
  171. // AConnection.ExecSQL(APPICON_INSERT, [AAppKey, TBytes(ABuffer), 0, Now]);
  172. // finally
  173. // BaseDataModel.GiveBackConnection(AConnection);
  174. // end;
  175. //end;
  176. end.