unit uViewPersonalContacto;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewBase, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxTextEdit, cxGridLevel,
  cxGridCustomTableView, cxGridTableView, cxGridBandedTableView,
  cxGridDBBandedTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
  uDADataTable, Grids, DBGrids, ActnList, ImgList, PngImageList, ComCtrls,
  ToolWin, cxGridDBTableView, uViewDetallesGenerico,
  uDAInterfaces, StdCtrls;
  
type
  TfrViewPersonalContacto = class(TfrViewDetallesGenerico)
    cxGridViewNOMBRE: TcxGridDBColumn;
    cxGridViewPUESTO: TcxGridDBColumn;
    cxGridViewTELEFONO: TcxGridDBColumn;
    cxGridViewMOVIL: TcxGridDBColumn;
    cxGridViewFAX: TcxGridDBColumn;
    cxGridViewEMAIL: TcxGridDBColumn;
    procedure cxGridViewDblClick(Sender: TObject);
    procedure actEliminarExecute(Sender: TObject);
  protected
    procedure AnadirInterno; override;
    procedure ModificarInterno; override;
  public
    { Public declarations }
  end;

implementation

{$R *.dfm}

uses
  uDialogUtils, uPersonalContactoController, uBizContactosPersonal;

procedure TfrViewPersonalContacto.actEliminarExecute(Sender: TObject);
begin
  if (ShowConfirmMessage('Eliminar un contacto de personal', '¿Desea eliminar este contacto de personal?') = IDYES) then
    inherited;
end;

procedure TfrViewPersonalContacto.AnadirInterno;
begin
  inherited;
  try
    with TPersonalContactoController.Create do
      Ver((dsDetalles.DataTable) as IBizContactoPersonal);
  finally
    if (dsDetalles.DataTable.State in dsEditModes) then
      dsDetalles.DataTable.Post;
  end;
end;

procedure TfrViewPersonalContacto.cxGridViewDblClick(Sender: TObject);
begin
  inherited;
  actModificar.Execute;
end;

procedure TfrViewPersonalContacto.ModificarInterno;
begin
  inherited;
  with TPersonalContactoController.Create do
    Ver((dsDetalles.DataTable) as IBizContactoPersonal);
end;

end.
