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(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; } } }