This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/Modulos/Pedidos de cliente/Model/uBizDetallesPedidoCliente.pas
2010-03-04 19:11:24 +00:00

100 lines
3.0 KiB
ObjectPascal

unit uBizDetallesPedidoCliente;
interface
uses
uDADataTable, schPedidosClienteClient_Intf, uBizDetalleColoresPedidoCliente;
const
BIZ_CLIENT_DETALLES_PEDIDO_CLIENTE = 'Client.PedidoCliente.Detalles';
BIZ_CLIENT_ARTICULOS_PEND_PEDIDO_CLIENTE = 'Client.PedidoCliente.ArticulosPendientes';
type
IBizDetallesPedidoCliente = interface(IPedidosCliente_Detalles)
['{2D7781DC-AD16-4857-9567-5C1620319781}']
function GetDetalleColores: IBizDetalleColoresPedidoCliente;
procedure SetDetalleColores(Value: IBizDetalleColoresPedidoCliente);
property DetalleColores: IBizDetalleColoresPedidoCliente read GetDetalleColores write SetDetalleColores;
end;
IBizPedidoClienteArticulosPend = interface(IPedidoCliente_Articulos_Pendientes)
['{DD245879-DD80-4E96-995A-6D3A09D72544}']
end;
TBizDetallesPedidoCliente = class(TPedidosCliente_DetallesDataTableRules, IBizDetallesPedidoCliente)
protected
FDetalleColores : IBizDetalleColoresPedidoCliente;
FDetalleColoresLink : TDADataSource;
function GetDetalleColores: IBizDetalleColoresPedidoCliente;
procedure SetDetalleColores(Value: IBizDetalleColoresPedidoCliente);
procedure OnNewRecord(Sender: TDADataTable); override;
procedure BeforeInsert(Sender: TDADataTable); override;
public
property DetalleColores: IBizDetalleColoresPedidoCliente read GetDetalleColores write SetDetalleColores;
constructor Create(aDataTable: TDADataTable); override;
destructor Destroy; override;
end;
TBizPedidoClienteArticulosPend = class(TPedidoCliente_Articulos_PendientesDataTableRules, IBizPedidoClienteArticulosPend)
end;
implementation
{ TBizDetallesPedidoCliente }
uses
uDataTableUtils, DB;
procedure TBizDetallesPedidoCliente.BeforeInsert(Sender: TDADataTable);
var
AMasterTable : TDADataTable;
begin
inherited;
AMasterTable := DataTable.GetMasterDataTable;
if Assigned(AMasterTable) and (AMasterTable.State = dsInsert) then
AMasterTable.Post;
end;
constructor TBizDetallesPedidoCliente.Create(aDataTable: TDADataTable);
begin
inherited;
FDetalleColoresLink := TDADataSource.Create(NIL);
FDetalleColoresLink.DataTable := aDataTable;
end;
destructor TBizDetallesPedidoCliente.Destroy;
begin
FDetalleColores := NIL;
FDetalleColoresLink.Free;
inherited;
end;
function TBizDetallesPedidoCliente.GetDetalleColores: IBizDetalleColoresPedidoCliente;
begin
Result := FDetalleColores;
end;
procedure TBizDetallesPedidoCliente.OnNewRecord(Sender: TDADataTable);
begin
inherited;
VISIBLE := 1;
end;
procedure TBizDetallesPedidoCliente.SetDetalleColores(Value: IBizDetalleColoresPedidoCliente);
begin
FDetalleColores := Value;
EnlazarMaestroDetalle(FDetalleColoresLink, FDetalleColores);
end;
initialization
RegisterDataTableRules(BIZ_CLIENT_DETALLES_PEDIDO_CLIENTE, TBizDetallesPedidoCliente);
RegisterDataTableRules(BIZ_CLIENT_ARTICULOS_PEND_PEDIDO_CLIENTE, TBizPedidoClienteArticulosPend);
end.