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

📄 uruanjian.pas

📁 用delphi实现的一个酒店管理系统框架
💻 PAS
字号:
unit URuanJian;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Inherit, ExtDlgs, Menus, RpDefine, RpRave, DB, ADODB, ImgList,
  ComCtrls, StdCtrls, RxRichEd, Grids, DBGrids, DBCtrls, ExtCtrls, ToolWin;

type
  TRJ = class(TTInherit)
    PopupMenu1: TPopupMenu;
    N5: TMenuItem;
    procedure FormShow(Sender: TObject);
    procedure Image1DblClick(Sender: TObject);
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    procedure N5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  RJ: TRJ;

implementation

uses Unit3;

//uses U4main;

{$R *.dfm}
Function ReadFileDT(FileName:PChar;var CrT,LAT,LWT:TDateTime):Boolean;//读文件日期时间
var t1,t2,t3:filetime;dft:DWord;lft:TFileTime;
ffd:TWin32FindData;H:THandle;
begin
H:=Windows.FindFirstFile(PChar(FileName),ffd);result:=True;
if (H=INVALID_HANDLE_VALUE) then begin showmessage('文件名错!');result:=False;exit;end;
Windows.FindClose(H);
T1:=ffd.ftCreationTime;//创建时间
T2:=ffd.ftLastAccessTime;//访问时间
T3:=ffd.ftLastWriteTime;//修改时间//win98下dt1...只能用dfShort
FileTimeToLocalFileTime(T1,lft);
FileTimeToDosDateTime(lft,LongRec(dft).Hi,LongRec(dft).Lo);
crT:=FileDateToDateTime(dft);//取得Delphi格式文件创建日期时间
FileTimeToLocalFileTime(T2,lft);
FileTimeToDosDateTime(lft,LongRec(dft).Hi,LongRec(dft).Lo);
LAT:=FileDateToDateTime(dft);//取得Delphi格式文件最后访问日期时间
FileTimeToLocalFileTime(T3,lft);
FileTimeToDosDateTime(lft,LongRec(dft).Hi,LongRec(dft).Lo);
LWT:=FileDateToDateTime(dft);//取得Delphi格式文件最后修改日期时间
end;

procedure TRJ.FormShow(Sender: TObject);
begin
//if not ADODataSet1.Active then ADODataSet1.Close;
//ADODataSet1.CommandText:='Select * from stuXP.dbo.当前';
if not ADODataSet1.Active and(ADODataSet1.CommandText<>'') then
 begin ADODataSet1.Open;Enables();end;
FormResize(Sender);
ToolButton15.Visible:=Form3.N25.Visible;
//ToolButton14.Visible:=true;
end;

procedure TRJ.Image1DblClick(Sender: TObject);
var CrT,LAT,LWT:TDateTime;y,m,d:word;
begin   // inherited;   
if (Sender Is TImage)or(ToolButton14.Caption<>'清除') then
Begin
 if OpenDialog1.Execute then ADODataSet1.Edit else exit;//打开文件成功进入编辑
 TBlobField(ADODataSet1.FieldByName('文件')).LoadFromFile(OpenDialog1.FileName);//加载图片
 ReadFileDT(pchar(OpenDialog1.FileName),CrT,LAT,LWT);DecodeDate(LWT,Y,M,D);
 ADODataSet1['版本']:=Format('%.4d年%.2d月%.2d日',[y,m,d]);
 ADODataSet1.Post;ToolButton14.Caption:='清除';//保存提交
End else
 Begin Image1.Picture.Graphic:=nil;ADODataSet1.Edit;
 ADODataSet1[F1TP]:='';ADODataSet1.Post;
 ToolButton14.Caption:='程序'; 
 End;
end;

procedure TRJ.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
//  inherited;//不显示为图片,因为是可执行文件
end;

procedure TRJ.N5Click(Sender: TObject);
begin  //  inherited; 将当前文件另存为
 SaveDialog1.Filter:='可执行文件|*.exe';
 SaveDialog1.FileName:=ADODataSet1['软件'];
 if not SaveDialog1.Execute then exit;
 TBlobField(ADODataSet1.FieldByName('文件')).SaveToFile(SaveDialog1.FileName);
end;

end.

⌨️ 快捷键说明

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