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.
LuisLeon_FactuGES/Source/Modulos/Informes base/InformesBase/Reglas/uBizControlesBase.pas
2007-07-10 17:33:08 +00:00

81 lines
2.0 KiB
ObjectPascal

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, uDataModuleBase,
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.