summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/VendedorUsuarioServico.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/Servicos/VendedorUsuarioServico.cs')
-rw-r--r--Gestor.Application/Servicos/VendedorUsuarioServico.cs160
1 files changed, 0 insertions, 160 deletions
diff --git a/Gestor.Application/Servicos/VendedorUsuarioServico.cs b/Gestor.Application/Servicos/VendedorUsuarioServico.cs
deleted file mode 100644
index 4804dac..0000000
--- a/Gestor.Application/Servicos/VendedorUsuarioServico.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos
-{
- public class VendedorUsuarioServico : BaseServico
- {
- public VendedorUsuarioServico()
- {
- }
-
- public async Task<bool> Delete(List<VendedorUsuario> vinculo)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- vinculo.ForEach((VendedorUsuario x) => commited.get_VendedorUsuarioRepository().Delete(x.get_Id()));
- commited.Commit();
- }
- flag = true;
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 272, num, vinculo, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<List<VendedorUsuario>> FindByVinculo(Usuario usuario)
- {
- int num = 3;
- List<VendedorUsuario> vendedorUsuarios = await Task.Run<List<VendedorUsuario>>(() => {
- List<VendedorUsuario> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- list = read.get_VendedorUsuarioRepository().FindByVinculo(usuario.get_Id()).ToList<VendedorUsuario>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 106, num, usuario, true);
- continue;
- }
- return list;
- }
- return new List<VendedorUsuario>();
- });
- return vendedorUsuarios;
- }
-
- public async Task<bool> FindVinculo(Vendedor vendedor)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- flag = read.get_VendedorUsuarioRepository().Exist(vendedor.get_Id());
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 271, num, vendedor, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> FindVinculoByUsuario(long idusuario)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- flag = read.get_VendedorUsuarioRepository().ExistVinculoUsuario(idusuario);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 106, num, null, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<List<VendedorUsuario>> SaveOrUpdate(List<VendedorUsuario> vinculo)
- {
- int num = 3;
- base.Sucesso = true;
- List<VendedorUsuario> vendedorUsuarios1 = vinculo;
- List<VendedorUsuario> vendedorUsuarios2 = await Task.Run<List<VendedorUsuario>>(() => {
- List<VendedorUsuario> vendedorUsuarios;
- while (num > 0)
- {
- vinculo = vendedorUsuarios1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- vinculo.ForEach((VendedorUsuario x) => commited.get_VendedorUsuarioRepository().SaveOrUpdate(x));
- commited.Commit();
- }
- vendedorUsuarios = vinculo;
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 271, num, vinculo, true);
- continue;
- }
- return vendedorUsuarios;
- }
- return vendedorUsuarios1;
- });
- return vendedorUsuarios2;
- }
- }
-} \ No newline at end of file