| 50 |
IWLink5: TIWLink; |
IWLink5: TIWLink; |
| 51 |
IWFrame1: TIWFrame1; |
IWFrame1: TIWFrame1; |
| 52 |
IWLink6: TIWLink; |
IWLink6: TIWLink; |
| 53 |
|
IWLink7: TIWLink; |
| 54 |
procedure IWAppFormRender(Sender: TObject); |
procedure IWAppFormRender(Sender: TObject); |
| 55 |
procedure IWLink2Click(Sender: TObject); |
procedure IWLink2Click(Sender: TObject); |
| 56 |
procedure IWAppFormCreate(Sender: TObject); |
procedure IWAppFormCreate(Sender: TObject); |
| 84 |
|
|
| 85 |
{$R *.dfm} |
{$R *.dfm} |
| 86 |
|
|
| 87 |
uses Unit3, ServerController, Unit6, Unit4, Unit9, Unit10, Unit5; |
uses Unit3, ServerController, Unit6, Unit4, Unit9, Unit10, Unit5, Unit11; |
| 88 |
|
|
| 89 |
procedure TIWForm1.CallBack(EventParams: TStringList); |
procedure TIWForm1.CallBack(EventParams: TStringList); |
| 90 |
begin |
begin |
| 199 |
with DM.FDQuery1 do |
with DM.FDQuery1 do |
| 200 |
begin |
begin |
| 201 |
SQL.Clear; |
SQL.Clear; |
| 202 |
SQL.Add('select volume,name,price from cart_data join item_data'); |
SQL.Add('select volume,name,price from cart_data,item_data'); |
| 203 |
SQL.Add(' on (cart_data.serial = item_data.serial)'); |
SQL.Add(' where cart_data.serial = item_data.serial'); |
| 204 |
SQL.Add(' where number = :num;'); |
SQL.Add(' and number = :num;'); |
| 205 |
Params.ParamByName('num').AsInteger := UserSession.user_number; |
ParamByName('num').AsInteger := UserSession.user_number; |
| 206 |
Open; |
Open; |
| 207 |
First; |
First; |
| 208 |
i := 0; |
i := 0; |
| 217 |
Close; |
Close; |
| 218 |
IWList3.Items.Clear; |
IWList3.Items.Clear; |
| 219 |
SQL.Clear; |
SQL.Clear; |
| 220 |
SQL.Add('select name from recent_data join item_data'); |
SQL.Add('select name from recent_data,item_data'); |
| 221 |
SQL.Add(' on (recent_data.serial = item_data.serial)'); |
SQL.Add(' where recent_data.serial = item_data.serial'); |
| 222 |
SQL.Add(' where number = :num;'); |
SQL.Add(' and number = :num;'); |
| 223 |
Params.ParamByName('num').AsInteger := UserSession.user_number; |
ParamByName('num').AsInteger := UserSession.user_number; |
| 224 |
Open; |
Open; |
| 225 |
First; |
First; |
| 226 |
while Eof = false do |
while Eof = false do |
| 232 |
end; |
end; |
| 233 |
LoadImage; |
LoadImage; |
| 234 |
if IWGrid1.Visible = true then |
if IWGrid1.Visible = true then |
| 235 |
IWLabel6.Visible := Filter; |
IWLabel6.Visible := Filter |
| 236 |
|
else |
| 237 |
|
DM.FDTable2.Locate('SERIAL', UserSession.Serial); |
| 238 |
end; |
end; |
| 239 |
|
|
| 240 |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
| 282 |
while DM.FDTable1.Lookup('NUMBER', j, 'NUMBER') = j do |
while DM.FDTable1.Lookup('NUMBER', j, 'NUMBER') = j do |
| 283 |
inc(j); |
inc(j); |
| 284 |
UserSession.user_number := j; |
UserSession.user_number := j; |
| 285 |
DM.FDTable1.AppendRecord([nil, nil, nil, nil, nil, |
DM.FDTable1.AppendRecord([nil, nil, nil, nil, nil, nil, |
| 286 |
UserSession.user_number, Date]); |
UserSession.user_number, Date]); |
| 287 |
WebApplication.Response.Cookies.AddCookie('user_cookie', |
WebApplication.Response.Cookies.AddCookie('user_cookie', |
| 288 |
UserSession.user_number.ToString, '/', Date + 10); |
UserSession.user_number.ToString, '/', Date + 10); |
| 289 |
end; |
end; |
| 290 |
with DM.FDQuery1 do |
with DM.FDQuery1 do |
| 291 |
begin |
begin |
| 292 |
SQL.Clear; |
Open('select * from cart_data;'); |
|
SQL.Add('select * from cart_data;'); |
|
|
Open; |
|
| 293 |
if Locate('NUMBER;SERIAL', VarArrayOf([UserSession.user_number, |
if Locate('NUMBER;SERIAL', VarArrayOf([UserSession.user_number, |
| 294 |
UserSession.Serial]), []) = true then |
UserSession.Serial]), []) = true then |
| 295 |
begin |
begin |
| 312 |
const ARow, AColumn: Integer); |
const ARow, AColumn: Integer); |
| 313 |
begin |
begin |
| 314 |
Thumbnail := false; |
Thumbnail := false; |
|
IWFrame8.IWEdit1.Text := '1'; |
|
| 315 |
UserSession.Serial := Integer(IWGrid1.Cell[ARow, AColumn].Tag); |
UserSession.Serial := Integer(IWGrid1.Cell[ARow, AColumn].Tag); |
| 316 |
end; |
end; |
| 317 |
|
|
| 338 |
begin |
begin |
| 339 |
with DM.FDQuery1 do |
with DM.FDQuery1 do |
| 340 |
begin |
begin |
| 341 |
SQL.Clear; |
Open('select * from user_data where number = :num', [i]); |
|
SQL.Add('select * from user_data where number = :num'); |
|
|
Params.ParamByName('num').AsInteger := i; |
|
|
Open; |
|
| 342 |
Delete; |
Delete; |
| 343 |
SQL.Clear; |
Open('select number from cart_data where number = :num;', [i]); |
|
SQL.Add('select number from cart_data where number = :num;'); |
|
|
Params.ParamByName('num').AsInteger := i; |
|
|
Open; |
|
| 344 |
First; |
First; |
| 345 |
while Eof = false do |
while Eof = false do |
| 346 |
begin |
begin |
| 380 |
procedure TIWForm1.IWLink6Click(Sender: TObject); |
procedure TIWForm1.IWLink6Click(Sender: TObject); |
| 381 |
begin |
begin |
| 382 |
Page := true; |
Page := true; |
| 383 |
TIWForm3.Create(WebApplication).Show; |
if Sender = IWLink6 then |
| 384 |
|
TAdminPage.Create(WebApplication).Show |
| 385 |
|
else |
| 386 |
|
TAdminFile.Create(WebApplication).Show; |
| 387 |
end; |
end; |
| 388 |
|
|
| 389 |
procedure TIWForm1.LoadImage; |
procedure TIWForm1.LoadImage; |
| 390 |
var |
var |
|
s: TStream; |
|
|
png: TPngImage; |
|
| 391 |
pic: TIWImage; |
pic: TIWImage; |
| 392 |
i: Integer; |
i: Integer; |
| 393 |
j: Integer; |
j: Integer; |
|
x: Boolean; |
|
| 394 |
t: string; |
t: string; |
| 395 |
label label1; |
label label1; |
| 396 |
begin |
begin |
| 397 |
ClearImage; |
ClearImage; |
| 398 |
png := TPngImage.Create; |
if Thumbnail = true then |
| 399 |
try |
begin |
| 400 |
if Thumbnail = true then |
i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
| 401 |
begin |
if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then |
| 402 |
i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
inc(i); |
| 403 |
if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then |
IWGrid1.RowCount := i; |
| 404 |
inc(i); |
if DM.FDTable2.Filtered = false then |
| 405 |
IWGrid1.RowCount := i; |
DM.FDTable2.Last |
| 406 |
if DM.FDTable2.Filtered = false then |
else |
| 407 |
DM.FDTable2.Last |
DM.FDTable2.FindLast; |
| 408 |
else |
for i := 0 to IWGrid1.RowCount - 1 do |
| 409 |
DM.FDTable2.FindLast; |
for j := 0 to IWGrid1.ColumnCount - 1 do |
| 410 |
for i := 0 to IWGrid1.RowCount - 1 do |
begin |
| 411 |
for j := 0 to IWGrid1.ColumnCount - 1 do |
if DM.FDTable2.Filtered = false then |
| 412 |
begin |
begin |
| 413 |
if DM.FDTable2.Filtered = false then |
if DM.FDTable2.Bof = true then |
|
begin |
|
|
if DM.FDTable2.Bof = true then |
|
|
goto label1; |
|
|
end |
|
|
else if DM.FDTable2.Found = false then |
|
| 414 |
goto label1; |
goto label1; |
| 415 |
if DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil then |
end |
| 416 |
begin |
else if DM.FDTable2.Found = false then |
| 417 |
s := DM.FDTable2.CreateBlobStream |
goto label1; |
| 418 |
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
pic := TIWImage.Create(IWGrid1); |
| 419 |
try |
UserSession.FieldToImg(pic.Picture, |
| 420 |
png.LoadFromStream(s); |
DM.FDTable2.FieldByName('THUMBNAIL')); |
| 421 |
finally |
IWGrid1.Cell[i, j].Control := pic; |
| 422 |
s.Free; |
t := DM.FDTable2.FieldByName('NAME').AsString; |
| 423 |
end; |
if Length(t) > 10 then |
| 424 |
pic := TIWImage.Create(IWGrid1); |
t := Copy(t, 1, 8) + '..'; |
| 425 |
pic.Picture.Assign(png); |
IWGrid1.Cell[i, j].Tag := |
| 426 |
IWGrid1.Cell[i, j].Control := pic; |
Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger); |
| 427 |
end; |
IWGrid1.Cell[i, j].Text := t; |
| 428 |
t := DM.FDTable2.FieldByName('NAME').AsString; |
IWGrid1.Cell[i, j].Alignment := taCenter; |
| 429 |
if Length(t) > 10 then |
IWGrid1.Cell[i, j].Clickable := true; |
| 430 |
t := Copy(t, 1, 8) + '..'; |
if DM.FDTable2.Filtered = false then |
| 431 |
IWGrid1.Cell[i, j].Tag := |
DM.FDTable2.Prior |
| 432 |
Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger); |
else |
| 433 |
IWGrid1.Cell[i, j].Text := t; |
DM.FDTable2.FindPrior; |
|
IWGrid1.Cell[i, j].Alignment := taCenter; |
|
|
IWGrid1.Cell[i, j].Clickable := true; |
|
|
if DM.FDTable2.Filtered = false then |
|
|
DM.FDTable2.Prior |
|
|
else |
|
|
DM.FDTable2.FindPrior; |
|
|
end; |
|
|
label1: |
|
|
end |
|
|
else if (DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true) and |
|
|
(DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil) then |
|
|
begin |
|
|
s := DM.FDTable2.CreateBlobStream |
|
|
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
IWFrame8.IWImage1.Picture.Assign(png); |
|
|
finally |
|
|
s.Free; |
|
| 434 |
end; |
end; |
| 435 |
end |
label1: |
|
else |
|
|
IWFrame8.IWImage1.Picture.Assign(nil); |
|
|
finally |
|
|
png.Free; |
|
|
end; |
|
|
png := nil; |
|
|
s := nil; |
|
|
Randomize; |
|
|
if DM.FDTable2.Filtered = true then |
|
|
begin |
|
|
x := true; |
|
|
DM.FDTable2.Filtered := false; |
|
| 436 |
end |
end |
| 437 |
else |
else if DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true then |
| 438 |
x := false; |
UserSession.FieldToImg(IWFrame8.IWImage1.Picture, |
| 439 |
DM.FDTable2.Last; |
DM.FDTable2.FieldByName('IMAGE')); |
| 440 |
if DM.FDTable2.Bof = true then |
Randomize; |
| 441 |
Exit; |
DM.FDTableView.Filter := 'DATE > ' + QuotedStr(DateTimeToStr(Date - 10)); |
| 442 |
DM.FDTable2.MoveBy(-Random(DM.FDTable2.RecordCount div 5)); |
DM.FDTableView.First; |
| 443 |
if DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil then |
DM.FDTableView.MoveBy(Random(DM.FDTableView.RecordCount)); |
| 444 |
begin |
UserSession.FieldToImg(IWImage1.Picture, |
| 445 |
s := DM.FDTable2.CreateBlobStream |
DM.FDTableView.FieldByName('THUMBNAIL')); |
| 446 |
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString; |
|
png := TPngImage.Create; |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
IWImage1.Picture.Assign(png); |
|
|
finally |
|
|
png.Free; |
|
|
s.Free; |
|
|
end; |
|
|
end; |
|
|
if x = true then |
|
|
DM.FDTable2.Filtered := true; |
|
|
IWLabel4.Caption := DM.FDTable2.FieldByName('NAME').AsString; |
|
| 447 |
end; |
end; |
| 448 |
|
|
| 449 |
procedure TIWForm1.SetPage(const Value: Boolean); |
procedure TIWForm1.SetPage(const Value: Boolean); |
| 471 |
Filter := false; |
Filter := false; |
| 472 |
if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then |
if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then |
| 473 |
begin |
begin |
| 474 |
WebApplication.Response.Cookies.AddCookie('user_cookie', |
WebApplication.Response.Cookies.AddCookie('user_cookie', '0', '/', |
| 475 |
UserSession.user_number.ToString, '/', Date - 1); |
Date - 1); |
| 476 |
UserSession.user_number := 0; |
UserSession.user_number := 0; |
| 477 |
end; |
end; |
| 478 |
end; |
end; |
| 482 |
begin |
begin |
| 483 |
UserSession.FThumbnail := Value; |
UserSession.FThumbnail := Value; |
| 484 |
IWGrid1.Visible := Value; |
IWGrid1.Visible := Value; |
| 485 |
|
IWFrame8.IWEdit1.Text := '1'; |
| 486 |
IWFrame8.Visible := not Value; |
IWFrame8.Visible := not Value; |
| 487 |
end; |
end; |
| 488 |
|
|