| 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, PngImage, Data.DB; |
IWTemplateProcessorHTML, PngImage, Data.DB, IWCompLabel, IWDBStdCtrls; |
| 11 |
|
|
| 12 |
type |
type |
| 13 |
TCartForm = class(TIWAppForm) |
TPayForm = class(TIWAppForm) |
| 14 |
IWButton1: TIWButton; |
IWButton1: TIWButton; |
| 15 |
IWButton2: TIWButton; |
IWButton2: TIWButton; |
| 16 |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
| 17 |
IWGrid1: TIWGrid; |
IWDBLabel1: TIWDBLabel; |
| 18 |
procedure IWAppFormCreate(Sender: TObject); |
procedure IWButton2Click(Sender: TObject); |
|
procedure IWAppFormDestroy(Sender: TObject); |
|
|
procedure IWButton1Click(Sender: TObject); |
|
| 19 |
public |
public |
| 20 |
end; |
end; |
| 21 |
|
|
| 25 |
|
|
| 26 |
uses Unit3, Unit1, ServerController, Unit4; |
uses Unit3, Unit1, ServerController, Unit4; |
| 27 |
|
|
| 28 |
procedure TCartForm.IWAppFormCreate(Sender: TObject); |
procedure TPayForm.IWButton2Click(Sender: TObject); |
|
var |
|
|
i: integer; |
|
|
s: TStream; |
|
|
png: TPngImage; |
|
|
img: TIWImageFile; |
|
|
j: integer; |
|
|
begin |
|
|
with DM.FDQuery1 do |
|
|
begin |
|
|
SQL.Clear; |
|
|
SQL.Add('select name,maker,thumbnail,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; |
|
|
IWGrid1.ColumnCount := DM.FDQuery1.Fields.Count; |
|
|
IWGrid1.RowCount := DM.FDQuery1.RecordCount; |
|
|
for i := 0 to IWGrid1.RowCount - 1 do |
|
|
begin |
|
|
png := TPngImage.Create; |
|
|
try |
|
|
for j := 0 to IWGrid1.ColumnCount - 1 do |
|
|
begin |
|
|
case j of |
|
|
2: |
|
|
begin |
|
|
s := DM.FDQuery1.CreateBlobStream |
|
|
(DM.FDQuery1.FieldByName('THUMBNAIL'), bmRead); |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
img:=TIWImageFile.Create(IWGrid1); |
|
|
img.Picture.Assign(png); |
|
|
IWGrid1.Cell[i, j].Control :=img; |
|
|
finally |
|
|
s.Free; |
|
|
end; |
|
|
end; |
|
|
4: |
|
|
IWGrid1.Cell[i, j].Text := |
|
|
(DM.FDQuery1.Fields[3].AsInteger * DM.FDQuery1.Fields[4] |
|
|
.AsInteger).ToString; |
|
|
else |
|
|
IWGrid1.Cell[i, j].Text := DM.FDQuery1.Fields[j].AsString; |
|
|
end; |
|
|
end; |
|
|
finally |
|
|
png.Free; |
|
|
end; |
|
|
DM.FDQuery1.Next; |
|
|
end; |
|
|
end; |
|
|
|
|
|
procedure TCartForm.IWAppFormDestroy(Sender: TObject); |
|
|
begin |
|
|
DM.FDQuery1.Close; |
|
|
end; |
|
|
|
|
|
procedure TCartForm.IWButton1Click(Sender: TObject); |
|
| 29 |
begin |
begin |
| 30 |
Release; |
Release; |
|
if Sender = IWButton1 then |
|
|
TPayForm.Create(WebApplication).Show |
|
|
else |
|
|
TIWForm1.Create(WebApplication).Show; |
|
| 31 |
end; |
end; |
| 32 |
|
|
| 33 |
end. |
end. |