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 --- .../DetalheExtratoRepository.cs | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/DetalheExtratoRepository.cs (limited to 'Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/DetalheExtratoRepository.cs') diff --git a/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/DetalheExtratoRepository.cs b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/DetalheExtratoRepository.cs new file mode 100644 index 0000000..54af174 --- /dev/null +++ b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/DetalheExtratoRepository.cs @@ -0,0 +1,99 @@ +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.Common; +using Gestor.Model.Domain.Seguros; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Runtime.CompilerServices; + +namespace Gestor.Infrastructure.Repository.Logic +{ + public class DetalheExtratoRepository : GenericRepository, IDetalheExtratoRepository, IGenericRepository + { + private readonly GenericUnitOfWork _unitOfWork; + + public DetalheExtratoRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) + { + this._unitOfWork = unitOfWork; + } + + public bool Completo(long id) + { + List statusParcelas = new List() + { + StatusParcela.BaixadaCritica, + StatusParcela.Baixada, + StatusParcela.BaixadaDiferencaPercentual, + StatusParcela.BaixadaAnteriormente, + StatusParcela.BaixadaManualmente, + StatusParcela.DesconsideradaUsuario, + StatusParcela.DesconsideradaSistema + }; + return ( + from x in base.All() + where x.Extrato.Id == id + select x).All((DetalheExtratoDb x) => statusParcelas.Contains(x.Status.Value)); + } + + public void Delete(long id) + { + DetalheExtratoDb detalheExtratoDb = base.FindEntityById(id); + if (detalheExtratoDb == null) + { + return; + } + base.Delete(detalheExtratoDb); + } + + public List Find(long id) + { + List list = ( + from x in base.All() + where x.Extrato.Id == id + select x).ToList(); + return ApplicationMapper.Mapper.Map, List>(list); + } + + public DetalheExtrato FindById(long id) + { + DetalheExtratoDb detalheExtratoDb = base.FindEntityById(id); + return ApplicationMapper.Mapper.Map(detalheExtratoDb); + } + + public List FindByLongId(long? id) + { + List list = ( + from x in base.All() + where (long?)x.Extrato.Id == id + select x).ToList(); + return ApplicationMapper.Mapper.Map, List>(list); + } + + public DetalheExtrato FindByParcelaId(long id) + { + DetalheExtratoDb detalheExtratoDb = base.All().FirstOrDefault((DetalheExtratoDb x) => x.Parcela == (long?)id); + return ApplicationMapper.Mapper.Map(detalheExtratoDb); + } + + public DetalheExtrato Merge(DetalheExtrato parcela) + { + DetalheExtratoDb detalheExtratoDb = ApplicationMapper.Mapper.Map(parcela); + base.Merge(detalheExtratoDb); + return ApplicationMapper.Mapper.Map(detalheExtratoDb); + } + + public DetalheExtrato SaveOrUpdate(DetalheExtrato parcela) + { + DetalheExtratoDb detalheExtratoDb = ApplicationMapper.Mapper.Map(parcela); + this.SaveOrUpdate(detalheExtratoDb); + return ApplicationMapper.Mapper.Map(detalheExtratoDb); + } + } +} \ No newline at end of file -- cgit v1.2.3