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 --- .../ParceiroRepository.cs | 108 --------------------- 1 file changed, 108 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ParceiroRepository.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ParceiroRepository.cs') diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ParceiroRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ParceiroRepository.cs deleted file mode 100644 index 476ec1a..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ParceiroRepository.cs +++ /dev/null @@ -1,108 +0,0 @@ -using AutoMapper; -using Gestor.Infrastructure.Entities.Generic; -using Gestor.Infrastructure.Entities.Seguros; -using Gestor.Infrastructure.Mappers; -using Gestor.Infrastructure.Repository.Generic; -using Gestor.Infrastructure.Repository.Interface; -using Gestor.Infrastructure.UnitOfWork.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using NHibernate; -using NHibernate.Connection; -using NHibernate.Impl; -using System; -using System.Collections.Generic; -using System.Data.SqlClient; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Runtime.CompilerServices; - -namespace Gestor.Infrastructure.Repository.Logic -{ - public class ParceiroRepository : GenericRepository, IParceiroRepository, IGenericRepository - { - private readonly GenericUnitOfWork _unitOfWork; - - public ParceiroRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) - { - this._unitOfWork = unitOfWork; - } - - public void Delete(long id) - { - base.Delete(base.FindEntityById(id)); - } - - public List Find() - { - List list = base.All().ToList(); - return ApplicationMapper.Mapper.Map, List>(list); - } - - public List Find(string filter) - { - ParceiroRepository.u003cu003ec__DisplayClass7_0 variable = null; - IQueryable parceiroDbs = base.All(); - ParameterExpression parameterExpression = Expression.Parameter(typeof(ParceiroDb), "x"); - IQueryable parceiroDbs1 = parceiroDbs.Where(Expression.Lambda>(Expression.Call(Expression.Call(Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(ParceiroDb).GetMethod("get_Nome").MethodHandle)), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("ToUpper").MethodHandle), Array.Empty()), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("Contains", new Type[] { typeof(string) }).MethodHandle), new Expression[] { Expression.Field(Expression.Constant(variable, typeof(ParceiroRepository.u003cu003ec__DisplayClass7_0)), FieldInfo.GetFieldFromHandle(typeof(ParceiroRepository.u003cu003ec__DisplayClass7_0).GetField("filter").FieldHandle)) }), new ParameterExpression[] { parameterExpression })); - parameterExpression = Expression.Parameter(typeof(ParceiroDb), "x"); - return parceiroDbs1.Select(Expression.Lambda>(Expression.MemberInit(Expression.New(typeof(Parceiro)), new MemberBinding[] { Expression.Bind((MethodInfo)MethodBase.GetMethodFromHandle(typeof(DomainBase).GetMethod("set_Id", new Type[] { typeof(long) }).MethodHandle), Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(EntityBase).GetMethod("get_Id").MethodHandle))), Expression.Bind((MethodInfo)MethodBase.GetMethodFromHandle(typeof(Parceiro).GetMethod("set_Nome", new Type[] { typeof(string) }).MethodHandle), Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(ParceiroDb).GetMethod("get_Nome").MethodHandle))) }), new ParameterExpression[] { parameterExpression })).ToList(); - } - - public Parceiro FindById(long id) - { - ParceiroDb parceiroDb = base.FindEntityById(id); - return ApplicationMapper.Mapper.Map(parceiroDb); - } - - public long FindLastId() - { - long num; - object connection; - SqlCommand sqlCommand; - SessionFactoryImpl sessionFactory = this._unitOfWork.Session.SessionFactory as SessionFactoryImpl; - if (sessionFactory != null) - { - connection = sessionFactory.ConnectionProvider.GetConnection(); - } - else - { - connection = null; - } - using (SqlConnection sqlConnection = connection as SqlConnection) - { - if (sqlConnection != null) - { - sqlCommand = sqlConnection.CreateCommand(); - } - else - { - sqlCommand = null; - } - using (SqlCommand sqlCommand1 = sqlCommand) - { - sqlCommand1.CommandText = "SELECT MAX(IDPARCEIRO) as id FROM parceiro"; - SqlDataReader sqlDataReader = sqlCommand1.ExecuteReader(); - sqlDataReader.Read(); - num = (sqlDataReader["id"] == null ? (long)0 : long.Parse(sqlDataReader["id"].ToString())); - } - } - return num; - } - - public Parceiro Merge(Parceiro parceiro) - { - ParceiroDb parceiroDb = ApplicationMapper.Mapper.Map(parceiro); - base.Merge(parceiroDb); - return ApplicationMapper.Mapper.Map(parceiroDb); - } - - public Parceiro SaveOrUpdate(Parceiro parceiro) - { - ParceiroDb parceiroDb = ApplicationMapper.Mapper.Map(parceiro); - this.SaveOrUpdate(parceiroDb); - return ApplicationMapper.Mapper.Map(parceiroDb); - } - } -} \ No newline at end of file -- cgit v1.2.3