summaryrefslogtreecommitdiff
path: root/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs')
-rw-r--r--Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ImpostoRepository.cs102
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