summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs
blob: b69bec063d9af1035377d78a27706fe4f1b9c6db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Linq;
using Gestor.Application.Helpers;
using Gestor.Application.ViewModels.Generic;
using Gestor.Common.Validation;
using Gestor.Model.Common;
using Gestor.Model.Domain.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Domain.Relatorios;
using Gestor.Model.Domain.Seguros;
using Newtonsoft.Json;

namespace Gestor.Application.ViewModels.Drawer;

public class LogAcaoViewModel : BaseViewModel
{
	private RegistroAcao _log;

	private string _obs;

	private Relatorio Relatorio { get; set; }

	public RegistroAcao Log
	{
		get
		{
			return _log;
		}
		set
		{
			_log = value;
			OnPropertyChanged("Log");
		}
	}

	public string Obs
	{
		get
		{
			return _obs;
		}
		set
		{
			_obs = value;
			OnPropertyChanged("Obs");
		}
	}

	public LogAcaoViewModel(RegistroAcao registro, Relatorio relatorio)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		Relatorio = relatorio;
		CarregarLog(registro);
	}

	private void CarregarLog(RegistroAcao registro)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Invalid comparison between Unknown and I4
		if (!registro.Tela.HasValue && !string.IsNullOrEmpty(registro.Observacao) && (int)Relatorio != 25)
		{
			Log = registro;
			Filtros filtros = JsonConvert.DeserializeObject<Filtros>(registro.Observacao);
			string text = ((filtros.Seguradoras == null || filtros.Seguradoras.Count == 0) ? "" : ("SEGURADORAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Seguradoras
				where filtros.Seguradoras.Contains(((DomainBase)x).Id)
				select x.NomeSocial) + Environment.NewLine + Environment.NewLine));
			string text2 = ((filtros.Status == null || filtros.Status.Count == 0) ? "" : ("STATUS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Status.Select((long x) => (TipoSeguro)x)) + Environment.NewLine + Environment.NewLine));
			string text3 = ((filtros.Ramos == null || filtros.Ramos.Count == 0) ? "" : ("RAMOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Ramos
				where filtros.Ramos.Contains(((DomainBase)x).Id)
				select x.Nome) + Environment.NewLine + Environment.NewLine));
			string text4 = ((filtros.Vendedores == null || filtros.Vendedores.Count == 0) ? "" : ("VENDEDORES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Vendedores
				where filtros.Vendedores.Contains(((DomainBase)x).Id)
				select x.Nome) + Environment.NewLine + Environment.NewLine));
			string text5 = ((filtros.Estipulantes == null || filtros.Estipulantes.Count == 0) ? "" : ("ESTIPULANTES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Estipulantes
				where filtros.Estipulantes.Contains(((DomainBase)x).Id)
				select x.Nome) + Environment.NewLine + Environment.NewLine));
			string text6 = ((filtros.Produtos == null || filtros.Produtos.Count == 0) ? "" : ("PRODUTOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Produtos
				where filtros.Produtos.Contains(((DomainBase)x).Id)
				select x.Nome) + Environment.NewLine + Environment.NewLine));
			string text7 = ((filtros.Negocio == null || filtros.Negocio.Count == 0) ? "" : ("TIPOS DE NEGÓCIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Negocio.Select((long x) => (NegocioCorretora)x)) + Environment.NewLine + Environment.NewLine));
			string text8 = ((filtros.Usuarios == null || filtros.Usuarios.Count == 0) ? "" : ("USUÁRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Usuarios
				where filtros.Usuarios.Contains(((DomainBase)x).Id)
				select x.Nome) + Environment.NewLine + Environment.NewLine));
			string text9 = ((filtros.Telas == null || filtros.Telas.Count == 0) ? "" : ("TELAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Telas.Select((long x) => (TipoTela)x)) + Environment.NewLine + Environment.NewLine));
			string text10 = ((filtros.Relatorios == null || filtros.Relatorios.Count == 0) ? "" : ("RELATÓRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Relatorios.Select((long x) => (Relatorio)x)) + Environment.NewLine + Environment.NewLine));
			string text11 = ((filtros.ParcelasEspeciais == null || !filtros.ParcelasEspeciais.Any((FiltroTipoParcela x) => x.Selecionado)) ? "" : ("TIPOS DE PARCELAS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.ParcelasEspeciais.Select((FiltroTipoParcela x) => x.Tipo)) + Environment.NewLine + Environment.NewLine));
			string text12 = ((filtros.IdEmpresa == 0L) ? "" : ("EMPRESA: " + Environment.NewLine + Recursos.Empresas.Find((Empresa x) => ((DomainBase)x).Id == filtros.IdEmpresa).Nome + Environment.NewLine + Environment.NewLine));
			_ = $"PERÍODO DE {filtros.Inicio:d} ATÉ {filtros.Fim:d}";
			Obs = ValidationHelper.GetDescription((Enum)(object)registro.Relatorio) + Environment.NewLine + Environment.NewLine + text12 + text + text3 + text6 + text4 + text5 + text2 + text7 + text11 + text8 + text9 + text10;
		}
		else
		{
			Log = registro;
			Obs = registro.Observacao;
		}
	}
}