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 19 by yamat0jp, Sat Aug 27 11:00:30 2016 UTC revision 20 by yamat0jp, Sat Aug 27 21:03:47 2016 UTC
# Line 66  type Line 66  type
66      procedure IWLink6Click(Sender: TObject);      procedure IWLink6Click(Sender: TObject);
67      procedure IWLink8Click(Sender: TObject);      procedure IWLink8Click(Sender: TObject);
68    private    private
69      Filter: Boolean;      function SearchCount: Integer;
70      function GetPage: Boolean;      function GetPage: Boolean;
71      procedure SetPage(const Value: Boolean);      procedure SetPage(const Value: Boolean);
72      procedure LoadImage;      procedure LoadImage;
# Line 162  begin Line 162  begin
162          FindNext;          FindNext;
163          continue;          continue;
164        end;        end;
165        if DM.FDTable2.Filter = table2filter then        if Filter = table2filter then
166        begin        begin
167          i := IWList1.Items.IndexOf(s);          i := IWList1.Items.IndexOf(s);
168          if i = -1 then          if i = -1 then
# Line 183  begin Line 183  begin
183      end;      end;
184    end;    end;
185    if DM.FDTable2.Filter <> table2filter then    if DM.FDTable2.Filter <> table2filter then
186      begin
187      for i := 0 to IWList1.Items.Count - 1 do      for i := 0 to IWList1.Items.Count - 1 do
188      begin      begin
189        s := IWList1.Items.ValueFromIndex[i];        s := IWList1.Items.ValueFromIndex[i];
190        IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')';        IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')';
191      end;      end;
192      end;
193    IWList2.Items.Clear;    IWList2.Items.Clear;
194    with DM.FDQuery1 do    with DM.FDQuery1 do
195    begin    begin
# Line 230  end; Line 232  end;
232    
233  procedure TIWForm1.IWButton1Click(Sender: TObject);  procedure TIWForm1.IWButton1Click(Sender: TObject);
234  var  var
235      s: TStringList;
236      t: string;
237    i: Integer;    i: Integer;
 label searchout;  
238  begin  begin
239    IWFrame8IWLink1Click(Sender);    Thumbnail := true;
240    if IWEdit1.Text <> '' then    if IWEdit1.Text <> '' then
241    begin    begin
242      DM.FDTable2.Filter := table2filter + ' and NAME like ' +      s := TStringList.Create;
243        QuotedStr('%' + IWEdit1.Text + '%');      try
244      i := DM.FDTable2.RecordCount;        s.Delimiter := ' ';
245      if i = 0 then        s.DelimitedText := IWEdit1.Text;
246        goto searchout        for i := 0 to s.Count - 1 do
247      else        begin
248      begin          t := t + 'NAME like ' + QuotedStr('%' + s[i] + '%');
249        IWLabel6.Caption := Format(IWEdit1.Text + 'を検索しています:%d件', [i]);          if i < s.Count - 1 then
250              t := t + ' or '
251            else
252              t := '(' + t + ')';
253          end;
254          DM.FDTable2.Filter := table2filter + ' and ' + t;
255          i := SearchCount;
256          if i = 0 then
257          begin
258            DM.FDTable2.Filter := table2filter;
259            IWLabel6.Caption := '該当する商品が見つかりませんでした';
260          end
261          else
262            IWLabel6.Caption := Format(IWEdit1.Text + 'を検索しています:%d件', [i]);
263        IWLabel6.Visible := true;        IWLabel6.Visible := true;
264        finally
265          s.Free;
266      end;      end;
267    end    end
268    else    else
269    begin    begin
   searchout:  
270      DM.FDTable2.Filter := table2filter;      DM.FDTable2.Filter := table2filter;
271      IWLabel6.Visible := false;      IWLabel6.Visible := false;
272    end;    end;
# Line 436  begin Line 453  begin
453    IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString;    IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString;
454  end;  end;
455    
456    function TIWForm1.SearchCount: Integer;
457    begin
458      with DM.FDTable2 do
459      begin
460        if FindFirst = true then
461        begin
462          result := 1;
463          while FindNext = true do
464            inc(result);
465        end
466        else
467          result := 0;
468      end;
469    end;
470    
471  procedure TIWForm1.SetPage(const Value: Boolean);  procedure TIWForm1.SetPage(const Value: Boolean);
472  begin  begin
473    UserSession.FPage := Value;    UserSession.FPage := Value;
# Line 457  begin Line 489  begin
489      IWLink2.Caption := 'ログイン';      IWLink2.Caption := 'ログイン';
490      Thumbnail := true;      Thumbnail := true;
491      IWText1.Text := '';      IWText1.Text := '';
492      DM.FDTable2.Filtered := false;      DM.FDTable2.Filter := table2filter;
     Filter := false;  
493      if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then      if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then
494      begin      begin
495        WebApplication.Response.Cookies.AddCookie('user_cookie', '0', '/',        WebApplication.Response.Cookies.AddCookie('user_cookie', '0', '/',

Legend:
Removed from v.19  
changed lines
  Added in v.20

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