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 --- .../MetaVendedorRepository.cs | 125 --------------------- 1 file changed, 125 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/MetaVendedorRepository.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/MetaVendedorRepository.cs') diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/MetaVendedorRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/MetaVendedorRepository.cs deleted file mode 100644 index 04be6b1..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/MetaVendedorRepository.cs +++ /dev/null @@ -1,125 +0,0 @@ -using AutoMapper; -using Gestor.Infrastructure.Entities.Generic; -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.Generic; -using Gestor.Model.Domain.Relatorios; -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; -using System.Runtime.CompilerServices; - -namespace Gestor.Infrastructure.Repository.Logic -{ - public class MetaVendedorRepository : GenericRepository, IMetaVendedorRepository, IGenericRepository - { - private readonly GenericUnitOfWork _unitOfWork; - - public MetaVendedorRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) - { - this._unitOfWork = unitOfWork; - } - - public void Delete(long id) - { - base.Delete(base.FindEntityById(id)); - } - - public List Find(long id) - { - return ( - from x in this._unitOfWork.Session.CreateQuery(string.Format("from MetaVendedorDb WHERE idvendedor = {0}", id)).List() - select new MetaVendedor() - { - Id = x.Id, - Mes = x.Mes, - Ano = x.Ano, - Valor = x.Valor - }).ToList(); - } - - public MetaVendedor FindById(long id) - { - MetaVendedorDb metaVendedorDb = base.FindEntityById(id); - return ApplicationMapper.Mapper.Map(metaVendedorDb); - } - - public List FindByMeta(Filtros filtro) - { - List metaVendedors; - object connection; - string str = (filtro.Vendedores == null || filtro.Vendedores.Count == 0 ? "" : string.Concat(" AND idvendedor IN (", string.Join(",", - from v in filtro.Vendedores - select v), ")")); - 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()) - { - Auxiliar.CriarAuxiliar(sqlCommand, false); - object month = filtro.Fim.Month; - DateTime fim = filtro.Fim; - sqlCommand.CommandText = string.Format("SELECT IdMetaVendedor, IdVendedor, Mes, Ano, Valor\r\n FROM MetaVendedor\r\n WHERE Mes = {0} AND Ano = {1} {2};", month, fim.Year, str); - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - if (dataTable.Rows.Count != 0) - { - return ( - from x in dataTable.AsEnumerable().ToList() - select new MetaVendedor() - { - Id = x.Field("IdMetaVendedor"), - Mes = (Mes)x.Field("Mes"), - Ano = long.Parse(x.Field("Ano").ToString()), - Valor = x.Field("Valor"), - Vendedor = Auxiliar.Vendedores.FirstOrDefault((Vendedor v) => v.Id == x.Field("idvendedor")) - }).ToList(); - } - else - { - metaVendedors = new List(); - } - } - } - return metaVendedors; - } - - public MetaVendedor Merge(MetaVendedor metaVendedor) - { - MetaVendedorDb metaVendedorDb = ApplicationMapper.Mapper.Map(metaVendedor); - base.Merge(metaVendedorDb); - return ApplicationMapper.Mapper.Map(metaVendedorDb); - } - - public MetaVendedor SaveOrUpdate(MetaVendedor metaVendedor) - { - MetaVendedorDb metaVendedorDb = ApplicationMapper.Mapper.Map(metaVendedor); - this.SaveOrUpdate(metaVendedorDb); - return ApplicationMapper.Mapper.Map(metaVendedorDb); - } - } -} \ No newline at end of file -- cgit v1.2.3