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

📄 gjcx.pas

📁 房屋出租信息管理系统,房屋出租信息的录入、查询、删除以及用户管理等功能
💻 PAS
字号:
unit Gjcx;

interface

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

type
  TGjcxForm = class(TForm)
    Panel1: TPanel;
    Bevel1: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Com_jl: TComboBox;
    Com_tj: TComboBox;
    DTP_sz: TDateTimePicker;
    Com_lj: TComboBox;
    Edit1: TEdit;
    fieldname: TComboBox;
    StringGrid1: TStringGrid;
    BitBtn_OK: TBitBtn;
    BitBtn_Add: TBitBtn;
    BitBtn_Del: TBitBtn;
    BitBtn_Exit: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn_AddClick(Sender: TObject);
    procedure BitBtn_DelClick(Sender: TObject);
    procedure BitBtn_OKClick(Sender: TObject);
    procedure BitBtn_ExitClick(Sender: TObject);
    procedure Com_ljChange(Sender: TObject);
    procedure Com_jlChange(Sender: TObject);
  private
    addrow:boolean;
    { Private declarations }
  public
    returnstr:string;
    { Public declarations }
  end;

var
  GjcxForm: TGjcxForm;

implementation

uses ZfSfcx,db;

{$R *.dfm}

procedure TGjcxForm.FormCreate(Sender: TObject);
begin
  addrow := false;
  StringGrid1.Cells[0,0] := '关键字';
  StringGrid1.Cells[1,0] := '条件';
  StringGrid1.Cells[2,0] := '数值';
  StringGrid1.Cells[3,0] := '连接条件';
end;

procedure TGjcxForm.BitBtn_AddClick(Sender: TObject);
begin
  if (Com_jl.Text='') or (Com_tj.Text='') then exit;
  if addrow then exit;
  stringgrid1.Cells[0,stringgrid1.RowCount-1] := Com_jl.Text;
  stringgrid1.Cells[1,stringgrid1.RowCount-1] := Com_tj.Text;
  stringgrid1.Cells[2,stringgrid1.RowCount-1] := edit1.Text;
  stringgrid1.Cells[3,stringgrid1.RowCount-1] := Com_lj.Text;
  addrow := true;
end;

procedure TGjcxForm.BitBtn_DelClick(Sender: TObject);
var
  i,j,k:integer;
begin
   if stringgrid1.RowCount=2 then
  begin
    stringgrid1.Cells[0,1] := '';
    stringgrid1.Cells[1,1] := '';
    stringgrid1.Cells[2,1] := '';
    stringgrid1.Cells[3,1] := '';
    addrow := false;
    exit;
  end;
  i:=stringgrid1.row;
  for j:=i to stringgrid1.RowCount do
    for k:=0 to stringgrid1.colCount-1 do
      stringgrid1.Cells[k,j]:=stringgrid1.Cells[k,j+1];
  stringgrid1.RowCount:=stringgrid1.RowCount-1;
  stringgrid1.Row := stringgrid1.RowCount -1;
  addrow := true;
end;

procedure TGjcxForm.BitBtn_OKClick(Sender: TObject);
var
  r_count:integer;
  f_name,linkstr:string;
begin
    returnstr :='';
  for r_count := 1 to stringgrid1.RowCount -1 do
  begin
    if StringGrid1.Cells[0,r_count] = '' then break;
    if r_count <> stringgrid1.RowCount -1 then
      if StringGrid1.Cells[3,r_count] = '或' then
        linkstr := 'or'
      else
        if StringGrid1.Cells[3,r_count] = '并且' then
          linkstr := 'and';
    if (r_count <> 1) then returnstr := returnstr + linkstr;
    f_name := fieldname.Items.Strings[Com_jl.Items.IndexOf(StringGrid1.Cells[0,r_count])];
    returnstr := returnstr + format(' %S %S ''%S'' ',[f_name,StringGrid1.Cells[1,r_count],StringGrid1.Cells[2,r_count]]);
  end;
  if trim(returnstr) <> '' then returnstr:=' where' + returnstr;

end;

procedure TGjcxForm.BitBtn_ExitClick(Sender: TObject);
begin
  close
end;

procedure TGjcxForm.Com_ljChange(Sender: TObject);
begin
   if (Com_lj.Text = '') then exit;
  if addrow then
  begin
    stringgrid1.Cells[3,stringgrid1.RowCount - 1] := Com_lj.Text;
    stringgrid1.RowCount:=stringgrid1.RowCount+1;
    stringgrid1.col:=0;
    stringgrid1.Row:=stringgrid1.RowCount - 1;
    addrow := false;
  end;
end;

procedure TGjcxForm.Com_jlChange(Sender: TObject);
begin
  {Edit1.Visible := false;
  DTP_sz.Visible := false;
  case ZfSfcxForm.ADQ_Zjgl.FieldByName(fieldname.Items.Strings[Com_jl.Items.IndexOf(Com_jl.Text)]).DataType of
     ftString,ftFloat:Edit1.Visible := true;
     ftDateTime:DTP_sz.Visible := true;
  end; }
end;

end.

⌨️ 快捷键说明

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