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

📄 c_lybedit.pas

📁 经典的酒店管理系统
💻 PAS
字号:
unit C_LybEdit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, StdCtrls, DBCtrls;

type
  TLybEditForm = class(TForm)
    tblLyb: TTable;
    dsLyb: TDataSource;
    DBText1: TDBText;
    DBText2: TDBText;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    DBText3: TDBText;
    tblLybD_LYBID: TIntegerField;
    tblLybD_XM: TStringField;
    tblLybD_RQ: TDateTimeField;
    tblLybD_SJ: TDateTimeField;
    tblLybD_NR: TBlobField;
    tblLybD_YDR: TBlobField;
    Label4: TLabel;
    DBMemo1: TDBMemo;
    Label5: TLabel;
    DBMemo2: TDBMemo;
    btnOk: TButton;
    btnCancel: TButton;
    procedure tblLybNewRecord(DataSet: TDataSet);
    procedure OnCancel(Sender: TObject);
    procedure OnOk(Sender: TObject);
  private
    { Private declarations }
    FYd : Boolean;
  public
    { Public declarations }
  end;

var
  LybEditForm: TLybEditForm;

procedure NewLyb;
procedure EditLyb(const aId: Integer);

implementation

uses C_Define, C_HotelData;

{$R *.dfm}
procedure NewLyb;
begin
  LybEditForm := TLybEditForm.Create(Application);
  try
    with LybEditForm do
    begin
      FYd := False;
      Caption := '新增留言';
      tblLyb.Open;
      tblLyb.Insert;
      ShowModal;
    end;
  finally
    LybEditForm.Free;
  end;

end;

procedure EditLyb(const aId: Integer);
begin
  LybEditForm := TLybEditForm.Create(Application);
  try
    with LybEditForm do
    begin
      FYd := True;
      Caption := '阅读留言';
      tblLyb.Open;
      tblLyb.Locate('D_LYBID',aId,[]);
      tblLyb.Edit;
      if CZY.CzyXm <> tblLybD_XM.Value then
      begin
        DBMemo1.ReadOnly := True;
        DBMemo2.ReadOnly := True;
      end;
      ShowModal;
    end;
  finally
    LybEditForm.Free;
  end;

end;


procedure TLybEditForm.tblLybNewRecord(DataSet: TDataSet);
begin
  tblLybD_LYBID.Value := HotelData.GetMaxId('select max(D_LYBID) from LYB');
  tblLybD_RQ.Value := Date;
  tblLybD_SJ.Value := Time;
  tblLybD_XM.Value := CZY.CzyXm;
end;

procedure TLybEditForm.OnCancel(Sender: TObject);
begin
  tblLyb.Cancel;
end;

procedure TLybEditForm.OnOk(Sender: TObject);
begin
  if FYd then
    tblLybD_YDR.Value := tblLybD_YDR.Value + CZY.CzyXm +',';
  tblLyb.Post;
  Close;
end;

end.

⌨️ 快捷键说明

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