⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uform_his_del.pas

📁 电话防伪系统
💻 PAS
字号:
unit Uform_his_del;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ImgList, DB, ADODB, ComCtrls, StdCtrls, Buttons, ExtCtrls;

type
  Tform_his_del = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    Bevel2: TBevel;
    Bevel3: TBevel;
    Image2: TImage;
    Label1: TLabel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    ListView2: TListView;
    recordset_temp: TADOQuery;
    ImageList1: TImageList;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    sqlstr:string;
  end;

var
  form_his_del: Tform_his_del;

implementation

uses Udate_format, Uform_main;

{$R *.dfm}

procedure Tform_his_del.BitBtn2Click(Sender: TObject);
var
   p:^integer;
   i:integer;
   ListItem: TListItem;
begin
   //add the listitem into the listview 2001-12-20a
   date_format.ShowModal ;

   if date_format.yesno =false then exit ;

   listview2.Clear ;
   //create the sqlstr
   sqlstr:= ' where [HIS_DT]>=#'
     + datetostr(date_format.s_date )
     + '# and [HIS_DT]<=#'
     + datetostr(date_format.e_date +1) + '#';

   if not((date_format.xd1_bool =false) and (date_format.xd2_bool =false)
       and (date_format.xd3_bool =false) and (date_format.xd4_bool =false))
       then
   begin
      sqlstr:=sqlstr+' and [HIS_CODE_KIND] IN (';

      if date_format.xd1_bool =true then
      begin
         sqlstr:=sqlstr + '1,';
      end;

      if date_format.xd2_bool =true then
      begin
         sqlstr:=sqlstr + '2,';
      end;

      if date_format.xd3_bool =true then
      begin
         sqlstr:=sqlstr + '3,';
      end;

      if date_format.xd4_bool =true then
      begin
         sqlstr:=sqlstr + '4,';
      end;

      sqlstr:=sqlstr + ')';
   end;


   // open the recordset object
   recordset_temp.SQL.Clear;
   recordset_temp.SQL.Add('select * from [HIS]' + sqlstr);
   recordset_temp.Open ;

   //add the listitem to the listview
   for i :=1 to recordset_temp.RecordCount do
   begin
      listitem:=listview2.Items.Add ;
      listitem.Caption :=datetimetostr(recordset_temp.Fields[3].AsDateTime );

      if recordset_temp.Fields[1].AsInteger =1 then
      begin
         listitem.ImageIndex :=0;
         listitem.SubItems.Add('无效的访问纪录');
      end;

      if recordset_temp.Fields[1].AsInteger =2 then
      begin
         listitem.ImageIndex :=1;
         listitem.SubItems.Add('访问已注册的产品号[' + recordset_temp.Fields[2].AsString  + ']');
      end;

      if recordset_temp.Fields[1].AsInteger =3 then
      begin
         listitem.ImageIndex :=2;
         listitem.SubItems.Add('访问没有的产品号[' + recordset_temp.Fields[2].AsString  + ']');
      end;

      if recordset_temp.Fields[1].AsInteger =4 then
      begin
         listitem.ImageIndex :=3;
         listitem.SubItems.Add('注册产品号[' + recordset_temp.Fields[2].AsString  + ']');
      end;

      new(p);
      p^ := recordset_temp.Fields[0].AsInteger ;
      listitem.Data :=p;
      recordset_temp.next;
   end;

   //close the listitem
   recordset_temp.close;
end;

procedure Tform_his_del.BitBtn1Click(Sender: TObject);
var
   temp:pchar;
begin
   //delete the visited record  2001-12-20p

   temp:=pchar('您是否确定删除所显示的访问纪录');
   if messagebox(self.Handle, temp,
                  '警告',MB_yesno or MB_ICONQUESTION	)=IDyes then
   begin
      form_main.Dconnect.Execute('delete * from [HIS]' +sqlstr );
      listview2.Clear ;
   end;
end;

procedure Tform_his_del.BitBtn3Click(Sender: TObject);
begin
   //close the windows 2001-12-20p
   close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -