unit uViewDireccionesEntrega;

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, cxCurrencyEdit,
  uDAInterfaces;    
  
type
  TfrViewDireccionesEntrega = class(TfrViewDetallesGenerico)
    cxGridViewDIRECCION: TcxGridDBColumn;
    cxGridViewPOBLACION: TcxGridDBColumn;
    cxGridViewCP: TcxGridDBColumn;
    cxGridViewPROVINCIA: TcxGridDBColumn;
    cxGridViewPERSONA_CONTACTO: TcxGridDBColumn;
    cxGridViewNOMBRE: TcxGridDBColumn;
    cxGridViewTELEFONO: TcxGridDBColumn;
    cxGridViewEMAIL: TcxGridDBColumn;
    cxGridViewPORTE: 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, uDireccionesContactoController, uBizDireccionesContacto;

procedure TfrViewDireccionesEntrega.actEliminarExecute(Sender: TObject);
begin
  if (ShowConfirmMessage('Eliminar una dirección', '¿Desea eliminar esta dirección?') = IDYES) then
    inherited;
end;

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

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

procedure TfrViewDireccionesEntrega.ModificarInterno;
begin
  inherited;
  with TDireccionesContactoController.Create do
    Ver((dsDetalles.DataTable) as IBizDireccionesContacto);
end;

end.
