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

📄 unit1.pas

📁 用Delphi 开发的一个 户籍管理系统
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RzButton, Mask, RzEdit, DBCtrls, RzDBCmbo, RzLabel,
  ComCtrls, ToolWin, SUIToolBar, cxStyles, cxCustomData, cxGraphics,
  cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, ADODB,
  cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxClasses, cxControls, cxGridCustomView, cxGrid, ActnList;

type
  TForm1 = class(TForm)
    suiToolBar1: TsuiToolBar;
    btn_4: TToolButton;
    RzLabel39: TRzLabel;
    cbb_field: TRzDBLookupComboBox;
    RzLabel40: TRzLabel;
    edt_condition: TRzEdit;
    btn_find: TRzBitBtn;
    btn_search: TRzBitBtn;
    btn_showall: TRzBitBtn;
    btn_3: TToolButton;
    btn_exit: TRzBitBtn;
    actlst_hjgl: TActionList;
    act_find: TAction;
    act_search: TAction;
    act_showall: TAction;
    act_exit: TAction;
    grd_person: TcxGrid;
    tv_person: TcxGridDBTableView;
    lv_person: TcxGridLevel;
    ds_person: TDataSource;
    ds_fieldshow: TDataSource;
    dst_person: TADODataSet;
    strngfld__peopleCode: TWideStringField;
    strngfld__peopleName: TWideStringField;
    strngfld__peopleOldName: TWideStringField;
    strngfld__peopleSexName: TStringField;
    dtmfld__peopleBirthday: TDateTimeField;
    strngfld__peopleIDCard: TWideStringField;
    strngfld__peopledoorNumber: TWideStringField;
    strngfld__peopleHouseMaster: TWideStringField;
    strngfld__peoplerelationName: TWideStringField;
    strngfld__peoplemarriageName: TWideStringField;
    strngfld__peopleregTypeName: TWideStringField;
    strngfld__peopleGroupName: TWideStringField;
    dtmfld__peopleQfDate: TDateTimeField;
    strngfld__peoplerecordStatusName: TWideStringField;
    strngfld__peopleEduDegreeName: TWideStringField;
    strngfld__peopleBloodTypeName: TStringField;
    strngfld__peopleNationlityName: TStringField;
    strngfld__peopleHealthName: TWideStringField;
    strngfld__peopleReligionName: TWideStringField;
    strngfld__peopleEscuageName: TWideStringField;
    strngfld__peoplePolityName: TWideStringField;
    intgrfld__peopleregType: TIntegerField;
    strngfld__peoplerelation: TWideStringField;
    strngfld__peopleOrgan: TWideStringField;
    intgrfld__peopleRecordStatus: TIntegerField;
    dtmfld__peopleRecordDate: TDateTimeField;
    intgrfld__peopleEduDegree: TIntegerField;
    strngfld__peopleBirthAddress: TWideStringField;
    intgrfld__peopleSex: TIntegerField;
    intgrfld__peopleStature: TIntegerField;
    intgrfld__peopleBloodType: TIntegerField;
    intgrfld__peopleNationlity: TIntegerField;
    intgrfld__peopleHealth: TIntegerField;
    strngfld__peopleDwellingPlace: TWideStringField;
    strngfld__peopleTelephone: TWideStringField;
    strngfld__peopleOtherDwellingPlace: TWideStringField;
    intgrfld__peopleReligion: TIntegerField;
    intgrfld__peopleMarriage: TIntegerField;
    intgrfld__peopleEscuage: TIntegerField;
    strngfld__peopleWork: TWideStringField;
    strngfld__peopleService: TWideStringField;
    intgrfld__peoplePolity: TIntegerField;
    mfld__peopleRemark: TMemoField;
    blnfld__peopleLownessDefend: TBooleanField;
    blnfld__peopleArmyCorps: TBooleanField;
    blbfld__peoplePic: TBlobField;
    strngfld__peopleDoorRecordLocus: TWideStringField;
    strngfld__peopleNativePlace: TWideStringField;
    dtmfld__peopleIngoingDate: TDateTimeField;
    strngfld__peopleOriginalDwellingPlace: TWideStringField;
    intgrfld__peopleIngoingType: TIntegerField;
    fld__peopleIngoingTypeName: TStringField;
    strngfld__peopleIngoingCause: TWideStringField;
    dtmfld__peopleExceedDate: TDateTimeField;
    strngfld__peopleExceedAddress: TWideStringField;
    intgrfld__peopleExceedType: TIntegerField;
    fld__peopleExceedTypeName: TStringField;
    strngfld__peopleExceedCause: TWideStringField;
    blnfld__peopleDeath: TBooleanField;
    blnfld__peopleLogout: TBooleanField;
    dtmfld__peopleDeathDate: TDateTimeField;
    strngfld__peopleDeathCause: TWideStringField;
    dtmfld__peopleLogoutDate: TDateTimeField;
    strngfld__peopleLogoutCause: TWideStringField;
    intgrfld__peopleID: TIntegerField;
    blnfld__peopleisbmp: TBooleanField;
    lmn__personCode: TcxGridDBColumn;
    lmn__personName: TcxGridDBColumn;
    lmn__personOldName: TcxGridDBColumn;
    lmn__personSexName: TcxGridDBColumn;
    lmn__personBirthday: TcxGridDBColumn;
    lmn__personIDCard: TcxGridDBColumn;
    lmn__persondoorNumber: TcxGridDBColumn;
    lmn__personHouseMaster: TcxGridDBColumn;
    lmn__personrelationName: TcxGridDBColumn;
    lmn__personmarriageName: TcxGridDBColumn;
    lmn__personregTypeName: TcxGridDBColumn;
    lmn__personGroupName: TcxGridDBColumn;
    lmn__personQfDate: TcxGridDBColumn;
    lmn__personrecordStatusName: TcxGridDBColumn;
    lmn__personEduDegreeName: TcxGridDBColumn;
    lmn__personBloodTypeName: TcxGridDBColumn;
    lmn__personNationlityName: TcxGridDBColumn;
    lmn__personHealthName: TcxGridDBColumn;
    lmn__personReligionName: TcxGridDBColumn;
    lmn__personEscuageName: TcxGridDBColumn;
    lmn__personPolityName: TcxGridDBColumn;
    lmn__personregType: TcxGridDBColumn;
    lmn__personrelation: TcxGridDBColumn;
    lmn__personOrgan: TcxGridDBColumn;
    lmn__personRecordStatus: TcxGridDBColumn;
    lmn__personRecordDate: TcxGridDBColumn;
    lmn__personEduDegree: TcxGridDBColumn;
    lmn__personBirthAddress: TcxGridDBColumn;
    lmn__personSex: TcxGridDBColumn;
    lmn__personStature: TcxGridDBColumn;
    lmn__personBloodType: TcxGridDBColumn;
    lmn__personNationlity: TcxGridDBColumn;
    lmn__personHealth: TcxGridDBColumn;
    lmn__personDwellingPlace: TcxGridDBColumn;
    lmn__personTelephone: TcxGridDBColumn;
    lmn__personOtherDwellingPlace: TcxGridDBColumn;
    lmn__personReligion: TcxGridDBColumn;
    lmn__personMarriage: TcxGridDBColumn;
    lmn__personEscuage: TcxGridDBColumn;
    lmn__personWork: TcxGridDBColumn;
    lmn__personService: TcxGridDBColumn;
    lmn__personPolity: TcxGridDBColumn;
    lmn__personRemark: TcxGridDBColumn;
    lmn__personLownessDefend: TcxGridDBColumn;
    lmn__personArmyCorps: TcxGridDBColumn;
    lmn__personPic: TcxGridDBColumn;
    lmn__personDoorRecordLocus: TcxGridDBColumn;
    lmn__personNativePlace: TcxGridDBColumn;
    lmn__personIngoingDate: TcxGridDBColumn;
    lmn__personOriginalDwellingPlace: TcxGridDBColumn;
    lmn__personIngoingType: TcxGridDBColumn;
    lmn__personIngoingTypeName: TcxGridDBColumn;
    lmn__personIngoingCause: TcxGridDBColumn;
    lmn__personExceedDate: TcxGridDBColumn;
    lmn__personExceedAddress: TcxGridDBColumn;
    lmn__personExceedType: TcxGridDBColumn;
    lmn__personExceedTypeName: TcxGridDBColumn;
    lmn__personExceedCause: TcxGridDBColumn;
    lmn__personDeath: TcxGridDBColumn;
    lmn__personLogout: TcxGridDBColumn;
    lmn__personDeathDate: TcxGridDBColumn;
    lmn__personDeathCause: TcxGridDBColumn;
    lmn__personLogoutDate: TcxGridDBColumn;
    lmn__personLogoutCause: TcxGridDBColumn;
    lmn__personID: TcxGridDBColumn;
    lmn__personisbmp: TcxGridDBColumn;
    procedure act_findExecute(Sender: TObject);
    procedure act_searchExecute(Sender: TObject);
    procedure act_showallExecute(Sender: TObject);
    procedure act_exitExecute(Sender: TObject);
    procedure tv_personDblClick(Sender: TObject);
    procedure tv_personKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses F_RDB;
{$R *.dfm}

procedure TForm1.act_findExecute(Sender: TObject);
var
  tab: string;
begin
  tab := ds_fieldshow.DataSet.FieldByName('field').AsString;
  dst_person.Locate(tab, edt_condition.Text, [loCaseInsensitive, loPartialKey])
end;

procedure TForm1.act_searchExecute(Sender: TObject);
var
  tab: string;
begin
  tab := ds_FieldShow.DataSet.FieldByName('field').AsString;
  tab := 'select * from info_people where ' + tab + ' like ' +
    edt_condition.Text + '';
  dst_person.Active := False;
  dst_person.CommandText := tab;
  dst_person.Active := true;
end;

procedure TForm1.act_showallExecute(Sender: TObject);
var
  tab: string;
begin
  tab := 'select * from info_people';
  dst_person.Active := False;
  dst_person.CommandText := tab;
  dst_person.Active := true;
end;

procedure TForm1.act_exitExecute(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TForm1.tv_personDblClick(Sender: TObject);
begin
  if not dst_person.Active or (dst_person.RecordCount < 1) then
    exit;
  ModalResult := mrOk;
end;

procedure TForm1.tv_personKeyPress(Sender: TObject; var Key: Char);
begin
  if (Key = #13) and dst_person.Active and (dst_person.RecordCount > 0) then
    ModalResult := mrOk;
  if integer(Key) = VK_ESCAPE then
    ModalResult := mrCancel;
end;

end.

⌨️ 快捷键说明

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