unit tpSelectTenderDm;

interface

uses
  SysUtils, Classes, sdDB, sdProvider, tpSelectTenderNode;

type
  TtpSelectTenderData = class(TDataModule)
    sdmpTenders: TsdMemoryProvider;
    sddTenders: TsdDataSet;
    sdvTenders: TsdDataView;
  private
  public
    procedure AssignSelectTenders(ATenders: TList);
  end;

implementation

{$R *.dfm}

{ TtpSelectTenderData }

procedure TtpSelectTenderData.AssignSelectTenders(ATenders: TList);
var
  i: Integer;
  vTender: TtpSelectTenderNode;
  Rec: TsdDataRecord;
begin
  sddTenders.DeleteAll;
  for i := 0 to ATenders.Count - 1 do
  begin
    vTender := TtpSelectTenderNode(ATenders.Items[i]);
    Rec := sddTenders.Add;
    Rec.ValueByName('ID').AsInteger := vTender.ID;
    Rec.ValueByName('Name').AsString := vTender.Name;
    Rec.ValueByName('NodeCount').AsInteger := vTender.NodeCount;
    Rec.ValueByName('TotalPrice').AsFloat := vTender.TotalPrice;
  end;
end;

end.
