diff options
Diffstat (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs')
| -rw-r--r-- | Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs deleted file mode 100644 index 004432a..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs +++ /dev/null @@ -1,102 +0,0 @@ -using AutoMapper;
-using Gestor.Infrastructure.Entities.Ferramentas;
-using Gestor.Infrastructure.Helpers;
-using Gestor.Infrastructure.Mappers;
-using Gestor.Infrastructure.Repository.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Model.Domain.Ferramentas;
-using NHibernate;
-using NHibernate.Connection;
-using NHibernate.Impl;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Common;
-using System.Data.SqlClient;
-
-namespace Gestor.Infrastructure.Repository.Logic
-{
- public class ImpostoRepository : GenericRepository<ImpostoDb>, IImpostoRepository, IGenericRepository<ImpostoDb>
- {
- private readonly GenericUnitOfWork _unitOfWork;
-
- public ImpostoRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session)
- {
- this._unitOfWork = unitOfWork;
- }
-
- public List<Imposto> DefaultSelect(bool? ativo)
- {
- string str;
- if (!ativo.HasValue)
- {
- str = "";
- }
- else
- {
- str = (ativo.Value ? " AND Ativo = 1" : " AND Ativo = 0");
- }
- return this.Select(str);
- }
-
- public Imposto FindById(long id)
- {
- ImpostoDb impostoDb = base.FindEntityById(id);
- return ApplicationMapper.Mapper.Map<ImpostoDb, Imposto>(impostoDb);
- }
-
- public List<Imposto> FindByRamo(long id)
- {
- return this.Select(string.Format(" AND idramo = {0}", id));
- }
-
- public List<Imposto> FindBySeguradora(long id)
- {
- return this.Select(string.Format(" AND idciaseg = {0}", id));
- }
-
- public Imposto Merge(Imposto imposto)
- {
- ImpostoDb impostoDb = ApplicationMapper.Mapper.Map<Imposto, ImpostoDb>(imposto);
- base.Merge(impostoDb);
- return ApplicationMapper.Mapper.Map<ImpostoDb, Imposto>(impostoDb);
- }
-
- public Imposto SaveOrUpdate(Imposto imposto)
- {
- ImpostoDb impostoDb = ApplicationMapper.Mapper.Map<Imposto, ImpostoDb>(imposto);
- this.SaveOrUpdate(impostoDb);
- return ApplicationMapper.Mapper.Map<ImpostoDb, Imposto>(impostoDb);
- }
-
- private List<Imposto> Select(string condition)
- {
- object connection;
- DataTable dataTable = new DataTable();
- SessionFactoryImpl sessionFactory = this._unitOfWork.Session.SessionFactory as SessionFactoryImpl;
- if (sessionFactory != null)
- {
- connection = sessionFactory.ConnectionProvider.GetConnection();
- }
- else
- {
- connection = null;
- }
- using (SqlConnection sqlConnection = connection as SqlConnection)
- {
- using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
- {
- Auxiliar.CriarAuxiliar(sqlCommand, false);
- sqlCommand.CommandText = string.Concat("SELECT * FROM Imposto WHERE 1=1 ", condition);
- using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter())
- {
- sqlDataAdapter.SelectCommand = sqlCommand;
- sqlDataAdapter.Fill(dataTable);
- }
- }
- }
- return CustomMap.MapImposto(dataTable);
- }
- }
-}
\ No newline at end of file |