Changeset 37 for trunk/Forms


Ignore:
Timestamp:
Mar 8, 2012, 3:11:10 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Direct acces using Database: TSqlDatabase replaced by TChronisClient interface.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemAdd.pas

    r31 r37  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    99  StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem,
    10   SpecializedDictionary, SpecializedList;
     10  SpecializedDictionary, SpecializedList, UChronisClient;
    1111
    1212type
     
    5353var
    5454  Data: TDictionaryStringString;
     55  NewProxy: TObjectProxy;
    5556  I: Integer;
    5657  DataType: TDataType;
     
    5960  try
    6061    Data := TDictionaryStringString.Create;
     62    NewProxy := TObjectProxy.Create;
     63    NewProxy.Client := Client;
     64    NewProxy.ObjectName := SelectedObject.Table;
     65    NewProxy.SchemaName := SelectedObject.Schema;
    6166    for I := 0 to Report.Columns.Count - 1 do
    6267    if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then
    6368    if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin
    6469      DataType := TReportColumn(Report.Columns[I]).CustomType;
    65       Data.Add(TReportColumn(Report.Columns[I]).ColumnName,
     70      NewProxy.Properties.Add(TReportColumn(Report.Columns[I]).ColumnName,
    6671        DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control)));
    6772    end;
    68     Database.Insert(SelectedObject.Table, Data, SelectedObject.Schema);
     73    NewProxy.Save;
    6974  finally
    7075    Data.Free;
     76    NewProxy.Free;
    7177  end;
    7278  //MainForm.LoadItemList;
  • trunk/Forms/UItemEdit.pas

    r31 r37  
    11unit UItemEdit;
    22
    3 {$mode objfpc}{$H+}
     3{$mode Delphi}{$H+}
    44
    55interface
     
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    99  StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit, ComCtrls, USystem,
    10   SpecializedList, SpecializedDictionary;
     10  SpecializedList, SpecializedDictionary, UChronisClient;
    1111
    1212type
     
    119119procedure TItemEditForm.ButtonSaveClick(Sender: TObject);
    120120var
    121   Data: TDictionaryStringString;
     121  Proxy: TObjectProxy;
    122122  I: Integer;
    123123  DataType: TDataType;
     
    125125  with Core.System do
    126126  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;
    128132    for I := 0 to Report.Columns.Count - 1 do
    129133    if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then
    130134    if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin
    131135      DataType := TReportColumn(Report.Columns[I]).CustomType;
    132       Data.Add(TReportColumn(Report.Columns[I]).ColumnName,
     136      Proxy.Properties.Add(TReportColumn(Report.Columns[I]).ColumnName,
    133137        DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control)));
    134138    end;
    135     Database.Update(SelectedObject.Table, Data,
    136       '`' + SelectedObject.PrimaryKey + '` = ' + IntToStr(SelectedItemId), SelectedObject.Schema);
     139    Proxy.Save;
    137140  finally
    138     Data.Free;
     141    Proxy.Free;
    139142  end;
    140143  if (SelectedObject.Table = ObjectGroupTable) or
  • trunk/Forms/UMainForm.pas

    r36 r37  
    148148procedure TMainForm.UpdateInterface;
    149149begin
    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;
    153153  if Assigned(MainPanelForm) then
    154154    Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name
     
    257257  if LoginForm.ShowModal = mrOK then begin
    258258    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;
    264264      if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create;
    265265    end;
    266266    try
    267       Core.System.Database.Connect;
     267      Core.System.Client.Connect;
    268268      if Core.System.IsDatabaseEmpty then Core.System.ModuleSystem.Install;
    269269      Core.System.LoadTypes;
     
    277277procedure TMainForm.ADisconnectExecute(Sender: TObject);
    278278begin
    279   if Core.System.Database.Connected then begin
    280     Core.System.Database.Disconnect;
     279  if Core.System.Client.Connected then begin
     280    Core.System.Client.Disconnect;
    281281    TreeView1.Items.Clear;
    282282    Core.System.Types.Clear;
     
    361361      Groups.Client := Core.System.Client;
    362362      Groups.ObjectName := ObjectGroupTable;
    363       Groups.SchemaName := Core.System.Database.Database;
     363      Groups.SchemaName := Core.System.Client.Schema;
    364364      Groups.Load;
    365365      for I := 0 to Groups.Objects.Count - 1 do begin
     
    373373          Objects.Client := Core.System.Client;
    374374          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'] + '"';
    377377          Objects.Load;
    378378          for O := 0 to Objects.Objects.Count - 1 do begin
Note: See TracChangeset for help on using the changeset viewer.