From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../ImpostoRepository.cs | 102 --------------------- 1 file changed, 102 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs') 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, IImpostoRepository, IGenericRepository - { - private readonly GenericUnitOfWork _unitOfWork; - - public ImpostoRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) - { - this._unitOfWork = unitOfWork; - } - - public List 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); - } - - public List FindByRamo(long id) - { - return this.Select(string.Format(" AND idramo = {0}", id)); - } - - public List FindBySeguradora(long id) - { - return this.Select(string.Format(" AND idciaseg = {0}", id)); - } - - public Imposto Merge(Imposto imposto) - { - ImpostoDb impostoDb = ApplicationMapper.Mapper.Map(imposto); - base.Merge(impostoDb); - return ApplicationMapper.Mapper.Map(impostoDb); - } - - public Imposto SaveOrUpdate(Imposto imposto) - { - ImpostoDb impostoDb = ApplicationMapper.Mapper.Map(imposto); - this.SaveOrUpdate(impostoDb); - return ApplicationMapper.Mapper.Map(impostoDb); - } - - private List 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 -- cgit v1.2.3