unit U_DeptTypeHelp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, DB, ADODB, cxLookAndFeels,
  cxLookAndFeelPainters, cxTLdxBarBuiltInMenu, dxSkinsCore,
  dxSkinsDefaultPainters;

type
  TfrmDeptTypeHelp = class(TForm)
    ADOConnection1: TADOConnection;
    DataSource1: TDataSource;
    ADOQueryHelp: TADOQuery;
    cxDBTreeList1: TcxDBTreeList;
    cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cxDBTreeList1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmDeptTypeHelp: TfrmDeptTypeHelp;

implementation

uses
  U_DataLink;
{$R *.dfm}

procedure TfrmDeptTypeHelp.FormCreate(Sender: TObject);
begin
  cxDBTreeList1.Align := alclient;
  try
    with ADOConnection1 do
    begin
      Connected := false;
      ConnectionString := DConString;
      //ConnectionString:='';
      Connected := true;
    end;
  except
  end;
end;

procedure TfrmDeptTypeHelp.FormShow(Sender: TObject);
begin
  with ADOQueryHelp do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from SY_Dept order by DPlevel,DPOrder,DPName');
//    SQL.Add('select * from CP_Type order by CPlevel,CPOrder,CPName');
    Open;
  end;
  cxDBTreeList1.Items[0].Expand(false);        
end;

procedure TfrmDeptTypeHelp.cxDBTreeList1DblClick(Sender: TObject);
begin
  if ADOQueryHelp.IsEmpty then
    exit;
  ModalResult := 1;
end;

end.

