Commit c7c61256 authored by Thiago Anders's avatar Thiago Anders

Selecionar Exemplar funcionando

parent 0119f01b
*.dproj *.dproj
*.exe *.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 ...@@ -12,7 +12,7 @@ type
FNome: acString; FNome: acString;
FCPF: acString; FCPF: acString;
fEmprestimos: acRelationPartnerList; fEmprestimos: acRelationPartnerList;
public public
procedure toXML(piField: utField); procedure toXML(piField: utField);
published published
property Nome: acString read FNome write FNome; property Nome: acString read FNome write FNome;
......
...@@ -4,7 +4,7 @@ unit nguExemplar; ...@@ -4,7 +4,7 @@ unit nguExemplar;
interface interface
uses uses
acuframework; acuframework, utuMessage;
type type
ngExemplar = class(acPersistentObject) ngExemplar = class(acPersistentObject)
...@@ -13,6 +13,8 @@ type ...@@ -13,6 +13,8 @@ type
fLivro: acRelationPartnerShip; fLivro: acRelationPartnerShip;
fSituacao: acRelationPartnerShip; fSituacao: acRelationPartnerShip;
fEmprestimos: acRelationPartnerList; fEmprestimos: acRelationPartnerList;
public
procedure toXML(piField: utField);
published published
property Codigo: acString read FCodigo write FCodigo; property Codigo: acString read FCodigo write FCodigo;
property Livro: acRelationPartnerShip read fLivro write fLivro; property Livro: acRelationPartnerShip read fLivro write fLivro;
...@@ -22,6 +24,11 @@ type ...@@ -22,6 +24,11 @@ type
implementation implementation
procedure ngExemplar.toXML(piField: utField);
begin
piField.AddAttribute('OID').AsString := Self.IDO.AsString;
piField.AddAttribute('Codigo').AsString := Self.Codigo.AsString;
end;
initialization initialization
......
...@@ -4,7 +4,7 @@ unit nguLivro; ...@@ -4,7 +4,7 @@ unit nguLivro;
interface interface
uses uses
acuframework; acuframework, utuMessage;
type type
ngLivro = class(acPersistentObject) ngLivro = class(acPersistentObject)
...@@ -13,6 +13,8 @@ type ...@@ -13,6 +13,8 @@ type
FAutor: acString; FAutor: acString;
FEdicao: acString; FEdicao: acString;
fExemplares: acRelationPartnerList; fExemplares: acRelationPartnerList;
public
procedure toXML(piField: utField);
published published
property Titulo: acString read FTitulo write FTitulo; property Titulo: acString read FTitulo write FTitulo;
property Autor: acString read FAutor write FAutor; property Autor: acString read FAutor write FAutor;
...@@ -22,6 +24,13 @@ type ...@@ -22,6 +24,13 @@ type
implementation 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 initialization
......
...@@ -4,13 +4,15 @@ unit nguSituacaoExemplar; ...@@ -4,13 +4,15 @@ unit nguSituacaoExemplar;
interface interface
uses uses
acuframework; acuframework, utuMessage;
type type
ngSituacaoExemplar = class(acPersistentObject) ngSituacaoExemplar = class(acPersistentObject)
private private
FCodigo: acString; FCodigo: acString;
FDescricao: acString; FDescricao: acString;
public
procedure toXML(piField: utField);
published published
property Codigo: acString read FCodigo write FCodigo; property Codigo: acString read FCodigo write FCodigo;
property Descricao: acString read FDescricao write FDescricao; property Descricao: acString read FDescricao write FDescricao;
...@@ -18,6 +20,11 @@ type ...@@ -18,6 +20,11 @@ type
implementation implementation
procedure ngSituacaoExemplar.toXML(piField: utField);
begin
piField.AddAttribute('Codigo').AsString := Self.Codigo.AsString;
piField.AddAttribute('Descricao').AsString := Self.Descricao.AsString;
end;
initialization initialization
......
This diff is collapsed.
...@@ -11,8 +11,14 @@ type ...@@ -11,8 +11,14 @@ type
function Param_cpf: acOQLParamString; function Param_cpf: acOQLParamString;
end; end;
IObterExemplares = interface(IOQLQuery)
function Param_titulo: acOQLParamString;
function Param_codigo: acOQLParamString;
end;
utEmprestimoOQL = class utEmprestimoOQL = class
class function ObterClientes(piSessao: acPersistenceSession): IObterClientes; class function ObterClientes(piSessao: acPersistenceSession): IObterClientes;
class function ObterExemplares(piSessao: acPersistenceSession): IObterExemplares;
end; end;
implementation implementation
...@@ -24,6 +30,11 @@ type ...@@ -24,6 +30,11 @@ type
function Param_cpf: acOQLParamString; function Param_cpf: acOQLParamString;
end; end;
TObterExemplares = class(acOQLQuery, IObterExemplares)
function Param_titulo: acOQLParamString;
function Param_codigo: acOQLParamString;
end;
{ TObterClientes } { TObterClientes }
function TObterClientes.Param_nome: acOQLParamString; function TObterClientes.Param_nome: acOQLParamString;
...@@ -36,6 +47,18 @@ begin ...@@ -36,6 +47,18 @@ begin
result := acOQLParamString(Self.ParamByName('cpf')); result := acOQLParamString(Self.ParamByName('cpf'));
end; 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 } { utOQLs }
class function utEmprestimoOQL.ObterClientes(piSessao: acPersistenceSession): IObterClientes; class function utEmprestimoOQL.ObterClientes(piSessao: acPersistenceSession): IObterClientes;
...@@ -47,4 +70,14 @@ begin ...@@ -47,4 +70,14 @@ begin
' AND (ngCliente.CPF = ?cpf:acString OR ?cpf:acString IS NULL)'); ' AND (ngCliente.CPF = ?cpf:acString OR ?cpf:acString IS NULL)');
end; 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. 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