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

📄 frm_planecompanyinfo.pas

📁 这是一个基于delphi平台的物流空运管理系统!
💻 PAS
字号:
unit Frm_PlaneCompanyInfo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Frm_Cargo, XPMenu, Buttons, EnterAsTab, GIFImage, ExtCtrls,
  THPanel, ImgList, ComCtrls, StdCtrls, DB, ADODB;

type
  TFrmPlaneCompanyInfo = class(TFrmCargo)
    ImageList1: TImageList;
    QryTemp: TADOQuery;
    Panel1: TPanel;
    Panel2: TPanel;
    BtnCancel: TBitBtn;
    BtnNew: TBitBtn;
    BtnDelete: TBitBtn;
    BtnEdit: TBitBtn;
    LV: TListView;
    procedure FormCreate(Sender: TObject);
    procedure BtnNewClick(Sender: TObject);
    procedure BtnEditClick(Sender: TObject);
    procedure BtnDeleteClick(Sender: TObject);
    procedure BtnCancelClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure LVDblClick(Sender: TObject);
    procedure LVColumnClick(Sender: TObject; Column: TListColumn);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmPlaneCompanyInfo: TFrmPlaneCompanyInfo;

implementation

uses Frm_Main, Frm_PlaneCompanyEdit;

{$R *.dfm}

procedure TFrmPlaneCompanyInfo.FormCreate(Sender: TObject);
begin
  inherited;
  QryTemp.Close;
  QryTemp.sql.text :=
    'Select PlaneCompanyCode,PlaneCompanyID,PlaneCompanyName,PlaneCompanyCName,Remark from PlaneCompanyInfo';
  QryTemp.open;

  FrmMain.addcolumn(LV, '航空公司代码', 100);
  FrmMain.AddColumn(LV, '航空公司三字代码', 100);
  FrmMain.addcolumn(LV, '英文名称', 160);
  FrmMain.addcolumn(LV, '中文名称', 160);
  FrmMain.AddColumn(LV, '备注', 120);
  FrmMain.AddData(LV, QryTemp);
end;

procedure TFrmPlaneCompanyInfo.BtnNewClick(Sender: TObject);
begin
  inherited;
  FrmPlaneCompanyEdit := TFrmPlaneCompanyEdit.Create(Self);
  FrmPlaneCompanyEdit.IsEdit := False;
  FrmPlaneCompanyEdit.PlaneCompanyCode := '';
  FrmPlaneCompanyEdit.ShowModal;
end;

procedure TFrmPlaneCompanyInfo.BtnEditClick(Sender: TObject);
begin
  inherited;
  if LV.SelCount = 0 then
  begin
    ShowMessage('请选择一条记录进行编辑!');
    exit;
  end;
  FrmPlaneCompanyEdit := TFrmPlaneCompanyEdit.Create(Self);
  FrmPlaneCompanyEdit.IsEdit := True;
  FrmPlaneCompanyEdit.PlaneCompanyCode := lv.selected.caption;
  FrmPlaneCompanyEdit.BtnAdd.Enabled := True;
  FrmPlaneCompanyEdit.ShowModal;
end;

procedure TFrmPlaneCompanyInfo.BtnDeleteClick(Sender: TObject);
var
  SqlStr: string;
begin
  inherited;
  if FrmMain.IncludeValue('普通代码维护') then
  else
  begin
    ShowMessage('对不起,你不具有该操作的权限!');
    exit;
  end;

  if lv.Items.Count = 0 then
  begin
    ShowMessage('记录集为空,不能够删除');
    exit;
  end;
  if LV.SelCount = 0 then
  begin
    ShowMessage('请选取窗体中的一行!');
    exit; //如果没有选取行
  end;

  if MessageDlg('是否删除所选中的记录,请确定', mtConfirmation, [mbYes, mbNo], 0)
    = mrNO then
    exit;

  try
    SqlStr := 'Delete From PlaneCompanyInfo Where PlaneCompanyCode=''' +
      LV.Selected.Caption + '''';
    if FrmMain.ExecSQL(SqlStr) then
    else
    begin
      ShowMessage('记录删除失败,请检查!');
      exit;
    end;

    LV.Selected.Delete;

  except
    ShowMessage('删除操作进行失败,请检查!');
    Exit;
  end;

end;

procedure TFrmPlaneCompanyInfo.BtnCancelClick(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TFrmPlaneCompanyInfo.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  Action := Cafree;
end;

procedure TFrmPlaneCompanyInfo.FormDestroy(Sender: TObject);
begin
  inherited;
  FrmPlaneCompanyInfo := nil;
end;

procedure TFrmPlaneCompanyInfo.LVDblClick(Sender: TObject);
begin
  inherited;
  BtnEditClick(Sender);
end;

procedure TFrmPlaneCompanyInfo.LVColumnClick(Sender: TObject;
  Column: TListColumn);
begin
  inherited;
  FrmMain.SortLvData(lv, column.index);
end;

end.

⌨️ 快捷键说明

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