unit UWeb;

interface

uses
  SysUtils, Classes, HTTPApp, DB, DBClient, MConnect, Provider, HTTPProd,
  DSProd, DBWeb;

type
  TWebModule1 = class(TWebModule)
    DCOMConnection1: TDCOMConnection;
    ClientDataSet1: TClientDataSet;
    DataSetProvider1: TDataSetProvider;
    DataSetTableProducer1: TDataSetTableProducer;
    ClientDataSet1Age: TSmallintField;
    ClientDataSet1Num: TAutoIncField;
    ClientDataSet1Dep: TStringField;
    ClientDataSet1Fam: TStringField;
    ClientDataSet1Nam: TStringField;
    ClientDataSet1Par: TStringField;
    ClientDataSet1Year_b: TSmallintField;
    ClientDataSet1Sex: TBooleanField;
    ClientDataSet1Count: TAggregateField;
    ClientDataSet1MYear: TAggregateField;
    DataSetPageProducer1: TDataSetPageProducer;
    procedure WebModule1DefaultAction(Sender: TObject;
      Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
    procedure ClientDataSet1CalcFields(DataSet: TDataSet);
    procedure DataSetPageProducer1HTMLTag(Sender: TObject; Tag: TTag;
      const TagString: String; TagParams: TStrings;
      var ReplaceText: String);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  WebModule1: TWebModule1;

implementation

{$R *.dfm}
uses DateUtils;

procedure TWebModule1.WebModule1DefaultAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
 ClientDataSet1.Open;
// Response.Content := DataSetTableProducer1.Content;
 Response.Content := DataSetPageProducer1.Content +
                    DataSetTableProducer1.Content;
 ClientDataSet1.Close;
end;

procedure TWebModule1.ClientDataSet1CalcFields(DataSet: TDataSet);
begin
 ClientDataSet1Age.Value := YearOf(Date) -
                            ClientDataSet1Year_b.Value;
end;

procedure TWebModule1.DataSetPageProducer1HTMLTag(Sender: TObject;
  Tag: TTag; const TagString: String; TagParams: TStrings;
  var ReplaceText: String);
begin
 if(TagString = 'AvAge')
  then ReplaceText := IntToStr(YearOf(Date) - ClientDataSet1MYear.Value);
end;

end.
