Exemplo n.º 1
0
 public Irmao PesquisarporNome(ref IUnitOfWork unitOfWork, string nome, int?id = null)
 {
     return(unitOfWork.Connection.Query <Irmao>(
                (id != null) ? @"SELECT * FROM dbo.[Irmao] WHERE UPPER(Nome) = Upper(@Nome)  and Codigo <> @Codigo " : "SELECT * FROM dbo.[Irmao] WHERE UPPER(Nome) = Upper(@Nome) ",
                param: new
     {
         @Nome = nome,
         @Codigo = (IntValues.IsNullorDefault(id)) ? (int?)null : id
     },
                transaction: unitOfWork.Transaction
                ).FirstOrDefault());
 }
Exemplo n.º 2
0
 public Grupo PesquisarporNomeGrupo(ref IUnitOfWork unitOfWork, string nome, int?id = null)
 {
     return(unitOfWork.Connection.Query <Grupo>(
                (id != null) ? @"SELECT G.* FROM dbo.[Grupo] G 
                              WHERE Nome = @Nome  and G.Codigo <> @Codigo " :
                @" SELECT G.* FROM 
                                 dbo.[Grupo] G 
                                 WHERE Nome = @Nome ",
                param: new
     {
         @Nome = nome,
         @Codigo = (IntValues.IsNullorDefault(id)) ? (int?)null : id
     },
                transaction: unitOfWork.Transaction
                ).FirstOrDefault());
 }
Exemplo n.º 3
0
 public DataEvento PesquisarporDataeCongregacao(ref IUnitOfWork unitOfWork, DataEvento model, int?id = null)
 {
     return(unitOfWork.Connection.Query <DataEvento>(
                (id != null) ? @"SELECT DE.* FROM dbo.[DataEvento] DE 
                              WHERE Data = CAST(@Data As Date) and CongregacaoId = @CongregacaoId  and DE.Codigo <> @Codigo " :
                @" SELECT DE.* FROM 
                                 dbo.[DataEvento] DE 
                                 WHERE Data = CAST(@Data As Date) and CongregacaoId = @CongregacaoId ",
                param: new
     {
         @Data = model.Data,
         @CongregacaoId = model.CongregacaoId,
         @Codigo = (IntValues.IsNullorDefault(id)) ? (int?)null : id
     },
                transaction: unitOfWork.Transaction
                ).FirstOrDefault());
 }
Exemplo n.º 4
0
 public Irmao PesquisarporEmail(ref IUnitOfWork unitOfWork, string email, int?id = null)
 {
     return(unitOfWork.Connection.Query <Irmao>(
                (id != null) ? @"SELECT I.*, C.Nome As CongregacaoNome, C.ExibirOracaoInicial FROM dbo.[Irmao] I 
                              INNER JOIN Congregacao C ON C.Codigo = I.CongregacaoId
                              WHERE Email = @Email  and I.Codigo <> @Codigo " :
                @" SELECT I.*, C.Nome As CongregacaoNome,  C.ExibirOracaoInicial FROM 
                                 dbo.[Irmao] I 
                                 INNER JOIN Congregacao C ON C.Codigo = I.CongregacaoId
                                 WHERE Email = @Email ",
                param: new
     {
         @Email = email,
         @Codigo = (IntValues.IsNullorDefault(id)) ? (int?)null : id
     },
                transaction: unitOfWork.Transaction
                ).FirstOrDefault());
 }