diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs')
| -rw-r--r-- | Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs deleted file mode 100644 index d76619d..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/PlanosRepository.cs +++ /dev/null @@ -1,101 +0,0 @@ -using AutoMapper;
-using Gestor.Infrastructure.Entities.Financeiro;
-using Gestor.Infrastructure.Entities.Generic;
-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.Financeiro;
-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;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-namespace Gestor.Infrastructure.Repository.Logic
-{
- public class PlanosRepository : GenericRepository<PlanosDb>, IPlanosRepository, IGenericRepository<PlanosDb>
- {
- private readonly GenericUnitOfWork _unitOfWork;
-
- public PlanosRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session)
- {
- this._unitOfWork = unitOfWork;
- }
-
- public List<Planos> Find(string description)
- {
- PlanosRepository.u003cu003ec__DisplayClass3_0 variable = null;
- IQueryable<PlanosDb> planosDbs = base.All();
- ParameterExpression parameterExpression = Expression.Parameter(typeof(PlanosDb), "x");
- List<PlanosDb> list = planosDbs.Where<PlanosDb>(Expression.Lambda<Func<PlanosDb, bool>>(Expression.Call(Expression.Call(Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(typeof(PlanosDb).GetMethod("get_Descricao").MethodHandle)), (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(PlanosRepository.u003cu003ec__DisplayClass3_0)), FieldInfo.GetFieldFromHandle(typeof(PlanosRepository.u003cu003ec__DisplayClass3_0).GetField("description").FieldHandle)) }), new ParameterExpression[] { parameterExpression })).ToList<PlanosDb>();
- return ApplicationMapper.Mapper.Map<List<PlanosDb>, List<Planos>>(list);
- }
-
- public List<Planos> Find()
- {
- object connection;
- SessionFactoryImpl sessionFactory = this._unitOfWork.Session.SessionFactory as SessionFactoryImpl;
- DataTable dataTable = new DataTable();
- if (sessionFactory != null)
- {
- connection = sessionFactory.ConnectionProvider.GetConnection();
- }
- else
- {
- connection = null;
- }
- using (SqlConnection sqlConnection = connection as SqlConnection)
- {
- using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
- {
- AuxiliarFinanceiro.Criar(sqlCommand);
- sqlCommand.CommandText = "SELECT DISTINCT cs.idcplanos as id, cs.descricao as nome, cs.ativo, cs.idcplano, cs.idtipoconta, cs.ctipo, cp.descricao FROM cplanos cs INNER JOIN cplano cp ON cs.idcplano = cp.idcplano;";
- using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter())
- {
- sqlDataAdapter.SelectCommand = sqlCommand;
- sqlDataAdapter.Fill(dataTable);
- }
- }
- }
- return CustomMap.MapPlanos(dataTable);
- }
-
- public Planos FindById(long id)
- {
- PlanosDb planosDb = base.FindEntityById(id);
- return ApplicationMapper.Mapper.Map<PlanosDb, Planos>(planosDb);
- }
-
- public List<Planos> FindByPlanoId(long id)
- {
- List<PlanosDb> list = (
- from x in base.All()
- where x.Plano.Id == id
- select x).ToList<PlanosDb>();
- return ApplicationMapper.Mapper.Map<List<PlanosDb>, List<Planos>>(list);
- }
-
- public Planos Merge(Planos planos)
- {
- PlanosDb planosDb = ApplicationMapper.Mapper.Map<Planos, PlanosDb>(planos);
- base.Merge(planosDb);
- return ApplicationMapper.Mapper.Map<PlanosDb, Planos>(planosDb);
- }
-
- public Planos SaveOrUpdate(Planos planos)
- {
- PlanosDb planosDb = ApplicationMapper.Mapper.Map<Planos, PlanosDb>(planos);
- this.SaveOrUpdate(planosDb);
- return ApplicationMapper.Mapper.Map<PlanosDb, Planos>(planosDb);
- }
- }
-}
\ No newline at end of file |