summaryrefslogtreecommitdiff
path: root/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.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/AtividadeRepository.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.cs')
-rw-r--r--Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.cs92
1 files changed, 0 insertions, 92 deletions
diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.cs
deleted file mode 100644
index d3261c6..0000000
--- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/AtividadeRepository.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using AutoMapper;
-using Gestor.Infrastructure.Entities.Common;
-using Gestor.Infrastructure.Entities.Generic;
-using Gestor.Infrastructure.Mappers;
-using Gestor.Infrastructure.Repository.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Generic;
-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 AtividadeRepository : GenericRepository<AtividadeDb>, IAtividadeRepository, IGenericRepository<AtividadeDb>
- {
- private readonly GenericUnitOfWork _unitOfWork;
-
- public AtividadeRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session)
- {
- this._unitOfWork = unitOfWork;
- }
-
- public List<Atividade> Find(string filter)
- {
- AtividadeRepository.u003cu003ec__DisplayClass5_0 variable = null;
- IQueryable<AtividadeDb> atividadeDbs = base.All();
- ParameterExpression parameterExpression = Expression.Parameter(typeof(AtividadeDb), "x");
- IQueryable<AtividadeDb> atividadeDbs1 = atividadeDbs.Where<AtividadeDb>(Expression.Lambda<Func<AtividadeDb, bool>>(Expression.OrElse(Expression.Call(Expression.Call(Expression.Call(Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(AtividadeDb).GetMethod("get_Nome").MethodHandle)), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("Trim").MethodHandle), Array.Empty<Expression>()), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("ToUpper").MethodHandle), Array.Empty<Expression>()), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("Contains", new Type[] { typeof(string) }).MethodHandle), new Expression[] { Expression.Field(Expression.Constant(variable, typeof(AtividadeRepository.u003cu003ec__DisplayClass5_0)), FieldInfo.GetFieldFromHandle(typeof(AtividadeRepository.u003cu003ec__DisplayClass5_0).GetField("filter").FieldHandle)) }), Expression.Call(Expression.Call(Expression.Call(Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(AtividadeDb).GetMethod("get_Cnac").MethodHandle)), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("Trim").MethodHandle), Array.Empty<Expression>()), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("ToUpper").MethodHandle), Array.Empty<Expression>()), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(string).GetMethod("Contains", new Type[] { typeof(string) }).MethodHandle), new Expression[] { Expression.Field(Expression.Constant(variable, typeof(AtividadeRepository.u003cu003ec__DisplayClass5_0)), FieldInfo.GetFieldFromHandle(typeof(AtividadeRepository.u003cu003ec__DisplayClass5_0).GetField("filter").FieldHandle)) })), new ParameterExpression[] { parameterExpression }));
- parameterExpression = Expression.Parameter(typeof(AtividadeDb), "x");
- return atividadeDbs1.Select<AtividadeDb, Atividade>(Expression.Lambda<Func<AtividadeDb, Atividade>>(Expression.MemberInit(Expression.New(typeof(Atividade)), 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(Atividade).GetMethod("set_Nome", new Type[] { typeof(string) }).MethodHandle), Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(AtividadeDb).GetMethod("get_Nome").MethodHandle))), Expression.Bind((MethodInfo)MethodBase.GetMethodFromHandle(typeof(Atividade).GetMethod("set_Cnac", new Type[] { typeof(string) }).MethodHandle), Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(AtividadeDb).GetMethod("get_Cnac").MethodHandle))) }), new ParameterExpression[] { parameterExpression })).ToList<Atividade>();
- }
-
- 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(idatividade) as id FROM atividade";
- SqlDataReader sqlDataReader = sqlCommand1.ExecuteReader();
- sqlDataReader.Read();
- sqlDataReader["id"].ToString();
- num = (sqlDataReader["id"] == null || sqlDataReader["id"].ToString() == "" || sqlDataReader["id"].ToString() == "{}" ? (long)0 : long.Parse(sqlDataReader["id"].ToString()));
- }
- }
- return num;
- }
-
- public Atividade Merge(Atividade atividade)
- {
- AtividadeDb atividadeDb = ApplicationMapper.Mapper.Map<Atividade, AtividadeDb>(atividade);
- base.Merge(atividadeDb);
- return ApplicationMapper.Mapper.Map<AtividadeDb, Atividade>(atividadeDb);
- }
-
- public Atividade SaveOrUpdate(Atividade atividade)
- {
- AtividadeDb atividadeDb = ApplicationMapper.Mapper.Map<Atividade, AtividadeDb>(atividade);
- this.SaveOrUpdate(atividadeDb);
- return ApplicationMapper.Mapper.Map<AtividadeDb, Atividade>(atividadeDb);
- }
- }
-} \ No newline at end of file