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 --- .../PermissaoUsuarioRepository.cs | 84 ---------------------- 1 file changed, 84 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PermissaoUsuarioRepository.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PermissaoUsuarioRepository.cs') diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PermissaoUsuarioRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PermissaoUsuarioRepository.cs deleted file mode 100644 index e0e226c..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PermissaoUsuarioRepository.cs +++ /dev/null @@ -1,84 +0,0 @@ -using AutoMapper; -using Gestor.Infrastructure.Entities.Seguros; -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.Common; -using Gestor.Model.Domain.Seguros; -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; -using System.Linq; - -namespace Gestor.Infrastructure.Repository.Logic -{ - public class PermissaoUsuarioRepository : GenericRepository, IPermissaoUsuarioRepository - { - private readonly GenericUnitOfWork _unitOfWork; - - public PermissaoUsuarioRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) - { - this._unitOfWork = unitOfWork; - } - - public PermissaoUsuario FindByPermissao(long id, TipoTela tela) - { - return this.Select(string.Format(" AND IdUsuario = {0} AND Tela = {1}", id, (int)tela)).FirstOrDefault(); - } - - public List FindByUsuario(long id) - { - return this.Select(string.Format(" AND IdUsuario = {0}", id)); - } - - public PermissaoUsuario Merge(PermissaoUsuario permissao) - { - PermissaoUsuarioDb permissaoUsuarioDb = ApplicationMapper.Mapper.Map(permissao); - base.Merge(permissaoUsuarioDb); - return ApplicationMapper.Mapper.Map(permissaoUsuarioDb); - } - - public PermissaoUsuario SaveOrUpdate(PermissaoUsuario permissao) - { - PermissaoUsuarioDb permissaoUsuarioDb = ApplicationMapper.Mapper.Map(permissao); - this.SaveOrUpdate(permissaoUsuarioDb); - return ApplicationMapper.Mapper.Map(permissaoUsuarioDb); - } - - 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.CriarAuxiliarUsuario(sqlCommand); - sqlCommand.CommandText = string.Concat("SELECT DISTINCT * FROM PermissaoUsuario WHERE 1=1 ", condition, ";"); - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - } - } - return dataTable.MapPermissao(); - } - } -} \ No newline at end of file -- cgit v1.2.3