118 lines
3.2 KiB
ObjectPascal
118 lines
3.2 KiB
ObjectPascal
|
|
unit uEditorClientes;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, uEditorContactos, Menus, ImgList, PngImageList, StdActns,
|
|||
|
|
ActnList, TB2ExtItems, TBXExtItems, TBX, TB2Item, TB2Dock, TB2Toolbar,
|
|||
|
|
JvExControls, JvComponent, JvNavigationPane, DB, uDADataTable,
|
|||
|
|
JvFormAutoSize, ComCtrls, uDAScriptingProvider, uDACDSDataTable, StdCtrls,
|
|||
|
|
JvAppStorage, JvAppRegistryStorage, JvFormPlacement, uCustomView,
|
|||
|
|
uViewBase, uViewBarraSeleccion, ExtCtrls, pngimage, JvComponentBase;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IEditorClientes = interface(IEditorContactos)
|
|||
|
|
['{C4C456DA-6E1F-41E7-A48D-B743BDD7FA18}']
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfEditorClientes = class(TfEditorContactos, IEditorClientes)
|
|||
|
|
procedure actEliminarExecute(Sender: TObject);
|
|||
|
|
procedure actDuplicarExecute(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
function GetSelectionBarVisible: Boolean;
|
|||
|
|
procedure SetSelectionBarVisible(const Value: Boolean);
|
|||
|
|
public
|
|||
|
|
property SelectionBarVisible : Boolean read GetSelectionBarVisible write
|
|||
|
|
SetSelectionBarVisible;
|
|||
|
|
constructor Create(AOwner: TComponent); override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
uViewClientes, uViewContactos, uEditorUtils,
|
|||
|
|
uDataModuleContactos, uDataModuleBase, uEditorGrid, uBizContacto,
|
|||
|
|
uDBSelectionList;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
function ShowEditorClientes (ABizObject : TDADataTableRules) : TModalResult;
|
|||
|
|
var
|
|||
|
|
AEditor: TfEditorClientes;
|
|||
|
|
begin
|
|||
|
|
AEditor := TfEditorClientes.Create(Application);
|
|||
|
|
try
|
|||
|
|
AEditor.Contactos := (ABizObject as IBizCliente);
|
|||
|
|
Result := AEditor.ShowModal;
|
|||
|
|
finally
|
|||
|
|
AEditor.Release;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function ShowSelectEditorClientes (ABizObject : TDADataTableRules) : TModalResult;
|
|||
|
|
var
|
|||
|
|
AEditor: TfEditorClientes;
|
|||
|
|
begin
|
|||
|
|
AEditor := TfEditorClientes.Create(Application);
|
|||
|
|
try
|
|||
|
|
AEditor.Contactos := (ABizObject as IBizCliente);
|
|||
|
|
AEditor.SelectionBarVisible := True;
|
|||
|
|
Result := AEditor.ShowModal;
|
|||
|
|
finally
|
|||
|
|
AEditor.Release;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
******************************* TfEditorClientes *******************************
|
|||
|
|
}
|
|||
|
|
procedure TfEditorClientes.actEliminarExecute(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if (Application.MessageBox('<27>Desea borrar este cliente?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ViewGrid.RefreshGrid;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
constructor TfEditorClientes.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ViewGrid := CreateView(TfrViewClientes) as IViewContactos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfEditorClientes.GetSelectionBarVisible: Boolean;
|
|||
|
|
begin
|
|||
|
|
Result := frViewBarraSeleccion.Visible
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorClientes.SetSelectionBarVisible(const Value: Boolean);
|
|||
|
|
begin
|
|||
|
|
frViewBarraSeleccion.Visible := True;
|
|||
|
|
ViewGrid.OnDblClick := frViewBarraSeleccion.actSeleccionar.OnExecute;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorClientes.actDuplicarExecute(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
AContacto : IBizContacto;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
AContacto := dmContactos.GetCliente(Contactos.CODIGO);
|
|||
|
|
Contactos.Insert;
|
|||
|
|
Contactos.CopyFrom(AContacto);
|
|||
|
|
Contactos.DataTable.ApplyUpdates;
|
|||
|
|
ViewGrid.RefreshGrid;
|
|||
|
|
ViewGrid.GotoFirst;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
initialization
|
|||
|
|
RegisterEditor(IBizCliente, ShowEditorClientes, etItems);
|
|||
|
|
RegisterEditor(IBizCliente, ShowSelectEditorClientes, etSelectItems);
|
|||
|
|
|
|||
|
|
finalization
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|