untquestions.pas

来自「简要说明:对医院幼儿心理情况做的一个调查,统计系统.」· PAS 代码 · 共 105 行

PAS
105
字号
unit untQuestions;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, untBaseMD, DB, Menus, ImgList, ADODB, Grids, DBGrids, StdCtrls,
  Buttons, ExtCtrls, jpeg, ComCtrls, ToolWin;

type
  TfrmQuestions = class(TfrmBaseMD)
    adsSinglecode: TStringField;
    adsSinglegrpcode: TStringField;
    adsSinglename: TStringField;
    adsSinglecontent: TStringField;
    adsSingleVarTag: TStringField;
    adsSingleIsUsed: TBooleanField;
    adsQuestionGrp: TADODataSet;
    adsQuestionGrpcode: TStringField;
    adsQuestionGrpname: TStringField;
    adsSingleGrpName: TStringField;
    adsDetailcode: TStringField;
    adsDetailquestioncode: TStringField;
    adsDetailselectTag: TStringField;
    adsDetailcontent: TStringField;
    adsDetailvalue: TIntegerField;
    adsSinglexh: TStringField;
    adsSingleItemDomain: TStringField;
    adsSingleDescript: TStringField;
    procedure FormDestroy(Sender: TObject);
    procedure btnFilterClick(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure InsRecord; override;
    procedure EditRecord; override;
    procedure BeforeDelete(var AllowDel: Boolean); override; 
  public
    { Public declarations }
    procedure LoadData; override;
  end;

var
  frmQuestions: TfrmQuestions;

implementation

uses untGlobalFun, untQuestionsSet, untGlobalVar;

{$R *.dfm}

{ TfrmQuestions }

procedure TfrmQuestions.LoadData;
begin
  with adsQuestionGrp do begin
    if Active then Active := false;
    Active := true;
  end;
  inherited;
end;

procedure TfrmQuestions.FormDestroy(Sender: TObject);
begin
  inherited;
  frmQuestions := nil;
end;

procedure TfrmQuestions.EditRecord;
begin
  inherited;
  if SetQuestions(adsSingle, omModi) then
    adsDetail.Requery()
  else if adsSingle.State in [dsInsert, dsEdit] then
    adsSingle.Cancel;
end;

procedure TfrmQuestions.InsRecord;
begin
  inherited;
  if SetQuestions(adsSingle, omNew) then
    adsDetail.Requery()
  else if adsSingle.State in [dsInsert, dsEdit] then
    adsSingle.Cancel;
end;

procedure TfrmQuestions.BeforeDelete(var AllowDel: Boolean);
begin
  inherited;
  ExecDBCommand(Conn,
                'delete from tselectitem where questioncode='
                +QuotedStr(adsSingle['code']));
end;

procedure TfrmQuestions.btnFilterClick(Sender: TObject);
begin
  //inherited;
  ExecDBCommand(Conn,'update tquestion set XH=case when len(xh)<3 then right(''000''+XH,3)'+
                         '  when ((len(xh)=3) and (substring(xh,3,1)>=''a'')) then right(''0000''+xh,4) ELSE  xh end');
 adsSingle.Close;
 adsSingle.Open;
end;

end.

⌨️ 快捷键说明

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