unit uUsuarios;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, uDADataTable, dbcgrids, uDataModuleUsuarios, StdCtrls,
  DBCtrls, uDataModuleBase, JvExControls, JvComponent, JvNavigationPane,
  Grids, DBGrids, ActnList;

type
  TfUsuarios = class(TForm)
    DADataSource: TDADataSource;
    Grid: TDBGrid;
    JvNavPanelHeader1: TJvNavPanelHeader;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    ActionList: TActionList;
    actCerrar: TAction;
    actNuevo: TAction;
    actCambiarPassword: TAction;
    actModificar: TAction;
    actEliminar: TAction;
    procedure actCerrarExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure actEliminarUpdate(Sender: TObject);
    procedure actModificarUpdate(Sender: TObject);
    procedure actCambiarPasswordUpdate(Sender: TObject);
    procedure actNuevoUpdate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

procedure AdministrarUsuarios;

implementation

{$R *.dfm}


procedure AdministrarUsuarios;
var
  fUsuarios: TfUsuarios;
begin
  fUsuarios := TfUsuarios.Create(NIL);
  try
    fUsuarios.ShowModal;
  finally
    fUsuarios.Free;
  end;
end;

procedure TfUsuarios.actCerrarExecute(Sender: TObject);
begin
  Close;
end;

procedure TfUsuarios.FormCreate(Sender: TObject);
begin
{  DADataSource.DataTable := dmUsuarios.tbl_Usuarios;
  DADataSource.DataTable.Active := True;}
end;

procedure TfUsuarios.actEliminarUpdate(Sender: TObject);
begin
  (Sender as TAction).Enabled := not (DADataSource.DataTable.IsEmpty);
end;

procedure TfUsuarios.actModificarUpdate(Sender: TObject);
begin
  (Sender as TAction).Enabled := not (DADataSource.DataTable.IsEmpty);
end;

procedure TfUsuarios.actCambiarPasswordUpdate(Sender: TObject);
begin
  (Sender as TAction).Enabled := not (DADataSource.DataTable.IsEmpty);
end;

procedure TfUsuarios.actNuevoUpdate(Sender: TObject);
begin
  (Sender as TAction).Enabled := Assigned(DADataSource.DataTable);
end;

end.
