| 7 |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompGrids, |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompGrids, |
| 8 |
IWDBGrids, IWCompButton, IWCompExtCtrls, IWVCLComponent, |
IWDBGrids, IWCompButton, IWCompExtCtrls, IWVCLComponent, |
| 9 |
IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout, |
IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout, |
| 10 |
IWTemplateProcessorHTML; |
IWTemplateProcessorHTML, PngImage, Data.DB; |
| 11 |
|
|
| 12 |
type |
type |
| 13 |
TCartForm = class(TIWAppForm) |
TPayForm = class(TIWAppForm) |
|
IWDBGrid1: TIWDBGrid; |
|
| 14 |
IWButton1: TIWButton; |
IWButton1: TIWButton; |
| 15 |
IWButton2: TIWButton; |
IWButton2: TIWButton; |
| 16 |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
|
procedure IWAppFormCreate(Sender: TObject); |
|
|
procedure IWAppFormDestroy(Sender: TObject); |
|
|
procedure IWButton1Click(Sender: TObject); |
|
| 17 |
public |
public |
| 18 |
end; |
end; |
| 19 |
|
|
| 21 |
|
|
| 22 |
{$R *.dfm} |
{$R *.dfm} |
| 23 |
|
|
| 24 |
uses Unit4, Unit1, Unit8, ServerController; |
uses Unit3, Unit1, ServerController, Unit4; |
|
|
|
|
procedure TCartForm.IWAppFormCreate(Sender: TObject); |
|
|
var |
|
|
i: integer; |
|
|
s, t: TIWDBGridColumn; |
|
|
j: integer; |
|
|
begin |
|
|
with DM.FDQuery1 do |
|
|
begin |
|
|
SQL.Clear; |
|
|
SQL.Add('select name,maker,image,volume,price'); |
|
|
SQL.Add(' from item_data join cart_data'); |
|
|
SQL.Add(' on (item_data.serial = cart_data.serial) where number = :num;'); |
|
|
Params.ParamByName('num').AsInteger := UserSession.user_number; |
|
|
Open; |
|
|
end; |
|
|
for i := 0 to DM.FDQuery1.Fields.Count - 1 do |
|
|
begin |
|
|
s := IWDBGrid1.Columns.Add as TIWDBGridColumn; |
|
|
if i = 2 then |
|
|
begin |
|
|
s.Title.Text := 'IMAGE'; |
|
|
for j := 1 to s.Collection.Count - 1 do |
|
|
begin |
|
|
t := s.Collection.Items[j] as TIWDBGridColumn; |
|
|
t.Control := TIWImageFile.Create(IWDBGrid1); |
|
|
end; |
|
|
end |
|
|
else |
|
|
s.DataField := DM.FDQuery1.Fields[i].FieldName; |
|
|
end; |
|
|
end; |
|
|
|
|
|
procedure TCartForm.IWAppFormDestroy(Sender: TObject); |
|
|
var |
|
|
i: integer; |
|
|
s: TIWDBGridColumn; |
|
|
begin |
|
|
DM.FDQuery1.Close; |
|
|
s := IWDBGrid1.Columns.Items[2] as TIWDBGridColumn; |
|
|
for i := 0 to s.Collection.Count - 1 do |
|
|
s.Control.Free; |
|
|
end; |
|
|
|
|
|
procedure TCartForm.IWButton1Click(Sender: TObject); |
|
|
begin |
|
|
Release; |
|
|
if Sender = IWButton1 then |
|
|
TPayForm.Create(WebApplication).Show |
|
|
else |
|
|
TTopForm.Create(WebApplication).Show; |
|
|
end; |
|
| 25 |
|
|
| 26 |
end. |
end. |