Develop and Download Open Source Software

Browse Subversion Repository

Diff of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by yamat0jp, Sun Nov 22 11:18:44 2015 UTC revision 9 by yamat0jp, Wed Jan 13 11:20:13 2016 UTC
# Line 3  unit Unit1; Line 3  unit Unit1;
3  interface  interface
4    
5  uses  uses
6    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWHTMLControls,    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,
   IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompLabel,  
   Vcl.Controls, Vcl.Forms, IWVCLBaseContainer, IWContainer, IWHTMLContainer,  
   IWHTML40Container, IWRegion, FireDAC.Stan.Intf, FireDAC.Stan.Option,  
   FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,  
   FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.IB,  
   FireDAC.Phys.IBDef, Data.DB, FireDAC.Comp.Client, Datasnap.DBClient,  
   Datasnap.Provider, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf,  
   FireDAC.DApt, FireDAC.Comp.DataSet, IWCompGrids, IWDBGrids, IWCompEdit,  
   IWDBStdCtrls, IWCompExtCtrls, IWDBExtCtrls, Unit3, IWVCLComponent,  
7    IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,    IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
8    IWTemplateProcessorHTML, Data.Bind.EngExt, Vcl.Bind.DBEngExt, System.Rtti,    IWTemplateProcessorHTML, Vcl.Controls, Vcl.Forms, Unit2, IWVCLBaseContainer,
9    System.Bindings.Outputs, Vcl.Bind.Editors, Data.Bind.Components,    IWContainer, IWHTMLContainer, IWHTML40Container, IWRegion, IWDBStdCtrls,
10    Data.Bind.DBScope, IWCompListbox, IWCompButton, Web.HTTPApp, Web.HTTPProd,    IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompLabel,
11    Vcl.ImgList, IWImageList, PngImage, IWCompTabControl, IWCompMemo, IWCompText,    IWCompGrids, IWCompText, IWCompTabControl, IWCompButton, IWCompEdit,
12    UserSessionUnit;    IWHTMLControls, IWCompExtCtrls, PngImage, Data.DB,
13      IWCompListbox, IWBaseComponent, IWBaseHTMLComponent, IWBaseHTML40Component,
14      IWCompMenu, Vcl.Menus, System.Variants, Vcl.Dialogs, System.UITypes, Unit8;
15    
16  type  type
17    TTopForm = class(TIWAppForm)    TIWForm1 = class(TIWAppForm)
18      IWRegion1: TIWRegion;      IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
19      IWLabel1: TIWLabel;      IWLabel1: TIWLabel;
     IWList1: TIWList;  
     IWLink1: TIWLink;  
     IWLabel2: TIWLabel;  
20      IWDBLabel1: TIWDBLabel;      IWDBLabel1: TIWDBLabel;
21      IWFrame1: TIWFrame1;      IWRegion1: TIWRegion;
22        IWRegion2: TIWRegion;
23        IWText1: TIWText;
24        IWGrid1: TIWGrid;
25      IWRegion3: TIWRegion;      IWRegion3: TIWRegion;
     IWLabel3: TIWLabel;  
     IWLabel4: TIWLabel;  
26      IWRegion4: TIWRegion;      IWRegion4: TIWRegion;
27      IWLabel5: TIWLabel;      IWLink1: TIWLink;
28      IWList2: TIWList;      IWLabel2: TIWLabel;
29      IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;      IWList1: TIWList;
30      IWRegion2: TIWRegion;      IWLabel3: TIWLabel;
     IWLabel6: TIWLabel;  
     IWRegion6: TIWRegion;  
31      IWEdit1: TIWEdit;      IWEdit1: TIWEdit;
32      IWButton1: TIWButton;      IWButton1: TIWButton;
     IWImageFile1: TIWImageFile;  
     IWRegion7: TIWRegion;  
     IWLabel8: TIWLabel;  
     IWGrid1: TIWGrid;  
     IWTabControl1: TIWTabControl;  
     IWTabControl1Page0: TIWTabPage;  
     IWTabControl1Page1: TIWTabPage;  
     IWText1: TIWText;  
     IWRegion8: TIWRegion;  
33      IWEdit2: TIWEdit;      IWEdit2: TIWEdit;
34      IWEdit3: TIWEdit;      IWEdit3: TIWEdit;
     IWLabel9: TIWLabel;  
     IWList3: TIWList;  
35      IWLink2: TIWLink;      IWLink2: TIWLink;
36        IWRegion5: TIWRegion;
37        IWLabel7: TIWLabel;
38        IWRegion6: TIWRegion;
39        IWLabel8: TIWLabel;
40        IWList2: TIWList;
41        IWLabel4: TIWLabel;
42        IWRegion7: TIWRegion;
43        IWLabel5: TIWLabel;
44        IWLabel6: TIWLabel;
45        IWList3: TIWList;
46        IWImage1: TIWImage;
47        IWFrame8: TIWFrame8;
48        IWLink4: TIWLink;
49        IWLink3: TIWLink;
50        IWLink5: TIWLink;
51        IWFrame1: TIWFrame1;
52      procedure IWAppFormRender(Sender: TObject);      procedure IWAppFormRender(Sender: TObject);
53      procedure IWLink1Click(Sender: TObject);      procedure IWLink2Click(Sender: TObject);
54      procedure IWAppFormCreate(Sender: TObject);      procedure IWAppFormCreate(Sender: TObject);
55      procedure IWButton1Click(Sender: TObject);      procedure IWButton1Click(Sender: TObject);
56      procedure IWAppFormDestroy(Sender: TObject);      procedure IWLink1Click(Sender: TObject);
57      procedure IWLink2Click(Sender: TObject);      procedure IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer);
58        procedure IWFrame8IWButton1Click(Sender: TObject);
59        procedure IWFrame8IWLink1Click(Sender: TObject);
60        procedure IWLink4Click(Sender: TObject);
61        procedure IWLink3Click(Sender: TObject);
62        procedure IWLink5Click(Sender: TObject);
63    private    private
64      procedure SetPage(const Value: TPage);      Filter: Boolean;
65      function GetPage: TPage;      function GetPage: Boolean;
66        procedure SetPage(const Value: Boolean);
67      procedure LoadImage;      procedure LoadImage;
68      procedure ClearImage;      procedure ClearImage;
69        function GetThumbnail: Boolean;
70        procedure CallBack(EventParams: TStringList);
71        procedure SetThumbnail(const Value: Boolean);
72        property Thumbnail: Boolean read GetThumbnail write SetThumbnail;
73    public    public
74      property Page: TPage read GetPage write SetPage;      property Page: Boolean read GetPage write SetPage;
75    end;    end;
76    
77    var
78      IWForm1: TIWForm1;
79    
80  implementation  implementation
81    
82  {$R *.dfm}  {$R *.dfm}
83    
84  uses Unit2, ServerController, Unit4, Unit6;  uses Unit3, ServerController, Unit6, Unit4, Unit9, Unit10;
85    
86    procedure TIWForm1.CallBack(EventParams: TStringList);
87    begin
88      if SameText(EventParams.Values['RetValue'], 'true') = true then
89        TCartForm.Create(WebApplication).Show;
90    end;
91    
92  procedure TTopForm.ClearImage;  procedure TIWForm1.ClearImage;
93  var  var
94    i, j: integer;    i: Integer;
95      j: Integer;
96  begin  begin
97    for i := 0 to IWGrid1.ColumnCount - 1 do    for i := 0 to IWGrid1.RowCount - 1 do
98      for j := 0 to IWGrid1.RowCount - 1 do      for j := 0 to IWGrid1.ColumnCount - 1 do
99      begin        IWGrid1.Cell[i, j].Control.Free;
100        IWGrid1.Cell[j, i].Control.Free;    IWGrid1.RowCount := 0;
       IWGrid1.Cell[j, i].Control := nil;  
     end;  
101  end;  end;
102    
103  function TTopForm.GetPage: TPage;  function TIWForm1.GetPage: Boolean;
104  begin  begin
105    result := UserSession.FPage;    result := UserSession.FPage;
106  end;  end;
107    
108  procedure TTopForm.IWAppFormCreate(Sender: TObject);  function TIWForm1.GetThumbnail: Boolean;
109    begin
110      result := UserSession.FThumbnail;
111    end;
112    
113    procedure TIWForm1.IWAppFormCreate(Sender: TObject);
114  const  const
115    i = 150;    i = 120;
116  var  var
117    s: integer;    s: Integer;
118  begin  begin
119    s:=DM.FDTable3.FieldByName('BGCOLOR').AsInteger;    IWForm1 := Self;
120    IWLabel1.BGColor := s;    Page := UserSession.FPage;
121      Thumbnail := UserSession.FThumbnail;
122      s := DM.FDTable3.FieldByName('BGCOLOR').AsInteger;
123      IWLabel2.BGColor := s;
124    IWLabel3.BGColor := s;    IWLabel3.BGColor := s;
125    IWLabel5.BGColor := s;    IWLabel5.BGColor := s;
126    IWLabel6.BGColor := s;    IWLabel7.BGColor := s;
127    IWLabel8.BGColor := s;    IWLabel8.BGColor := s;
128    IWRegion1.Width := i;    IWRegion1.Width := i;
129    IWRegion2.Width := i;    IWRegion2.Width := i;
   IWRegion3.Width := i;  
130    IWRegion4.Width := i;    IWRegion4.Width := i;
131      IWRegion5.Width := i;
132      IWRegion6.Width := i;
133    IWRegion7.Width := i;    IWRegion7.Width := i;
134    IWRegion8.Width := i;    WebApplication.RegisterCallBack('callback', CallBack);
   Page := UserSession.FPage;  
135  end;  end;
136    
137  procedure TTopForm.IWAppFormDestroy(Sender: TObject);  procedure TIWForm1.IWAppFormRender(Sender: TObject);
 begin  
   ClearImage;  
 end;  
   
 procedure TTopForm.IWAppFormRender(Sender: TObject);  
138  var  var
139    s: string;    s: string;
140    i, j: integer;    i, j: Integer;
   x: Boolean;  
141  begin  begin
142    IWList1.Items.Clear;    IWList1.Items.Clear;
143    with DM.FDTable2 do    with DM.FDTable2 do
144      if RecordCount > 0 then    begin
145        if Filtered = true then
146      begin      begin
147        First;        FindFirst;
148        while Eof = false do        while Found = true do
149        begin        begin
150          s := FieldByName('CATEGORY').AsString;          s := FieldByName('CATEGORY').AsString;
151          if s = '' then          if s = '' then
152          begin          begin
153            Next;            FindNext;
154            continue;            continue;
155          end;          end;
156          if Filtered = true then          i := IWList1.Items.IndexOfName(s);
157          begin          if i = -1 then
158            i := IWList1.Items.IndexOfName(s);            IWList1.Items.Add(s + '=1')
           if i = -1 then  
             IWList1.Items.Add(s + '=1')  
           else  
           begin  
             j := IWList1.Items.ValueFromIndex[i].ToInteger + 1;  
             IWList1.Items[i] := s + '=' + j.ToString;  
           end;  
         end  
159          else          else
160          begin          begin
161            i := IWList1.Items.IndexOf(s);            j := IWList1.Items.ValueFromIndex[i].ToInteger + 1;
162            if i = -1 then            IWList1.Items[i] := s + '=' + j.ToString;
163              IWList1.Items.Add(s);          end;
164            FindNext;
165          end;
166        end
167        else
168        begin
169          First;
170          while Eof = false do
171          begin
172            s := FieldByName('CATEGORY').AsString;
173            if s = '' then
174            begin
175              Next;
176              continue;
177          end;          end;
178            i := IWList1.Items.IndexOf(s);
179            if i = -1 then
180              IWList1.Items.Add(s);
181          Next;          Next;
182        end;        end;
183      end;      end;
184      end;
185    if DM.FDTable2.Filtered = true then    if DM.FDTable2.Filtered = true then
186      for i := 0 to IWList1.Items.Count - 1 do      for i := 0 to IWList1.Items.Count - 1 do
187      begin      begin
# Line 167  begin Line 191  begin
191        else        else
192          IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')';          IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')';
193      end;      end;
194    IWList3.Items.Clear;    IWList2.Items.Clear;
195    if Page = Info then    if Page = false then
196    begin    begin
197      with DM.FDQuery1 do      with DM.FDQuery1 do
198      begin      begin
# Line 178  begin Line 202  begin
202        SQL.Add(' where number = :num;');        SQL.Add(' where number = :num;');
203        Params.ParamByName('num').AsInteger := UserSession.user_number;        Params.ParamByName('num').AsInteger := UserSession.user_number;
204        Open;        Open;
205        if RecordCount > 0 then        First;
206          i := 0;
207          while Eof = false do
208        begin        begin
209          First;          s := Fields.Fields[0].AsString + 'x' + Fields.Fields[1].AsString;
210          i := 0;          i := i + Fields.Fields[0].AsInteger * Fields.Fields[2].AsInteger;
211          while Eof = false do          IWList2.Items.Add(s);
212          begin          Next;
           s := Fields.Fields[0].AsString + 'x' + Fields.Fields[1].AsString;  
           inc(i, Fields.Fields[2].AsInteger);  
           IWList3.Items.Add(s);  
           Next;  
         end;  
         IWList3.Items.Add(i.ToString + '円');  
213        end;        end;
214          IWList2.Items.Add(i.ToString + '円');
215        Close;        Close;
216      end;        IWList3.Items.Clear;
     IWList2.Items.Clear;  
     with DM.FDQuery1 do  
     begin  
217        SQL.Clear;        SQL.Clear;
218        SQL.Add('select name from recent_data join item_data');        SQL.Add('select name from recent_data join item_data');
219        SQL.Add(' on (recent_data.serial = item_data.serial)');        SQL.Add(' on (recent_data.serial = item_data.serial)');
220        SQL.Add(' where number = :num;');        SQL.Add(' where number = :num;');
221        //Params.ParamByName('num').AsInteger:=UserSession.user_number;        Params.ParamByName('num').AsInteger := UserSession.user_number;
222        Open;        Open;
223        if RecordCount > 0 then        First;
224          while Eof = false do
225        begin        begin
226          First;          IWList3.Items.Add(Fields.Fields[0].AsString);
227          while Eof = false do          Next;
         begin  
           IWList2.Items.Add(Fields.Fields[0].AsString);  
           Next;  
         end;  
228        end;        end;
229        Close;        Close;
230      end;      end;
231    end;    end;
   x := Page = Info;  
   IWRegion4.Visible := x;  
   IWLabel2.Visible := x;  
   IWDBLabel1.Visible := x;  
   IWLink2.Visible := not x;  
232    LoadImage;    LoadImage;
233      if IWGrid1.Visible = true then
234        IWLabel6.Visible := Filter;
235  end;  end;
236    
237  procedure TTopForm.IWButton1Click(Sender: TObject);  procedure TIWForm1.IWButton1Click(Sender: TObject);
238  const  var
239    filter = 'NAME LIKE ''%s''';    i: Integer;
240  begin  begin
241    if IWEdit1.Text = '' then    IWFrame8IWLink1Click(Sender);
242      DM.FDTable2.Filtered := false    if IWEdit1.Text <> '' then
   else  
243    begin    begin
244      DM.FDTable2.filter := Format(filter, ['%' + IWEdit1.Text + '%']);      DM.FDTable2.Filter := 'NAME like ' + QuotedStr('%' + IWEdit1.Text + '%');
245      DM.FDTable2.Filtered := true;      DM.FDTable2.Filtered := true;
246      IWLabel9.Text := IWEdit1.Text + 'を検索しています';      i := DM.FDTable2.RecordCount;
247        IWLabel6.Caption := Format(IWEdit1.Text + 'を検索しています:%d件', [i]);
248        if i = 0 then
249          DM.FDTable2.Filtered := false;
250        Filter := true;
251      end
252      else
253      begin
254        DM.FDTable2.Filtered := false;
255        Filter := false;
256    end;    end;
   IWLabel9.Visible := DM.FDTable2.Filtered;  
257  end;  end;
258    
259  procedure TTopForm.IWLink1Click(Sender: TObject);  procedure TIWForm1.IWFrame8IWButton1Click(Sender: TObject);
260  const  var
261    filter = 'EMAIL = ''%s'' and PASSWORD = ''%s''';    i: Integer;
262  begin  begin
263    case Page of    if TryStrToInt(IWFrame8.IWEdit1.Text, i) = false then
264      Main:    begin
265        begin      WebApplication.ShowMessage('個数が不正です');
266          DM.FDTable1.filter := Format(filter, [IWEdit2.Text, IWEdit3.Text]);      Exit;
267          DM.FDTable1.Filtered := true;    end;
268          if DM.FDTable1.RecordCount = 1 then    if i = 0 then
269          begin    begin
270            IWLink1.Caption := 'ログアウト';      WebApplication.ShowMessage('1個以上のご注文が必要です');
271            Page := Info;      Exit;
272            UserSession.user_number := DM.FDTable1.FieldByName('NUMBER')    end;
273              .AsInteger;    with DM.FDQuery1 do
274            IWEdit2.Text := '';    begin
275          end;      SQL.Clear;
276          IWEdit3.Text := '';      SQL.Add('select * from cart_data;');
277        end;      Open;
278      Info:      if Locate('NUMBER;SERIAL', VarArrayOf([UserSession.user_number,
279        begin        UserSession.Serial]), []) = true then
280          DM.FDTable1.Filtered := false;      begin
281          IWLink1.Caption := 'ログイン';        Edit;
282          Page := Main;        FieldByName('VOLUME').AsInteger := FieldByName('VOLUME').AsInteger + i;
283          DM.FDQuery1.Params.ParamByName('num').AsInteger := 0;        Post;
284        end;      end
285        else
286          AppendRecord([nil, i, UserSession.user_number, UserSession.Serial]);
287    end;    end;
288    IWLabel9.Visible := UserSession.user_number <> 0;    IWFrame8.IWEdit1.Text := '0';
289      WebApplication.ShowConfirm('カートに移動しますか', 'callback', '移動', 'はい', 'いいえ');
290    end;
291    
292    procedure TIWForm1.IWFrame8IWLink1Click(Sender: TObject);
293    begin
294      Thumbnail := true;
295    end;
296    
297    procedure TIWForm1.IWGrid1CellClick(ASender: TObject;
298      const ARow, AColumn: Integer);
299    begin
300      Thumbnail := false;
301      IWFrame8.IWEdit1.Text := '1';
302      UserSession.Serial := Integer(IWGrid1.Cell[ARow, AColumn].Tag);
303  end;  end;
304    
305  procedure TTopForm.IWLink2Click(Sender: TObject);  procedure TIWForm1.IWLink1Click(Sender: TObject);
306  begin  begin
   UserSession.FPage := Info;  
307    TUserForm.Create(WebApplication).Show;    TUserForm.Create(WebApplication).Show;
308  end;  end;
309    
310  procedure TTopForm.LoadImage;  procedure TIWForm1.IWLink2Click(Sender: TObject);
311    begin
312      if Page = true then
313      begin
314        if DM.FDTable1.Locate('EMAIL;PASSWORD',
315          VarArrayOf([IWEdit2.Text, IWEdit3.Text]), [loCaseInsensitive]) = true then
316        begin
317          Page := false;
318          UserSession.user_number := DM.FDTable1.FieldByName('NUMBER').AsInteger;
319          IWEdit2.Text := '';
320        end;
321        IWEdit3.Text := '';
322      end
323      else
324      begin
325        UserSession.user_number := 0;
326        Page := true;
327      end;
328    end;
329    
330    procedure TIWForm1.IWLink3Click(Sender: TObject);
331    begin
332      with TMyPage.Create(WebApplication) do
333      begin
334        Form := Self;
335        Show;
336      end;
337    end;
338    
339    procedure TIWForm1.IWLink4Click(Sender: TObject);
340    begin
341      TCartForm.Create(WebApplication).Show;
342    end;
343    
344    procedure TIWForm1.IWLink5Click(Sender: TObject);
345    begin
346      TIWForm10.Create(WebApplication).Show;
347    end;
348    
349    procedure TIWForm1.LoadImage;
350  var  var
351    i, j, k: integer;    s: TStream;
352    png: TPngImage;    png: TPngImage;
353    pic: TIWImageFile;    pic: TIWImage;
354    st: TStream;    i: Integer;
355      j: Integer;
356      x: Boolean;
357      t: string;
358  label label1;  label label1;
359  begin  begin
360    ClearImage;    ClearImage;
361    if DM.FDTable2.RecordCount > 0 then    png := TPngImage.Create;
362    begin    try
363      IWGrid1.RowCount := (DM.FDTable2.RecordCount div IWGrid1.ColumnCount) + 1;      if Thumbnail = true then
364      k := 1;      begin
365      DM.FDTable2.Last;        i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount;
366      png := TPngImage.Create;        if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then
367      try          inc(i);
368          IWGrid1.RowCount := i;
369          if DM.FDTable2.Filtered = false then
370            DM.FDTable2.Last
371          else
372            DM.FDTable2.FindLast;
373        for i := 0 to IWGrid1.RowCount - 1 do        for i := 0 to IWGrid1.RowCount - 1 do
       begin  
374          for j := 0 to IWGrid1.ColumnCount - 1 do          for j := 0 to IWGrid1.ColumnCount - 1 do
375          begin          begin
376            st := DM.FDTable2.CreateBlobStream            if DM.FDTable2.Filtered = false then
377              (DM.FDTable2.FieldByName('THUMBNAIL'), bmRead);            begin
378            try              if DM.FDTable2.Bof = true then
379              png.LoadFromStream(st);                goto label1;
380              pic := TIWImageFile.Create(Self);            end
381              else if DM.FDTable2.Found = false then
382                goto label1;
383              if DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil then
384              begin
385                s := DM.FDTable2.CreateBlobStream
386                  (DM.FDTable2.FieldByName('THUMBNAIL'), bmRead);
387                try
388                  png.LoadFromStream(s);
389                finally
390                  s.Free;
391                end;
392                pic := TIWImage.Create(IWGrid1);
393              pic.Picture.Assign(png);              pic.Picture.Assign(png);
394              IWGrid1.Cell[i, j].Control := pic;              IWGrid1.Cell[i, j].Control := pic;
             IWGrid1.Cell[i, j].Text := k.ToString;  
             inc(k);  
             DM.FDTable2.Prior;  
           finally  
             st.Free;  
395            end;            end;
396            if DM.FDTable2.Bof = true then            t := DM.FDTable2.FieldByName('NAME').AsString;
397              goto label1;            if Length(t) > 10 then
398                t := Copy(t, 1, 8) + '..';
399              IWGrid1.Cell[i, j].Tag :=
400                Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger);
401              IWGrid1.Cell[i, j].Text := t;
402              IWGrid1.Cell[i, j].Alignment := taCenter;
403              IWGrid1.Cell[i, j].Clickable := true;
404              if DM.FDTable2.Filtered = false then
405                DM.FDTable2.Prior
406              else
407                DM.FDTable2.FindPrior;
408          end;          end;
       end;  
409      label1:      label1:
410      finally      end
411        png.Free;      else if (DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true) and
412      end;        (DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil) then
413    end      begin
414    else        s := DM.FDTable2.CreateBlobStream
415      IWGrid1.RowCount := 0;          (DM.FDTable2.FieldByName('THUMBNAIL'), bmRead);
416    st := nil;        try
417            png.LoadFromStream(s);
418            IWFrame8.IWImage1.Picture.Assign(png);
419          finally
420            s.Free;
421          end;
422        end
423        else
424          IWFrame8.IWImage1.Picture.Assign(nil);
425      finally
426        png.Free;
427      end;
428    png := nil;    png := nil;
429      s := nil;
430    Randomize;    Randomize;
431      if DM.FDTable2.Filtered = true then
432      begin
433        x := true;
434        DM.FDTable2.Filtered := false;
435      end
436      else
437        x := false;
438    DM.FDTable2.Last;    DM.FDTable2.Last;
439      if DM.FDTable2.Bof = true then
440        Exit;
441    DM.FDTable2.MoveBy(-Random(DM.FDTable2.RecordCount div 5));    DM.FDTable2.MoveBy(-Random(DM.FDTable2.RecordCount div 5));
442    st := DM.FDTable2.CreateBlobStream    if DM.FDTable2.FieldByName('THUMBNAIL').AsBytes <> nil then
443      (DM.FDTable2.FieldByName('THUMBNAIL'), bmRead);    begin
444    png := TPngImage.Create;      s := DM.FDTable2.CreateBlobStream
445    try        (DM.FDTable2.FieldByName('THUMBNAIL'), bmRead);
446      png.LoadFromStream(st);      png := TPngImage.Create;
447      IWImageFile1.Picture.Assign(png);      try
448    finally        png.LoadFromStream(s);
449      st.Free;        IWImage1.Picture.Assign(png);
450      png.Free;      finally
451          png.Free;
452          s.Free;
453        end;
454    end;    end;
455      if x = true then
456        DM.FDTable2.Filtered := true;
457    IWLabel4.Caption := DM.FDTable2.FieldByName('NAME').AsString;    IWLabel4.Caption := DM.FDTable2.FieldByName('NAME').AsString;
458  end;  end;
459    
460  procedure TTopForm.SetPage(const Value: TPage);  procedure TIWForm1.SetPage(const Value: Boolean);
 var  
   s: string;  
461  begin  begin
462    UserSession.FPage := Value;    UserSession.FPage := Value;
463    case Value of    IWRegion7.Visible := not Value;
464      Main:    IWDBLabel1.Visible := not Value;
465        s := 'toppage.htm';    IWLink3.Visible := not Value;
466      Info:    IWLink1.Visible := Value;
467        s := 'mypage.htm';    IWText1.Visible := Value;
468      if Value = false then
469      begin
470        IWLabel1.Caption := 'ようこそ';
471        IWLink2.Caption := 'ログアウト';
472      end
473      else
474      begin
475        IWLabel1.Caption := 'ようこそゲスト様';
476        IWLink2.Caption := 'ログイン';
477        Thumbnail := true;
478        IWText1.Text := '';
479        DM.FDTable2.Filtered := false;
480        Filter := false;
481    end;    end;
482    IWTemplateProcessorHTML1.Templates.Default := s;  end;
483    
484    procedure TIWForm1.SetThumbnail(const Value: Boolean);
485    begin
486      UserSession.FThumbnail := Value;
487      IWGrid1.Visible := Value;
488      IWFrame8.Visible := not Value;
489  end;  end;
490    
491  initialization  initialization
492    
493  TTopForm.SetAsMainForm;  TIWForm1.SetAsMainForm;
494    
495  end.  end.

Legend:
Removed from v.1  
changed lines
  Added in v.9

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26