Changeset 23 for trunk/Forms
- Timestamp:
- Mar 26, 2018, 12:40:10 AM (7 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormFields.pas
r22 r23 91 91 if FormField.ShowModal = mrOk then begin 92 92 FormField.Save(NewField); 93 Fields.Table.DbClient.Query('INSERT INTO ModelField ( Name , TextBefore) VALUES ( ' +94 NewField.Name + ' , ' + NewField.TextBefore + ' )');93 Fields.Table.DbClient.Query('INSERT INTO ModelField ( Name , Caption , Model , DataType ) VALUES ( ' + 94 NewField.Name + ' , ' + NewField.TextBefore + ' , ' + TableName + ' , ' + NewField.DataType.Name + ' )'); 95 95 ReloadList; 96 96 end else NewField.Free; … … 160 160 I: Integer; 161 161 begin 162 Fields.Clear; 162 163 DbRows := TDbRows.Create; 163 164 Fields.Table.DbClient.Query('SELECT * FROM ModelField WHERE Model = ' + Fields.Table.Name, DbRows); 164 165 for I := 0 to DbRows.Count - 1 do begin 165 NewField := TField.Create; 166 NewField.Table := Fields.Table; 167 Fields.Add(NewField); 166 NewField := Fields.AddNew(DbRows[I].Values['Name'], Fields.Table.DbClient.DbManager.DataTypes.SearchByName(DbRows[I].Values['DataType'])); 167 NewField.TextBefore := DbRows[I].Values['Caption']; 168 168 end; 169 169 DbRows.Free; -
trunk/Forms/UFormTables.pas
r22 r23 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, UDatabase ;9 ActnList, Menus, UDatabase, SpecializedDictionary; 10 10 11 11 type … … 212 212 procedure TFormTables.FormCreate(Sender: TObject); 213 213 begin 214 FTables := TTables.Create (False);214 FTables := TTables.Create; 215 215 end; 216 216 … … 232 232 procedure TFormTables.ReloadList; 233 233 var 234 DbRows: TDbRows; 235 NewTable: TTable; 234 236 I: Integer; 235 237 begin 236 if Assigned(DbClient) then DbClient.LoadTables(Tables) 237 else Tables.Clear; 238 Tables.Clear; 239 if Assigned(DbClient) then begin 240 DbRows := TDbRows.Create; 241 DbClient.Query('SELECT * FROM Model', DbRows); 242 for I := 0 to DbRows.Count - 1 do begin 243 NewTable := Tables.AddNew(TDictionaryStringString(DbRows[I]).Values['Name']); 244 NewTable.Caption := TDictionaryStringString(DbRows[I]).Values['Caption']; 245 end; 246 DbRows.Free; 247 end; 248 238 249 for I := 0 to Tables.Count - 1 do 239 250 TTable(Tables[I]).LoadRecordsCount;
Note:
See TracChangeset
for help on using the changeset viewer.