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

📄 untquestiongrpset.pas

📁 简要说明:对医院幼儿心理情况做的一个调查,统计系统.
💻 PAS
字号:
unit untQuestionGrpSet;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, untBaseSingleEdit, DB, StdCtrls, Buttons, ExtCtrls, jpeg, ADODB,
  untGlobalVar, DBCtrls, Mask, fcButton, fcImgBtn;

type
  TfrmQuestionGrpSet = class(TfrmBaseSingleEdit)
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    Label3: TLabel;
    DBEdit2: TDBEdit;
    DBMemo1: TDBMemo;
  private
    { Private declarations }
  protected
    function CheckDataValid: Boolean; override;
    procedure InitComponents; override;
  public
    { Public declarations }
  end;

procedure SetQuestionGrp(ADataSet: TADODataSet; AOpMode: TOperatorMode);

implementation

uses untGlobalFun;

procedure SetQuestionGrp(ADataSet: TADODataSet; AOpMode: TOperatorMode);
begin
  with TfrmQuestionGrpSet.Create(Application) do begin
    DataSet := ADataSet;
    OpMode := AOpMode;
    Caption := '心理量表问题组';
    case OpMode of
      omNew : Caption := Caption + '—新增';
      omModi: Caption := Caption + '—编辑';
    end;
    ContinueAppend := true;
    if ShowModal <> mrOK then
      if ADataSet.State in [dsInsert, dsEdit] then
        ADataSet.Cancel;
    Free;
  end;
end;

{$R *.dfm}

{ TfrmQuestionGrpSet }

function TfrmQuestionGrpSet.CheckDataValid: boolean;
begin
  Result := False;
  with TField(DataSet.FieldByName('code')) do begin
    if IsNull or (Trim(Value)='') then begin
      FocusControl;
      MsgOk(DisplayLabel+'不能为空!');
      Exit;
    end;
  end;
  with TField(DataSet.FieldByName('name')) do begin
    if IsNull or (Trim(Value)='') then begin
      FocusControl;
      MsgOk(DisplayLabel+'不能为空!');
      Exit;
    end;
  end;
  if (OpMode=omNew) and (GetDBValue(DataSet.Connection, 'select count(*) from tquestiongrp where code='+QuotedStr(DataSet['code']))>0) then
  begin
    DataSet.FieldByName('code').FocusControl;
    MsgOK(DataSet.FieldByName('code').DisplayLabel+'重复,请重新输入!');
    Exit;
  end;
  Result := true;
end;

procedure TfrmQuestionGrpSet.InitComponents;
begin
  inherited;
  if OpMode = omNew then  begin
    DataSet.FieldByName('code').Value := GetMaxID('tQuestionGrp', 'code', DataSet.Connection);
    DataSet.FieldByName('IsUsed').Value := 1;
  end;
end;

end.

⌨️ 快捷键说明

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