Changeset 37 for trunk/Forms
- Timestamp:
- Mar 8, 2012, 3:11:10 PM (13 years ago)
- Location:
- trunk/Forms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemAdd.pas
r31 r37 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 9 StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem, 10 SpecializedDictionary, SpecializedList ;10 SpecializedDictionary, SpecializedList, UChronisClient; 11 11 12 12 type … … 53 53 var 54 54 Data: TDictionaryStringString; 55 NewProxy: TObjectProxy; 55 56 I: Integer; 56 57 DataType: TDataType; … … 59 60 try 60 61 Data := TDictionaryStringString.Create; 62 NewProxy := TObjectProxy.Create; 63 NewProxy.Client := Client; 64 NewProxy.ObjectName := SelectedObject.Table; 65 NewProxy.SchemaName := SelectedObject.Schema; 61 66 for I := 0 to Report.Columns.Count - 1 do 62 67 if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then 63 68 if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin 64 69 DataType := TReportColumn(Report.Columns[I]).CustomType; 65 Data.Add(TReportColumn(Report.Columns[I]).ColumnName,70 NewProxy.Properties.Add(TReportColumn(Report.Columns[I]).ColumnName, 66 71 DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control))); 67 72 end; 68 Database.Insert(SelectedObject.Table, Data, SelectedObject.Schema);73 NewProxy.Save; 69 74 finally 70 75 Data.Free; 76 NewProxy.Free; 71 77 end; 72 78 //MainForm.LoadItemList; -
trunk/Forms/UItemEdit.pas
r31 r37 1 1 unit UItemEdit; 2 2 3 {$mode objfpc}{$H+}3 {$mode Delphi}{$H+} 4 4 5 5 interface … … 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 9 StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit, ComCtrls, USystem, 10 SpecializedList, SpecializedDictionary ;10 SpecializedList, SpecializedDictionary, UChronisClient; 11 11 12 12 type … … 119 119 procedure TItemEditForm.ButtonSaveClick(Sender: TObject); 120 120 var 121 Data: TDictionaryStringString;121 Proxy: TObjectProxy; 122 122 I: Integer; 123 123 DataType: TDataType; … … 125 125 with Core.System do 126 126 try 127 Data := TDictionaryStringString.Create; 127 Proxy := TObjectProxy.Create; 128 Proxy.Client := Client; 129 Proxy.ObjectName := SelectedObject.Table; 130 Proxy.SchemaName := SelectedObject.Schema; 131 Proxy.Id := SelectedItemId; 128 132 for I := 0 to Report.Columns.Count - 1 do 129 133 if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then 130 134 if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin 131 135 DataType := TReportColumn(Report.Columns[I]).CustomType; 132 Data.Add(TReportColumn(Report.Columns[I]).ColumnName,136 Proxy.Properties.Add(TReportColumn(Report.Columns[I]).ColumnName, 133 137 DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control))); 134 138 end; 135 Database.Update(SelectedObject.Table, Data, 136 '`' + SelectedObject.PrimaryKey + '` = ' + IntToStr(SelectedItemId), SelectedObject.Schema); 139 Proxy.Save; 137 140 finally 138 Data.Free;141 Proxy.Free; 139 142 end; 140 143 if (SelectedObject.Table = ObjectGroupTable) or -
trunk/Forms/UMainForm.pas
r36 r37 148 148 procedure TMainForm.UpdateInterface; 149 149 begin 150 ADisconnect.Enabled := Core.System. Database.Connected;151 AConnect.Enabled := not Core.System. Database.Connected;152 AImportStructure.Enabled := Core.System. Database.Connected;150 ADisconnect.Enabled := Core.System.Client.Connected; 151 AConnect.Enabled := not Core.System.Client.Connected; 152 AImportStructure.Enabled := Core.System.Client.Connected; 153 153 if Assigned(MainPanelForm) then 154 154 Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name … … 257 257 if LoginForm.ShowModal = mrOK then begin 258 258 with TConnectProfile(Core.Profiles[Core.LastProfile]) do begin 259 Core.System. Database.HostName:= HostName;260 Core.System. Database.Database:= Database;261 Core.System. Database.UserName:= Core.LastUserName;262 Core.System. Database.Password := Core.LastPassword;263 Core.System. Database.Port := Port;259 Core.System.Client.Host := HostName; 260 Core.System.Client.Schema := Database; 261 Core.System.Client.User := Core.LastUserName; 262 Core.System.Client.Password := Core.LastPassword; 263 Core.System.Client.Port := Port; 264 264 if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create; 265 265 end; 266 266 try 267 Core.System. Database.Connect;267 Core.System.Client.Connect; 268 268 if Core.System.IsDatabaseEmpty then Core.System.ModuleSystem.Install; 269 269 Core.System.LoadTypes; … … 277 277 procedure TMainForm.ADisconnectExecute(Sender: TObject); 278 278 begin 279 if Core.System. Database.Connected then begin280 Core.System. Database.Disconnect;279 if Core.System.Client.Connected then begin 280 Core.System.Client.Disconnect; 281 281 TreeView1.Items.Clear; 282 282 Core.System.Types.Clear; … … 361 361 Groups.Client := Core.System.Client; 362 362 Groups.ObjectName := ObjectGroupTable; 363 Groups.SchemaName := Core.System. Database.Database;363 Groups.SchemaName := Core.System.Client.Schema; 364 364 Groups.Load; 365 365 for I := 0 to Groups.Objects.Count - 1 do begin … … 373 373 Objects.Client := Core.System.Client; 374 374 Objects.ObjectName := ObjectTable; 375 Objects.SchemaName := Core.System. Database.Database;376 Objects. SetCondition('Group', Obj.Properties.Values['Id']);375 Objects.SchemaName := Core.System.Client.Schema; 376 Objects.Condition := '`Group`="' + Obj.Properties.Values['Id'] + '"'; 377 377 Objects.Load; 378 378 for O := 0 to Objects.Objects.Count - 1 do begin
Note:
See TracChangeset
for help on using the changeset viewer.