Commit c7c61256 authored by Thiago Anders's avatar Thiago Anders

Selecionar Exemplar funcionando

parent 0119f01b
*.dproj
*.exe
*.~*
*.rsm
<?xml version="1.0" encoding="ISO-8859-1" ?>
<DATA>
<oql name="ObterClientes" oqltype="0">
<description></description>
<query><![CDATA[SELECT ngCliente
FROM ngCliente
WHERE (ngCliente.Nome LIKE '%'+?nome:acString+'%' OR ?nome:acString IS NULL)
AND (ngCliente.CPF = ?cpf:acString OR ?cpf:acString IS NULL)]]></query>
</oql>
<oql name="ObterExemplares" oqltype="0">
<description></description>
<query><![CDATA[SELECT ngExemplar
FROM ngExemplar
WHERE (ngExemplar.Livro.Titulo LIKE '%'+?titulo:acString+'%' OR ?titulo:acString IS NULL)
AND (ngExemplar.Codigo = ?codigo:acString OR ?codigo:acString IS NULL)
ORDER BY ngExemplar.Livro.OID]]></query>
</oql>
</DATA>
This diff is collapsed.
This diff is collapsed.
......@@ -12,7 +12,7 @@ type
FNome: acString;
FCPF: acString;
fEmprestimos: acRelationPartnerList;
public
public
procedure toXML(piField: utField);
published
property Nome: acString read FNome write FNome;
......
......@@ -4,7 +4,7 @@ unit nguExemplar;
interface
uses
acuframework;
acuframework, utuMessage;
type
ngExemplar = class(acPersistentObject)
......@@ -13,6 +13,8 @@ type
fLivro: acRelationPartnerShip;
fSituacao: acRelationPartnerShip;
fEmprestimos: acRelationPartnerList;
public
procedure toXML(piField: utField);
published
property Codigo: acString read FCodigo write FCodigo;
property Livro: acRelationPartnerShip read fLivro write fLivro;
......@@ -22,6 +24,11 @@ type
implementation
procedure ngExemplar.toXML(piField: utField);
begin
piField.AddAttribute('OID').AsString := Self.IDO.AsString;
piField.AddAttribute('Codigo').AsString := Self.Codigo.AsString;
end;
initialization
......
......@@ -4,7 +4,7 @@ unit nguLivro;
interface
uses
acuframework;
acuframework, utuMessage;
type
ngLivro = class(acPersistentObject)
......@@ -13,6 +13,8 @@ type
FAutor: acString;
FEdicao: acString;
fExemplares: acRelationPartnerList;
public
procedure toXML(piField: utField);
published
property Titulo: acString read FTitulo write FTitulo;
property Autor: acString read FAutor write FAutor;
......@@ -22,6 +24,13 @@ type
implementation
procedure ngLivro.toXML(piField: utField);
begin
piField.AddAttribute('OID').AsString := Self.IDO.AsString;
piField.AddAttribute('Titulo').AsString := Self.Titulo.AsString;
piField.AddAttribute('Autor').AsString := Self.Autor.AsString;
piField.AddAttribute('Edicao').AsString := Self.Edicao.AsString;
end;
initialization
......
......@@ -4,13 +4,15 @@ unit nguSituacaoExemplar;
interface
uses
acuframework;
acuframework, utuMessage;
type
ngSituacaoExemplar = class(acPersistentObject)
private
FCodigo: acString;
FDescricao: acString;
public
procedure toXML(piField: utField);
published
property Codigo: acString read FCodigo write FCodigo;
property Descricao: acString read FDescricao write FDescricao;
......@@ -18,6 +20,11 @@ type
implementation
procedure ngSituacaoExemplar.toXML(piField: utField);
begin
piField.AddAttribute('Codigo').AsString := Self.Codigo.AsString;
piField.AddAttribute('Descricao').AsString := Self.Descricao.AsString;
end;
initialization
......
This diff is collapsed.
......@@ -11,8 +11,14 @@ type
function Param_cpf: acOQLParamString;
end;
IObterExemplares = interface(IOQLQuery)
function Param_titulo: acOQLParamString;
function Param_codigo: acOQLParamString;
end;
utEmprestimoOQL = class
class function ObterClientes(piSessao: acPersistenceSession): IObterClientes;
class function ObterExemplares(piSessao: acPersistenceSession): IObterExemplares;
end;
implementation
......@@ -24,6 +30,11 @@ type
function Param_cpf: acOQLParamString;
end;
TObterExemplares = class(acOQLQuery, IObterExemplares)
function Param_titulo: acOQLParamString;
function Param_codigo: acOQLParamString;
end;
{ TObterClientes }
function TObterClientes.Param_nome: acOQLParamString;
......@@ -36,6 +47,18 @@ begin
result := acOQLParamString(Self.ParamByName('cpf'));
end;
{ TObterExemplares }
function TObterExemplares.Param_titulo: acOQLParamString;
begin
result := acOQLParamString(Self.ParamByName('titulo'));
end;
function TObterExemplares.Param_codigo: acOQLParamString;
begin
result := acOQLParamString(Self.ParamByName('codigo'));
end;
{ utOQLs }
class function utEmprestimoOQL.ObterClientes(piSessao: acPersistenceSession): IObterClientes;
......@@ -47,4 +70,14 @@ begin
' AND (ngCliente.CPF = ?cpf:acString OR ?cpf:acString IS NULL)');
end;
class function utEmprestimoOQL.ObterExemplares(piSessao: acPersistenceSession): IObterExemplares;
begin
result := TObterExemplares.Create(pisessao,
'SELECT ngExemplar' + #13#10 +
'FROM ngExemplar' + #13#10 +
'WHERE (ngExemplar.Livro.Titulo LIKE ''%''+?titulo:acString+''%'' OR ?titulo:acString IS NULL)' + #13#10 +
' AND (ngExemplar.Codigo = ?codigo:acString OR ?codigo:acString IS NULL)' + #13#10 +
'ORDER BY ngExemplar.Livro.OID');
end;
end.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment