ConstruccionesCNJ_FactuGES/Modulos/Montajes/Views/uViewDatosYSeleccionMontaje.pas
2007-06-21 15:50:59 +00:00

153 lines
4.7 KiB
ObjectPascal

unit uViewDatosYSeleccionMontaje;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewBase, StdCtrls, cxControls, cxContainer, cxEdit, cxLabel,
cxDBLabel, ExtCtrls, DB, uDADataTable, uBizMontajes,
ComCtrls, ToolWin, ActnList, ImgList, PngImageList, cxTextEdit, cxDBEdit,
pngimage, JvExControls, JvComponent, JvButton, JvTransparentButton, Mask,
DBCtrls,
uMontajesController, dxLayoutControl, Buttons, cxMaskEdit, cxDropDownEdit,
cxCalendar;
type
IViewDatosYSeleccionMontaje = interface(IViewBase)
['{BCC2B36B-4A19-4981-B69A-56E258A898F0}']
function GetController: IMontajesController;
procedure SetController(Value: IMontajesController);
property Controller: IMontajesController read GetController write SetController;
function GetMontaje: IBizMontaje;
procedure SetMontaje(Value: IBizMontaje);
property Montaje: IBizMontaje read GetMontaje write SetMontaje;
function GetOnMontajeChanged : TNotifyEvent;
procedure SetOnMontajeChanged (const Value : TNotifyEvent);
property OnMontajeChanged : TNotifyEvent read GetOnMontajeChanged
write SetOnMontajeChanged;
end;
TfrViewDatosYSeleccionMontaje = class(TfrViewBase, IViewDatosYSeleccionMontaje)
DADataSource: TDADataSource;
ActionList1: TActionList;
actElegirMontaje: TAction;
actAnadirMontaje: TAction;
actVerMontaje: TAction;
PngImageList: TPngImageList;
dxLayoutControl1Group_Root: TdxLayoutGroup;
dxLayoutControl1: TdxLayoutControl;
dxLayoutControl1Item1: TdxLayoutItem;
edtlReferencia: TcxDBTextEdit;
Button1: TBitBtn;
dxLayoutControl1Item7: TdxLayoutItem;
Button2: TBitBtn;
dxLayoutControl1Item8: TdxLayoutItem;
Button3: TBitBtn;
dxLayoutControl1Item9: TdxLayoutItem;
dxLayoutControl1Group1: TdxLayoutGroup;
procedure actElegirMontajeExecute(Sender: TObject);
procedure actAnadirMontajeExecute(Sender: TObject);
procedure actVerMontajeExecute(Sender: TObject);
procedure actVerMontajeUpdate(Sender: TObject);
private
FController : IMontajesController;
FMontaje : IBizMontaje;
FOnMontajeChanged : TNotifyEvent;
protected
function GetController: IMontajesController;
procedure SetController(Value: IMontajesController);
function GetMontaje: IBizMontaje;
procedure SetMontaje(Value: IBizMontaje);
function GetOnMontajeChanged : TNotifyEvent;
procedure SetOnMontajeChanged (const Value : TNotifyEvent);
public
property Controller: IMontajesController read GetController write SetController;
property Montaje: IBizMontaje read GetMontaje write SetMontaje;
property OnMontajeChanged : TNotifyEvent read GetOnMontajeChanged write SetOnMontajeChanged;
end;
implementation
{$R *.dfm}
uses
uDataModuleMontajes, Math;
procedure TfrViewDatosYSeleccionMontaje.actElegirMontajeExecute(Sender: TObject);
var
AMontaje : IBizMontaje;
begin
inherited;
AMontaje := (Controller.ElegirMontaje(Controller.BuscarTodos, '', False) as IBizMontaje);
if Assigned(AMontaje) then
Montaje := AMontaje;
end;
procedure TfrViewDatosYSeleccionMontaje.actAnadirMontajeExecute(
Sender: TObject);
var
AMontaje : IBizMontaje;
begin
inherited;
AMontaje := (FController.Nuevo as IBizMontaje);
FController.Ver(AMontaje);
Montaje := AMontaje;
end;
procedure TfrViewDatosYSeleccionMontaje.actVerMontajeExecute(Sender: TObject);
begin
inherited;
FController.Ver(Montaje);
end;
procedure TfrViewDatosYSeleccionMontaje.actVerMontajeUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := Length(edtlReferencia.Text) > 0;
end;
function TfrViewDatosYSeleccionMontaje.GetMontaje: IBizMontaje;
begin
Result := FMontaje;
end;
function TfrViewDatosYSeleccionMontaje.GetController: IMontajesController;
begin
Result := FController;
end;
procedure TfrViewDatosYSeleccionMontaje.SetMontaje(Value: IBizMontaje);
begin
FMontaje := Value;
if Assigned(FMontaje) then
begin
DADataSource.DataTable := FMontaje.DataTable;
if not FMontaje.DataTable.Active then
FMontaje.DataTable.Active := True;
end
else
DADataSource.DataTable := NIL;
if Assigned(FOnMontajeChanged) then
FOnMontajeChanged(Self);
end;
procedure TfrViewDatosYSeleccionMontaje.SetController(Value: IMontajesController);
begin
FController := Value;
end;
function TfrViewDatosYSeleccionMontaje.GetOnMontajeChanged: TNotifyEvent;
begin
Result := FOnMontajeChanged;
end;
procedure TfrViewDatosYSeleccionMontaje.SetOnMontajeChanged(const Value: TNotifyEvent);
begin
FOnMontajeChanged := Value;
end;
end.