102 lines
2.8 KiB
ObjectPascal
102 lines
2.8 KiB
ObjectPascal
|
|
unit uEditorContacto;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, uEditorDBItem, ToolWin, ComCtrls, JvExControls, JvComponent,
|
|||
|
|
uViewContacto, uBizContacto, JvNavigationPane, ActnList,
|
|||
|
|
uEditorBase, StdActns, TB2Dock, TB2Toolbar, TBX, ImgList, PngImageList,
|
|||
|
|
TB2Item, uEditorItem, DB, uDADataTable, uEditorDBBase, JvFormAutoSize,
|
|||
|
|
uDAScriptingProvider, uDACDSDataTable, StdCtrls, pngimage, ExtCtrls,
|
|||
|
|
TBXDkPanels, JvButton, AppEvnts, uCustomView, uViewBase, uViewMensaje,
|
|||
|
|
JvAppStorage, JvAppRegistryStorage, JvFormPlacement;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IEditorContacto = interface(IEditorDBItem)
|
|||
|
|
['{21DD6B74-F218-4AFC-91EE-1ECD4ADF1553}']
|
|||
|
|
function GetContacto: IBizContacto;
|
|||
|
|
procedure SetContacto(const Value: IBizContacto);
|
|||
|
|
property Contacto: IBizContacto read GetContacto write SetContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfEditorContacto = class(TfEditorDBItem, IEditorContacto)
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FContacto: IBizContacto;
|
|||
|
|
FViewContacto : IViewContacto;
|
|||
|
|
protected
|
|||
|
|
function GetContacto: IBizContacto; virtual;
|
|||
|
|
procedure SetContacto(const Value: IBizContacto); virtual;
|
|||
|
|
|
|||
|
|
function GetViewContacto: IViewContacto;
|
|||
|
|
procedure SetViewContacto(const Value: IViewContacto);
|
|||
|
|
property ViewContacto: IViewContacto read GetViewContacto write
|
|||
|
|
SetViewContacto;
|
|||
|
|
public
|
|||
|
|
property Contacto: IBizContacto read GetContacto write SetContacto;
|
|||
|
|
destructor Destroy; override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
uCustomEditor, uDataModuleContactos, uDataModuleBase;
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
******************************* TfEditorContacto *******************************
|
|||
|
|
}
|
|||
|
|
function TfEditorContacto.GetContacto: IBizContacto;
|
|||
|
|
begin
|
|||
|
|
Result := FContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfEditorContacto.GetViewContacto: IViewContacto;
|
|||
|
|
begin
|
|||
|
|
Result := FViewContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorContacto.SetContacto(const Value: IBizContacto);
|
|||
|
|
begin
|
|||
|
|
FContacto := Value;
|
|||
|
|
dsDataTable.DataTable := FContacto.DataTable;
|
|||
|
|
|
|||
|
|
if Assigned(FViewContacto) and Assigned(Contacto) then
|
|||
|
|
FViewContacto.Contacto := Contacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorContacto.SetViewContacto(const Value: IViewContacto);
|
|||
|
|
begin
|
|||
|
|
FViewContacto := Value;
|
|||
|
|
|
|||
|
|
if Assigned(FViewContacto) and Assigned(Contacto) then
|
|||
|
|
FViewContacto.Contacto := Contacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorContacto.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
if not Assigned(FViewContacto) then
|
|||
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|||
|
|
|
|||
|
|
if not Assigned(Contacto) then
|
|||
|
|
raise Exception.Create('No hay ning<6E>n contacto asignado');
|
|||
|
|
|
|||
|
|
Contacto.DataTable.Active := True;
|
|||
|
|
FViewContacto.ShowEmbedded(pagGeneral);
|
|||
|
|
FViewContacto.SetFocus;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
destructor TfEditorContacto.Destroy;
|
|||
|
|
begin
|
|||
|
|
FViewContacto := NIL;
|
|||
|
|
FContacto := NIL;
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|