-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jean Carlos Moreira da Silva
committed
Jul 29, 2018
1 parent
bd1703f
commit b1f5c08
Showing
12 changed files
with
189 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
-- ============================================= | ||
-- Author: Jean Moreira | ||
-- Create date: 29/07/2018 | ||
-- Description: Este procedimento tem como finalidade consultar os animais que ainda não foram adotados. | ||
-- ============================================= | ||
CREATE PROCEDURE p_sel_pets_not_adopted | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
SELECT | ||
|
||
[cd_animal] as Id, | ||
[nm_animal] as Name, | ||
[dc_animal] as Description, | ||
[animal].[cd_tipo_animal] as TypePetId, | ||
[T].[cd_tipo_animal] as split, | ||
[T].[cd_tipo_animal] as Id, | ||
[T].[dc_tipo_animal] as Description | ||
|
||
FROM [dbo].[animal] | ||
|
||
INNER JOIN [dbo].[tipo_animal] as [T] on [T].[cd_tipo_animal] = [animal].[cd_tipo_animal] | ||
|
||
WHERE [cd_animal] NOT IN(SELECT cd_animal FROM adocao) | ||
|
||
END | ||
GO |
30 changes: 30 additions & 0 deletions
30
Banco de Dados/Procedures/p_sel_reponsable_and_their_adoptions_by_id.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
-- ============================================= | ||
-- Author: Jean Moreira | ||
-- Create date: 29/07/2018 | ||
-- Description: Este procedimento tem como finalidade consultar os responsáveis e suas adoções pelo código do responsável. | ||
-- ============================================= | ||
ALTER PROCEDURE p_sel_reponsable_and_their_adoptions_by_id | ||
@cd_responsavel uniqueidentifier | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
SELECT | ||
(SELECT COUNT([cd_responsavel]) | ||
FROM [dbo].[adocao] as [A] WHERE [R].[cd_responsavel] = [A].[cd_responsavel]) as AdoptedPets | ||
,[cd_responsavel] as split | ||
,[cd_responsavel] as Id | ||
,[nm_responsavel] as Name | ||
,0 as splitCpf | ||
,[cpf_responsavel] as Number | ||
,0 as splitEmail | ||
,[email_responsavel] as Address | ||
|
||
FROM [dbo].[responsavel] as [R] | ||
WHERE [R].[cd_responsavel] = @cd_responsavel | ||
END | ||
GO |
30 changes: 30 additions & 0 deletions
30
Banco de Dados/Procedures/p_sel_reponsables_and_their_adoptions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
-- ============================================= | ||
-- Author: Jean Moreira | ||
-- Create date: 29/07/2018 | ||
-- Description: Este procedimento tem como finalidade consultar os responsáveis e suas adoções | ||
-- ============================================= | ||
CREATE PROCEDURE p_sel_reponsables_and_their_adoptions | ||
|
||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
SELECT | ||
(SELECT COUNT([cd_responsavel]) | ||
FROM [dbo].[adocao] as [A] WHERE [R].[cd_responsavel] = [A].[cd_responsavel]) as AdoptedPets | ||
,[cd_responsavel] as split | ||
,[cd_responsavel] as Id | ||
,[nm_responsavel] as Name | ||
,0 as splitCpf | ||
,[cpf_responsavel] as Number | ||
,0 as splitEmail | ||
,[email_responsavel] as Address | ||
|
||
FROM [dbo].[responsavel] as [R] | ||
|
||
END | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
-- ============================================= | ||
-- Author: Jean Moreira | ||
-- Create date: 29/07/2018 | ||
-- Description: Este procedimento tem como finalidade consultar os tipos dos animais. | ||
-- ============================================= | ||
CREATE PROCEDURE p_sel_type_pets | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
SELECT [cd_tipo_animal] as Id, [dc_tipo_animal] as Description FROM [dbo].[tipo_animal] | ||
|
||
END | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using SGA.Application.Domain.Dtos; | ||
using SGA.Domain.Entities.Models; | ||
using SGA.Domain.Entities.ValueObjects; | ||
using System; | ||
|
||
namespace SGA.Infra.Dapper.Maps | ||
{ | ||
public static class AdoptionMap | ||
{ | ||
public static Func<AdoptionDto, Responsible, Cpf, Email, AdoptionDto> AdoptionDto() | ||
{ | ||
return (ad, res, cpf, email) => | ||
{ | ||
res.SetCpf(cpf); | ||
res.SetEmail(email); | ||
ad.Responsible = res; | ||
return ad; | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using SGA.Domain.Entities.Models; | ||
using System; | ||
|
||
namespace SGA.Infra.Dapper.Maps | ||
{ | ||
public static class PetMap | ||
{ | ||
public static Func<Pet, TypePet, Pet> FullPet() | ||
{ | ||
return (p, t) => | ||
{ | ||
p.SetTypePet(t); | ||
return p; | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters