Ignore:
Timestamp:
Mar 8, 2012, 3:11:10 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Direct acces using Database: TSqlDatabase replaced by TChronisClient interface.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UDataTypes.pas

    r23 r37  
    66
    77uses
    8   Classes, SysUtils, Controls, Spin, StdCtrls, ExtCtrls, MaskEdit, EditBtn;
     8  Classes, SysUtils, Controls, Spin, StdCtrls, ExtCtrls, MaskEdit, EditBtn,
     9  UChronisClient;
    910
    1011type
     
    147148function GetDataType(ACustomType: Integer): TDataType;
    148149var
    149   DbRows: TDbRows;
     150  Proxy: TListProxy;
    150151  BaseType: Integer;
    151152begin
    152153  try
    153     DbRows := TDbRows.Create;
    154     Core.System.Database.Select(DbRows, CustomTypeTableName, '*', 'Id=' + IntToStr(ACustomType));
    155     BaseType := StrToInt(DbRows[0].Values['Type']);
     154    Proxy := TListProxy.Create;
     155    Proxy.Client := Core.System.Client;
     156    Proxy.ObjectName := CustomTypeTableName;
     157    Proxy.Condition := 'Id=' + IntToStr(ACustomType);
     158    Proxy.Load;
     159    BaseType := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Type']);
    156160  finally
    157     DbRows.Free;
     161    Proxy.Free;
    158162  end;
    159163
     
    231235procedure TDataTypeRelationMany.LoadDef(ACustomType: Integer);
    232236var
    233   DbRows: TDbRows;
     237  Proxy: TListProxy;
    234238  BaseType: Integer;
    235239begin
    236240  try
    237     DbRows := TDbRows.Create;
    238     Core.System.Database.Select(DbRows, TypeRelationMany, '*', 'CustomType=' + IntToStr(ACustomType));
    239     PropertyID := StrToInt(DbRows[0].Values['ObjectProperty']);
     241    Proxy := TListProxy.Create;
     242    Proxy.Client := Core.System.Client;
     243    Proxy.ObjectName := TypeRelationMany;
     244    Proxy.Condition := 'CustomType=' + IntToStr(ACustomType);
     245    Proxy.Load;
     246    PropertyID := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['ObjectProperty']);
    240247  finally
    241     DbRows.Free;
     248    Proxy.Free;
    242249  end;
    243250  try
    244     DbRows := TDbRows.Create;
    245     Core.System.Database.Select(DbRows, PropertyTable, '*', 'Id=' + IntToStr(PropertyID));
    246     ObjectId := StrToInt(DbRows[0].Values['Object']);
    247     PropertyName := DbRows[0].Values['ColumnName'];
     251    Proxy := TListProxy.Create;
     252    Proxy.Client := Core.System.Client;
     253    Proxy.ObjectName := PropertyTable;
     254    Proxy.Condition := 'Id=' + IntToStr(PropertyID);
     255    ObjectId := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Object']);
     256    PropertyName := TObjectProxy(Proxy.Objects[0]).Properties.Values['ColumnName'];
    248257  finally
    249     DbRows.Free;
     258    Proxy.Free;
    250259  end;
    251260end;
     
    286295procedure TDataTypeRelationOne.LoadDef(ACustomType: Integer);
    287296var
    288   DbRows: TDbRows;
     297  Proxy: TListProxy;
    289298begin
    290299  try
    291     DbRows := TDbRows.Create;
    292     Core.System.Database.Select(DbRows, TypeRelationOne, '*', 'CustomType=' + IntToStr(ACustomType));
    293     ObjectId := StrToInt(DbRows[0].Values['Object']);
     300    Proxy := TListProxy.Create;
     301    Proxy.Client := Core.System.Client;
     302    Proxy.ObjectName := TypeRelationOne;
     303    Proxy.Condition := 'CustomType=' + IntToStr(ACustomType);
     304    Proxy.Load;
     305    ObjectId := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Object']);
    294306  finally
    295     DbRows.Free;
     307    Proxy.Free;
    296308  end;
    297309end;
Note: See TracChangeset for help on using the changeset viewer.