sz_xtajlbs.~pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:4k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit sz_xtajlbs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, DB, Mask, DBCtrls, DBCtrlsEh, Grids, DBGridEh,
- ExtCtrls, Buttons;
- type
- Tsz_xtajlb = class(TForm)
- GroupBox1: TGroupBox;
- Label1: TLabel;
- DBEdit1: TDBEdit;
- DataSource1: TDataSource;
- Label2: TLabel;
- DBEdit2: TDBEdit;
- Label3: TLabel;
- Label4: TLabel;
- DBEdit4: TDBEdit;
- Label35: TLabel;
- Edit1: TEdit;
- Label36: TLabel;
- Label37: TLabel;
- DBCheckBoxEh1: TDBCheckBoxEh;
- Label5: TLabel;
- Panel6: TPanel;
- DBGridEh6: TDBGridEh;
- SpeedButton19: TSpeedButton;
- SpeedButton21: TSpeedButton;
- SpeedButton22: TSpeedButton;
- SpeedButton23: TSpeedButton;
- Refresh: TSpeedButton;
- SpeedButton25: TSpeedButton;
- procedure SpeedButton25Click(Sender: TObject);
- procedure RefreshClick(Sender: TObject);
- procedure SpeedButton19Click(Sender: TObject);
- procedure SpeedButton21Click(Sender: TObject);
- procedure SpeedButton22Click(Sender: TObject);
- procedure SpeedButton23Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure FormCreate(Sender: TObject);
- procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- sz_xtajlb: Tsz_xtajlb;
- implementation
- uses DMs;
- {$R *.dfm}
- procedure Tsz_xtajlb.SpeedButton25Click(Sender: TObject);
- begin
- close;
- end;
- procedure Tsz_xtajlb.RefreshClick(Sender: TObject);
- begin
- dm.sz_xtajlb.Close;
- dm.sz_xtajlb.CommandText:='Select * from sz_xtajlb';
- dm.sz_xtajlb.Open;
- end;
- procedure Tsz_xtajlb.SpeedButton19Click(Sender: TObject);
- begin
- dm.sz_xtajlb.Close;
- dm.sz_xtajlb.CommandText:='select * from sz_xtajlb where xt_dm='+''''+''''+'';
- dm.sz_xtajlb.Open;
- DbEdit1.SetFocus;
- DBCheckboxEh1.Checked:=true;
- end;
- procedure Tsz_xtajlb.SpeedButton21Click(Sender: TObject);
- begin
- dm.sz_xtajlb.Edit;
- DbEDit1.SetFocus;
- end;
- procedure Tsz_xtajlb.SpeedButton22Click(Sender: TObject);
- begin
- if datasource1.DataSet.RecordCount=0 then
- begin
- application.MessageBox('表中没有数据,不能删除','提示',mb_ok+mb_iconquestion);
- exit;
- end
- else
- if application.MessageBox('您确定要删除?','警告',mb_okcancel+mb_iconquestion)=idok then
- begin
- dm.sz_xtajlb.Delete;
- dm.sz_xtajlb.ApplyUpdates(0);
- Refresh.Click;
- end
- else
- datasource1.DataSet.Cancel;
- end;
- procedure Tsz_xtajlb.SpeedButton23Click(Sender: TObject);
- var i:integer;
- hint:string;
- begin
- if DbEdit1.Text='' then
- begin
- application.MessageBox('系统案卷类别代码不可为空','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if DbEdit2.Text='' then
- begin
- application.MessageBox('系统案卷类别名称不可为空','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if DbCheckboxEh1.State=cbGrayed then
- begin
- application.MessageBox('归档案卷可否编辑必选','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if length(trim(DbEdit1.Text))<>length(Edit1.Text) then
- begin
- hint:='请输入'+inttoStr(length(Edit1.Text))+'位代码';
- application.MessageBox('编码规则不对','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- //------------以上为判断不符合条件的情况
- if dm.sz_xtajlb.FieldByName('xt_kfbj').AsBoolean then
- dm.sz_xtajlb.FieldByName('xt_kfbj_sm').AsString:='可以编辑'
- else
- dm.sz_xtajlb.FieldByName('xt_kfbj_sm').AsString:='不可以编辑';
- dm.sz_xtajlb.ApplyUpdates(0);
- i:=dm.sz_xtajlb.ApplyUpdates(0);
- if i=0 then
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- Refresh.Click;
- end
- else
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- end;
- procedure Tsz_xtajlb.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dm.sz_xtajlb.Active:=false;
- action:=cafree;
- sz_xtajlb:=nil;
- end;
- procedure Tsz_xtajlb.FormCreate(Sender: TObject);
- begin
- dm.sz_xtajlb.Active:=true;
- Dm.xt_lbjs.Close;
- Dm.xt_lbjs.CommandText:='Select lb_dmgz,lbjs_sm from xt_lbjs where lb_dm='+''''+'sz_xtajlb'+''''+'';
- Dm.xt_lbjs.Open;
- edit1.Text:=dm.xt_lbjs.fieldbyname('lb_dmgz').asstring;
- DBCheckboxEh1.Checked:=true;
- end;
- procedure Tsz_xtajlb.DBEdit1KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- Dbedit2.SetFocus;
- end;
- end.