Changeset 35 for trunk/Forms/UMainForm.pas
- Timestamp:
- Nov 25, 2011, 9:17:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r32 r35 112 112 UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo, 113 113 UCore, UImportStructureForm, UAboutForm, ULoginProfileForm, UChronisClientDirect, 114 UItemList ;114 UItemList, UChronisClient; 115 115 116 116 {$R *.lfm} … … 334 334 procedure TMainForm.LoadTree; 335 335 var 336 DbRows: TDbRows; 337 ObjectDbRows: TDbRows; 336 Groups: TListProxy; 337 Obj: TObjectProxy; 338 Objects: TListProxy; 339 Obj2: TObjectProxy; 338 340 I: Integer; 339 341 O: Integer; … … 348 350 TopItem.SelectedIndex := 0; 349 351 try 350 DbRows := TDbRows.Create; 351 Core.System.Database.Query(DbRows, 'SELECT * FROM `' + ObjectGroupTable + '`'); 352 for I := 0 to DbRows.Count - 1 do begin 353 NewNode := AddChild(TopItem, DbRows[I].Values['Name']); 352 Groups := TListProxy.Create; 353 Groups.Client := Core.System.Client; 354 Groups.ObjectName := ObjectGroupTable; 355 Groups.SchemaName := Core.System.Database.Database; 356 Groups.Load; 357 for I := 0 to Groups.Objects.Count - 1 do begin 358 Obj := TObjectProxy(Groups.Objects[I]); 359 NewNode := AddChild(TopItem, Obj.Properties.Values['Name']); 354 360 NewNode.ImageIndex := 0; 355 361 NewNode.SelectedIndex := 0; 356 NewNode.Data := Pointer(StrToInt( DbRows[I].Values['Id']));362 NewNode.Data := Pointer(StrToInt(Obj.Properties.Values['Id'])); 357 363 try 358 ObjectDbRows := TDbRows.Create; 359 Core.System.Database.Query(ObjectDbRows, 'SELECT * FROM `' + ObjectTable + '` WHERE `Group`=' + DbRows[I].Values['Id']); 360 for O := 0 to ObjectDbRows.Count - 1 do begin 361 NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']); 362 NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id'])); 364 Objects := TListProxy.Create; 365 Objects.Client := Core.System.Client; 366 Objects.ObjectName := ObjectTable; 367 Objects.SchemaName := Core.System.Database.Database; 368 Objects.SetCondition('Group', Obj.Properties.Values['Id']); 369 Objects.Load; 370 for O := 0 to Objects.Objects.Count - 1 do begin 371 Obj2 := TObjectProxy(Objects.Objects[O]); 372 NewObjectNode := AddChild(NewNode, Obj2.Properties.Values['Name']); 373 NewObjectNode.Data := Pointer(StrToInt(Obj2.Properties.Values['Id'])); 363 374 NewObjectNode.ImageIndex := 1; 364 375 NewObjectNode.SelectedIndex := 1; 365 376 end; 366 377 finally 367 Object DbRows.Free;378 Objects.Free; 368 379 end; 369 380 end; 370 381 TopItem.Expand(True); 371 382 finally 372 DbRows.Free;383 Groups.Free; 373 384 end; 374 385 TreeState.LoadTree(TreeView1);
Note:
See TracChangeset
for help on using the changeset viewer.