Varela_PuntosVenta/Source/ControlesBase/Reglas/uBizControlesBase.pas
2008-04-15 09:28:58 +00:00

81 lines
2.0 KiB
ObjectPascal
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit uBizControlesBase;
interface
uses
Classes, DB, SysUtils, uROClasses, uDADataTable, schControlesClient_Intf;
type
IBizControlBase = interface(IListaControlesPorCategoria)
['{203A654A-16DF-404B-ACD4-CCCA796091C6}']
procedure Show;
procedure VerPropiedades;
function EsModificable : Boolean;
end;
TBizControlBaseDataTableRules = class(TListaControlesPorCategoriaDataTableRules, IBizControlBase)
protected
function GetVISTAValue: IROStrings; override;
procedure BeforePost(Sender: TDADataTable); override;
public
procedure Show; virtual; abstract;
procedure VerPropiedades;
function EsModificable : Boolean;
end;
implementation
uses
Windows, Dialogs, uDACDSDataTable, uDMBase,
uEditorUtils, Variants, uFormPropiedadesControl, Forms, Controls;
{ TBizInformesVentasDataTableRules }
procedure TBizControlBaseDataTableRules.BeforePost(
Sender: TDADataTable);
begin
inherited;
if Length(CATEGORIA) = 0 then
raise Exception.Create('Categoría no asignada');
if Length(NOMBRE) = 0 then
VerPropiedades;
end;
function TBizControlBaseDataTableRules.EsModificable: Boolean;
begin
Result := (MODIFICABLE = 'S');
end;
function TBizControlBaseDataTableRules.GetVISTAValue: IROStrings;
begin
Result := NewROStrings();
Result.Add(DataTable.Fields[idx_ListaControlesPorCategoriaVISTA].AsString);
end;
procedure TBizControlBaseDataTableRules.VerPropiedades;
begin
with TfrPropiedadesControl.Create(NIL) do
try
Nombre := Self.NOMBRE;
Descripcion := Self.DESCRIPCION;
Modificable := Self.EsModificable;
Icono := Self.ICONO;
if (ShowModal = mrOK) then
begin
DataTable.Edit;
Self.NOMBRE := Nombre;
Self.DESCRIPCION := Descripcion;
Self.ICONO := Icono;
if Modificable then
Self.MODIFICABLE := 'S'
else
Self.MODIFICABLE := 'N';
end;
finally
Free;
end;
end;
end.