This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Contactos/Cliente/uEditorVendedor.pas
2007-06-21 16:02:50 +00:00

82 lines
2.1 KiB
ObjectPascal

unit uEditorVendedor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEditorContacto, JvAppStorage, JvAppRegistryStorage,
JvComponent, JvFormPlacement, DB, uDADataTable, ImgList, PngImageList,
StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock, TB2Toolbar,
JvExControls, JvNavigationPane, ExtCtrls, pngimage;
type
IEditorVendedor = interface(IEditorContacto)
['{119A41EE-541C-4522-B786-5D64767E9018}']
end;
TfEditorVendedor = class(TfEditorContacto, IEditorVendedor)
procedure actEliminarExecute(Sender: TObject);
procedure dsDataTableDataChange(Sender: TObject; Field: TField);
public
constructor Create(AOwner: TComponent); override;
end;
var
fEditorVendedor: TfEditorVendedor;
implementation
uses
uEditorUtils, uBizContacto, uViewVendedor;
{$R *.dfm}
function ShowEditorVendedor (ABizObject : TDADataTableRules) : TModalResult;
var
AEditor: TfEditorVendedor;
begin
AEditor := TfEditorVendedor.Create(Application);
try
AEditor.Contacto := (ABizObject as IBizVendedor);
Result := AEditor.ShowModal;
finally
AEditor.Release;
end;
end;
{ TfEditorVendedor }
constructor TfEditorVendedor.Create(AOwner: TComponent);
begin
inherited;
ViewContacto := CreateView(TfrViewVendedor) as IViewVendedor;
end;
procedure TfEditorVendedor.actEliminarExecute(Sender: TObject);
begin
if (Application.MessageBox('¿Desea borrar este vendedor?', 'Atención', MB_YESNO) = IDYES) then
inherited;
end;
procedure TfEditorVendedor.dsDataTableDataChange(Sender: TObject;
Field: TField);
begin
inherited;
if Assigned(Contacto) and (not (Contacto.DataTable.Fetching) or
not (Contacto.DataTable.Opening) or not (Contacto.DataTable.Closing)) then
begin
if Length(Contacto.NOMBRE) = 0 then
JvNavPanelHeader.Caption := 'Nuevo vendedor'
else
JvNavPanelHeader.Caption := Contacto.NOMBRE;
Self.Caption := JvNavPanelHeader.Caption;
end;
end;
initialization
RegisterEditor(IBizVendedor, ShowEditorVendedor, etItem);
finalization
end.