Nuevo método BuscarID
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@271 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
92da1b8c79
commit
be84f539bd
@ -11,6 +11,8 @@ type
|
||||
['{94E5F2B6-64C8-4331-B9CB-3ED730478529}']
|
||||
function BuscarTodos: IBizFormaPago;
|
||||
function Buscar(ID: Integer): IBizFormaPago;
|
||||
function BuscarID(ADescripcion: String): Integer;
|
||||
|
||||
procedure VerTodos(AFormasPago: IBizFormaPago);
|
||||
procedure Ver(AFormaPago: IBizFormaPago);
|
||||
procedure Anadir(AFormaPago : IBizFormaPago);
|
||||
@ -42,6 +44,7 @@ type
|
||||
procedure Anadir(AFormaPago : IBizFormaPago);
|
||||
function BuscarTodos: IBizFormaPago;
|
||||
function Buscar(ID: Integer): IBizFormaPago;
|
||||
function BuscarID(ADescripcion: String): Integer;
|
||||
procedure VerTodos(AFormasPago: IBizFormaPago);
|
||||
procedure Ver(AFormaPago: IBizFormaPago);
|
||||
function Localizar(AFormasPago: IBizFormaPago; ADescripcion:String): Boolean;
|
||||
@ -68,6 +71,23 @@ begin
|
||||
FDataModule := TDataModuleFormasPago.Create(Nil);
|
||||
end;
|
||||
|
||||
function TFormasPagoController.BuscarID(ADescripcion: String): Integer;
|
||||
var
|
||||
AFormaPago : IBizFormaPago;
|
||||
begin
|
||||
Result := -1;
|
||||
ShowHourglassCursor;
|
||||
AFormaPago := BuscarTodos;
|
||||
try
|
||||
AFormaPago.Open;
|
||||
if Localizar(AFormaPago, ADescripcion) then
|
||||
Result := AFormaPago.ID;
|
||||
finally
|
||||
AFormaPago := NIL;
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFormasPagoController.Buscar(ID: Integer): IBizFormaPago;
|
||||
var
|
||||
Condicion: TDAWhereExpression;
|
||||
@ -156,8 +176,6 @@ end;
|
||||
|
||||
function TFormasPagoController.ValidarFormaPago(AFormaPago: IBizFormaPago): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFormaPago) then
|
||||
raise Exception.Create ('Forma de pago no asignada');
|
||||
|
||||
@ -217,8 +235,6 @@ end;
|
||||
|
||||
function TFormasPagoController.Eliminar(AFormaPago: IBizFormaPago): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFormaPago) then
|
||||
raise Exception.Create ('Forma de pago no asignada');
|
||||
|
||||
@ -265,11 +281,17 @@ begin
|
||||
try
|
||||
with AFormasPago.DataTable do
|
||||
begin
|
||||
if not Active then
|
||||
Open;
|
||||
|
||||
DisableControls;
|
||||
First;
|
||||
if not Locate(fld_FormasPagoDESCRIPCION, ADescripcion, []) then
|
||||
Result := False;
|
||||
EnableControls;
|
||||
try
|
||||
First;
|
||||
if not Locate(fld_FormasPagoDESCRIPCION, ADescripcion, []) then
|
||||
Result := False;
|
||||
finally
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user