summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs')
-rw-r--r--Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs1784
1 files changed, 1784 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs b/Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs
new file mode 100644
index 0000000..cdeb60c
--- /dev/null
+++ b/Codemerx/Gestor.Application/ViewModels/Drawer/LogViewModel.cs
@@ -0,0 +1,1784 @@
+using ControlzEx;
+using CsQuery.ExtensionMethods.Internal;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Financeiro;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Validation;
+using MaterialDesignThemes.Wpf;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Gestor.Application.ViewModels.Drawer
+{
+ public class LogViewModel : BaseSegurosViewModel
+ {
+ private readonly LogServico _servico;
+
+ private readonly TipoTela _tipoTela;
+
+ private readonly long _id;
+
+ private Visibility _visibilityDetalhesLog = Visibility.Hidden;
+
+ private bool _mostrar;
+
+ private bool _mostrarMensagem;
+
+ private string _mostrarToolTip = "MOSTRAR TODAS OS CAMPOS";
+
+ private long _mostrarColuna = (long)120;
+
+ private PackIcon _mostrarIcone;
+
+ private ObservableCollection<RegistroLog> _logs;
+
+ private string _currentDescription;
+
+ private RegistroLog _selectedLog;
+
+ private List<TupleList> _lists;
+
+ private ObservableCollection<TupleList> _listsAlterados;
+
+ private ObservableCollection<TupleList> _listsAdicionados;
+
+ private ObservableCollection<TupleList> _listsRemovidos;
+
+ private string _textAdicoes;
+
+ public string CurrentDescription
+ {
+ get
+ {
+ return this._currentDescription;
+ }
+ set
+ {
+ this._currentDescription = value;
+ base.OnPropertyChanged("CurrentDescription");
+ }
+ }
+
+ public List<TupleList> Lists
+ {
+ get
+ {
+ return this._lists;
+ }
+ set
+ {
+ this._lists = value;
+ this.SetListaFiltrada(value);
+ base.OnPropertyChanged("Lists");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsAdicionados
+ {
+ get
+ {
+ return this._listsAdicionados;
+ }
+ set
+ {
+ this._listsAdicionados = value;
+ base.OnPropertyChanged("ListsAdicionados");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsAlterados
+ {
+ get
+ {
+ return this._listsAlterados;
+ }
+ set
+ {
+ this._listsAlterados = value;
+ base.OnPropertyChanged("ListsAlterados");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsRemovidos
+ {
+ get
+ {
+ return this._listsRemovidos;
+ }
+ set
+ {
+ this._listsRemovidos = value;
+ if (this.ListsAlterados != null || this.ListsAdicionados != null || value != null)
+ {
+ this.MostrarMensagem = false;
+ }
+ else
+ {
+ this.MostrarMensagem = true;
+ }
+ base.OnPropertyChanged("ListsRemovidos");
+ }
+ }
+
+ public ObservableCollection<RegistroLog> Logs
+ {
+ get
+ {
+ return this._logs;
+ }
+ set
+ {
+ this._logs = value;
+ base.OnPropertyChanged("Logs");
+ }
+ }
+
+ public bool Mostrar
+ {
+ get
+ {
+ return this._mostrar;
+ }
+ set
+ {
+ this._mostrar = value;
+ if (!value)
+ {
+ this.MostrarColuna = (long)240;
+ this.MostrarToolTip = "MOSTRAR TODOS OS CAMPOS";
+ PackIcon packIcon = new PackIcon();
+ packIcon.set_Kind(1497);
+ this.MostrarIcone = packIcon;
+ }
+ else
+ {
+ this.MostrarColuna = (long)240;
+ this.MostrarToolTip = "ESCONDER CAMPOS INALTERADOS";
+ PackIcon packIcon1 = new PackIcon();
+ packIcon1.set_Kind(1492);
+ this.MostrarIcone = packIcon1;
+ }
+ base.OnPropertyChanged("Mostrar");
+ }
+ }
+
+ public long MostrarColuna
+ {
+ get
+ {
+ return this._mostrarColuna;
+ }
+ set
+ {
+ this._mostrarColuna = value;
+ base.OnPropertyChanged("MostrarColuna");
+ }
+ }
+
+ public PackIcon MostrarIcone
+ {
+ get
+ {
+ return this._mostrarIcone;
+ }
+ set
+ {
+ this._mostrarIcone = value;
+ base.OnPropertyChanged("MostrarIcone");
+ }
+ }
+
+ public bool MostrarMensagem
+ {
+ get
+ {
+ return this._mostrarMensagem;
+ }
+ set
+ {
+ this._mostrarMensagem = value;
+ base.OnPropertyChanged("MostrarMensagem");
+ }
+ }
+
+ public string MostrarToolTip
+ {
+ get
+ {
+ return this._mostrarToolTip;
+ }
+ set
+ {
+ this._mostrarToolTip = value;
+ base.OnPropertyChanged("MostrarToolTip");
+ }
+ }
+
+ public RegistroLog SelectedLog
+ {
+ get
+ {
+ return this._selectedLog;
+ }
+ set
+ {
+ List<TupleList> tupleLists;
+ ObservableCollection<Tuple<string, string, string>> observableCollection;
+ List<TupleList>.Enumerator enumerator;
+ this._selectedLog = value;
+ List<TupleList> tupleLists1 = new List<TupleList>();
+ try
+ {
+ if (!value.get_ModeloNovo())
+ {
+ switch (this._tipoTela)
+ {
+ case 1:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Cliente>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 2:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Documento>(this.SelectedLog.get_Descricao()).Log(base.Restricao(14));
+ break;
+ }
+ case 3:
+ {
+ Item item = JsonConvert.DeserializeObject<Item>(this.SelectedLog.get_Descricao());
+ if (item.get_Aeronautico() != null)
+ {
+ tupleLists1 = Aeronautico.Log(item);
+ break;
+ }
+ else if (item.get_Auto() != null)
+ {
+ tupleLists1 = Auto.Log(item);
+ break;
+ }
+ else if (item.get_Granizo() != null)
+ {
+ tupleLists1 = Granizo.Log(item);
+ break;
+ }
+ else if (item.get_Patrimonial() != null)
+ {
+ tupleLists1 = Patrimonial.Log(item);
+ break;
+ }
+ else if (item.get_RiscosDiversos() == null)
+ {
+ if (item.get_Vida() == null)
+ {
+ break;
+ }
+ tupleLists1 = Vida.Log(item);
+ break;
+ }
+ else
+ {
+ tupleLists1 = RiscosDiversos.Log(item);
+ break;
+ }
+ }
+ case 4:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Trilha>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 5:
+ {
+ try
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Parcelas>(this.SelectedLog.get_Descricao()).Log(base.Restricao(14), base.Restricao(95));
+ break;
+ }
+ catch
+ {
+ tupleLists1 = LogViewModel.DefaultLog(this.SelectedLog.get_Descricao(), this.SelectedLog.get_Acao());
+ break;
+ }
+ break;
+ }
+ case 6:
+ case 8:
+ case 20:
+ case 21:
+ case 23:
+ case 25:
+ case 27:
+ case 32:
+ case 35:
+ case 39:
+ case 40:
+ case 44:
+ case 47:
+ case 49:
+ case 50:
+ case 51:
+ case 53:
+ {
+ tupleLists1 = LogViewModel.DefaultLog(this.SelectedLog.get_Descricao(), this.SelectedLog.get_Acao());
+ break;
+ }
+ case 7:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Sinistro>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 9:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Estipulante>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 10:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Produto>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 11:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Status>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 12:
+ {
+ Ramo ramo = JsonConvert.DeserializeObject<Ramo>(this.SelectedLog.get_Descricao());
+ List<CoberturaPadrao> list = (
+ from x in Recursos.Coberturas
+ where x.get_IdRamo() == ramo.get_Id()
+ orderby x.get_Padrao() descending, x.get_Descricao()
+ select x).ToList<CoberturaPadrao>();
+ tupleLists1 = JsonConvert.DeserializeObject<Ramo>(this.SelectedLog.get_Descricao()).Log(list);
+ break;
+ }
+ case 13:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Seguradora>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 14:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TipoVendedor>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 15:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Vendedor>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 16:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Usuario>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 17:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Credencial>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 18:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Empresa>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 19:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Socio>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 22:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Parceiro>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 24:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Fornecedor>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 26:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<BancosContas>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 28:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Planos>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 29:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Centro>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 30:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<MetaVendedor>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 31:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<MetaSeguradora>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 33:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Prospeccao>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 34:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Agenda>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 36:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Adiantamento>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 37:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<VendedorParcelas>(this.SelectedLog.get_Descricao()).Log(base.Restricao(14), base.Restricao(95));
+ break;
+ }
+ case 38:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Tarefa>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 41:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TrocaCliente>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 42:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Recibo>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 43:
+ {
+ List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> tuples = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(this.SelectedLog.get_Descricao());
+ tupleLists = new List<TupleList>();
+ foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> tuple in tuples)
+ {
+ observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>(string.Concat(tuple.Item1, "$"), "", "")
+ };
+ foreach (Tuple<string, List<Tuple<string, string>>> item2 in tuple.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item2.Item1, "$"), "", ""));
+ foreach (Tuple<string, string> item21 in item2.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item21.Item1), item21.Item2, ""));
+ }
+ }
+ TupleList tupleList = new TupleList();
+ tupleList.set_Tuples(observableCollection);
+ tupleLists.Add(tupleList);
+ }
+ enumerator = tupleLists.GetEnumerator();
+ try
+ {
+ while (enumerator.MoveNext())
+ {
+ tupleLists1.Add(enumerator.Current);
+ }
+ break;
+ }
+ finally
+ {
+ ((IDisposable)enumerator).Dispose();
+ }
+ break;
+ }
+ case 45:
+ {
+ List<Vendedor> vendedors = JsonConvert.DeserializeObject<List<Vendedor>>(this.SelectedLog.get_Descricao());
+ tupleLists = new List<TupleList>();
+ observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
+ };
+ foreach (Vendedor vendedor in vendedors)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Format(" VENDEDOR {0}", vendedors.IndexOf(vendedor) + 1), vendedor.get_Nome(), ""));
+ }
+ TupleList tupleList1 = new TupleList();
+ tupleList1.set_Tuples(observableCollection);
+ tupleLists.Add(tupleList1);
+ enumerator = tupleLists.GetEnumerator();
+ try
+ {
+ while (enumerator.MoveNext())
+ {
+ tupleLists1.Add(enumerator.Current);
+ }
+ break;
+ }
+ finally
+ {
+ ((IDisposable)enumerator).Dispose();
+ }
+ break;
+ }
+ case 46:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Expedicao>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 48:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Qualificacao>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 52:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TipoDeTarefa>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 54:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Repasse>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 55:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<NotaFiscal>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ case 56:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Imposto>(this.SelectedLog.get_Descricao()).Log();
+ break;
+ }
+ default:
+ {
+ goto case 53;
+ }
+ }
+ }
+ else
+ {
+ switch (value.get_Acao())
+ {
+ case 0:
+ case 2:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<List<ValorOriginal>>(this.SelectedLog.get_Descricao()).LogList(base.Restricao(14));
+ break;
+ }
+ case 1:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<List<Diferenca>>(this.SelectedLog.get_Descricao()).LogList(base.Restricao(14));
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ }
+ this.Lists = tupleLists1;
+ base.OnPropertyChanged("SelectedLog");
+ }
+ }
+
+ public string TextAdicoes
+ {
+ get
+ {
+ return this._textAdicoes;
+ }
+ set
+ {
+ this._textAdicoes = value;
+ base.OnPropertyChanged("TextAdicoes");
+ }
+ }
+
+ public Visibility VisiblityDetalhesLog
+ {
+ get
+ {
+ return this._visibilityDetalhesLog;
+ }
+ set
+ {
+ this._visibilityDetalhesLog = value;
+ base.OnPropertyChanged("VisiblityDetalhesLog");
+ }
+ }
+
+ public LogViewModel(TipoTela tela, long id, List<long> parcelas = null, int numparcela = 0)
+ {
+ this._visibilityDetalhesLog = Visibility.Hidden;
+ this._mostrarToolTip = "MOSTRAR TODAS OS CAMPOS";
+ this._mostrarColuna = (long)120;
+ PackIcon packIcon = new PackIcon();
+ packIcon.set_Kind(1497);
+ this._mostrarIcone = packIcon;
+ this._logs = new ObservableCollection<RegistroLog>();
+ this._currentDescription = "";
+ this._lists = new List<TupleList>();
+ this._listsAlterados = new ObservableCollection<TupleList>();
+ this._listsAdicionados = new ObservableCollection<TupleList>();
+ this._listsRemovidos = new ObservableCollection<TupleList>();
+ this._textAdicoes = "INCLUSÃO";
+ base();
+ this._servico = new LogServico();
+ this._tipoTela = tela;
+ this._id = id;
+ this.VisiblityDetalhesLog = (Recursos.Configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema c) => c.get_Configuracao() == 55) ? Visibility.Visible : Visibility.Hidden);
+ base.EnableMenu = true;
+ if (parcelas != null)
+ {
+ this.LogParcelas(id, parcelas, numparcela);
+ return;
+ }
+ this.Seleciona(tela, id, null, null);
+ }
+
+ public int BuscaNumeroParcela(string json)
+ {
+ int num;
+ int num1;
+ try
+ {
+ string[] strArrays = json.Split(new char[] { '}' }).FirstOrDefault<string>((string x) => x.Contains("NumeroParcela")).Split(new char[] { ':' });
+ num1 = (int.TryParse(strArrays[(int)strArrays.Length - 1].Replace("\"", ""), out num) ? num : 0);
+ }
+ catch
+ {
+ num1 = 0;
+ }
+ return num1;
+ }
+
+ private static List<TupleList> DefaultLog(string log, TipoAcao acao)
+ {
+ List<TupleList> tupleLists = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ tupleList.set_Tuples(new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>(Gestor.Model.Validation.Funcoes.GetDescription(acao), log, "")
+ });
+ tupleLists.Add(tupleList);
+ return tupleLists;
+ }
+
+ public void Imprimir()
+ {
+ bool count;
+ bool flag;
+ bool count1;
+ bool flag1;
+ bool count2;
+ bool flag2;
+ string str = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>LOGS</title></head><body><div align='center'>";
+ ObservableCollection<TupleList> listsAlterados = this.ListsAlterados;
+ if (listsAlterados != null)
+ {
+ count = listsAlterados.Count > 0;
+ }
+ else
+ {
+ count = false;
+ }
+ if (count)
+ {
+ str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>ALTERAÇÃO</font>");
+ }
+ if (this.ListsAlterados != null)
+ {
+ foreach (TupleList listsAlterado in this.ListsAlterados)
+ {
+ foreach (Tuple<string, string, string> tuple in listsAlterado.get_Tuples())
+ {
+ if (tuple == listsAlterado.get_Tuples().First<Tuple<string, string, string>>())
+ {
+ str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ bool flag3 = tuple.Item1.Contains("$");
+ string[] item2 = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
+ item2[2] = (flag3 ? "900" : "700");
+ item2[3] = "; padding-left: 5px'>";
+ item2[4] = tuple.Item1.Replace(" ", "&nbsp;").Replace("$", "");
+ item2[5] = "</font></td><td style='width: ";
+ item2[6] = (this.Mostrar ? "483px" : "240px");
+ item2[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
+ item2[8] = tuple.Item2;
+ item2[9] = "</font></td>";
+ str = string.Concat(item2);
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple.Item3, "</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ if ((object)listsAlterado == (object)this.ListsAlterados.Last<TupleList>())
+ {
+ continue;
+ }
+ str = string.Concat(str, "<br>");
+ }
+ }
+ ObservableCollection<TupleList> listsAdicionados = this.ListsAdicionados;
+ if (listsAdicionados != null)
+ {
+ flag = listsAdicionados.Count > 0;
+ }
+ else
+ {
+ flag = false;
+ }
+ if (flag)
+ {
+ ObservableCollection<TupleList> observableCollection = this.ListsAlterados;
+ if (observableCollection != null)
+ {
+ flag2 = observableCollection.Count > 0;
+ }
+ else
+ {
+ flag2 = false;
+ }
+ if (flag2)
+ {
+ str = string.Concat(str, "<br><br><br>");
+ }
+ str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>INCLUSÃO</font>");
+ }
+ if (this.ListsAdicionados != null)
+ {
+ foreach (TupleList listsAdicionado in this.ListsAdicionados)
+ {
+ foreach (Tuple<string, string, string> tuple1 in listsAdicionado.get_Tuples())
+ {
+ if (tuple1 == listsAdicionado.get_Tuples().First<Tuple<string, string, string>>())
+ {
+ str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ bool flag4 = tuple1.Item1.Contains("$");
+ string[] strArrays = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
+ strArrays[2] = (flag4 ? "900" : "700");
+ strArrays[3] = "; padding-left: 5px'>";
+ strArrays[4] = tuple1.Item1.Replace(" ", "&nbsp;").Replace("$", "");
+ strArrays[5] = "</font></td><td style='width: ";
+ strArrays[6] = (this.Mostrar ? "483px" : "240px");
+ strArrays[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
+ strArrays[8] = tuple1.Item2;
+ strArrays[9] = "</font></td>";
+ str = string.Concat(strArrays);
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple1.Item3, "</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ if ((object)listsAdicionado == (object)this.ListsAdicionados.Last<TupleList>())
+ {
+ continue;
+ }
+ str = string.Concat(str, "<br>");
+ }
+ }
+ ObservableCollection<TupleList> listsRemovidos = this.ListsRemovidos;
+ if (listsRemovidos != null)
+ {
+ count1 = listsRemovidos.Count > 0;
+ }
+ else
+ {
+ count1 = false;
+ }
+ if (count1)
+ {
+ ObservableCollection<TupleList> listsAlterados1 = this.ListsAlterados;
+ if (listsAlterados1 != null)
+ {
+ flag1 = listsAlterados1.Count > 0;
+ }
+ else
+ {
+ flag1 = false;
+ }
+ if (!flag1)
+ {
+ ObservableCollection<TupleList> listsAdicionados1 = this.ListsAdicionados;
+ if (listsAdicionados1 != null)
+ {
+ count2 = listsAdicionados1.Count > 0;
+ }
+ else
+ {
+ count2 = false;
+ }
+ if (!count2)
+ {
+ goto Label0;
+ }
+ }
+ str = string.Concat(str, "<br><br><br>");
+ Label0:
+ str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>EXCLUSÃO</font>");
+ }
+ if (this.ListsRemovidos != null)
+ {
+ foreach (TupleList listsRemovido in this.ListsRemovidos)
+ {
+ foreach (Tuple<string, string, string> tuple2 in listsRemovido.get_Tuples())
+ {
+ if (tuple2 == listsRemovido.get_Tuples().First<Tuple<string, string, string>>())
+ {
+ str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ bool flag5 = tuple2.Item1.Contains("$");
+ string[] item21 = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
+ item21[2] = (flag5 ? "900" : "700");
+ item21[3] = "; padding-left: 5px'>";
+ item21[4] = tuple2.Item1.Replace(" ", "&nbsp;").Replace("$", "");
+ item21[5] = "</font></td><td style='width: ";
+ item21[6] = (this.Mostrar ? "483px" : "240px");
+ item21[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
+ item21[8] = tuple2.Item2;
+ item21[9] = "</font></td>";
+ str = string.Concat(item21);
+ if (!this.Mostrar)
+ {
+ str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple2.Item3, "</font></td>");
+ }
+ str = string.Concat(str, "</tr></table>");
+ }
+ if ((object)listsRemovido == (object)this.ListsRemovidos.Last<TupleList>())
+ {
+ continue;
+ }
+ str = string.Concat(str, "<br>");
+ }
+ }
+ str = string.Concat(str, "</div></body></html>");
+ string tempPath = Path.GetTempPath();
+ string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoExtrato)0, Gestor.Application.Helpers.Funcoes.GetNetworkTime());
+ StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8);
+ streamWriter.Write(str);
+ streamWriter.Close();
+ Process.Start(str1);
+ base.RegistrarAcao(string.Format("IMPRIMIU O LOG DE ALTERAÇÕES DE {0} DO ID \"{1}\"", Gestor.Model.Validation.Funcoes.GetDescription(this._tipoTela), this._id), this._id, new TipoTela?(this._tipoTela), string.Format("ID ENTIDADE: {0}\nTIPO: {1}", this._id, Gestor.Model.Validation.Funcoes.GetDescription(this._tipoTela)));
+ }
+
+ private async void LogParcelas(long documento, List<long> parcelas, int numparcela)
+ {
+ base.Loading(true);
+ List<long> nums = new List<long>();
+ nums.AddRange(parcelas);
+ nums.Add(documento);
+ this.Logs = new ObservableCollection<RegistroLog>((IEnumerable<!0>)await this._servico.BuscaLogParcelas(nums));
+ ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
+ List<RegistroLog> list = this.Logs.Where<RegistroLog>((RegistroLog x) => {
+ if (x.get_ModeloNovo())
+ {
+ return false;
+ }
+ return x.get_EntidadeId() == documento;
+ }).ToList<RegistroLog>();
+ for (int i = list.Count - 1; i >= 0; i--)
+ {
+ ObservableCollection<Parcela> observableCollection1 = new ObservableCollection<Parcela>();
+ try
+ {
+ for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--)
+ {
+ Parcela parcela = JsonConvert.DeserializeObject<Parcela>(this.Logs[j].get_Descricao());
+ if (parcela != null && (numparcela == 0 || this.BuscaNumeroParcela(this.Logs[j].get_Descricao()) == numparcela))
+ {
+ observableCollection1.Add(parcela);
+ }
+ i = j;
+ }
+ }
+ catch (Exception exception1)
+ {
+ try
+ {
+ List<Parcela> parcelas1 = JsonConvert.DeserializeObject<List<Parcela>>(this.Logs[i].get_Descricao());
+ if (parcelas1 != null && (numparcela == 0 || this.BuscaNumeroParcela(this.Logs[i].get_Descricao()) == numparcela))
+ {
+ ExtensionMethods.AddRange<Parcela>(observableCollection1, parcelas1);
+ }
+ }
+ catch (Exception exception)
+ {
+ RegistroLog item = this.Logs[i];
+ string descricao = this.Logs[i].get_Descricao();
+ if (descricao == null)
+ {
+ descricao = "";
+ }
+ item.set_Descricao(descricao);
+ observableCollection.Insert(0, this.Logs[i]);
+ goto Label0;
+ }
+ }
+ ObservableCollection<Parcela> observableCollection2 = observableCollection1;
+ observableCollection1 = new ObservableCollection<Parcela>(
+ from x in observableCollection2
+ orderby x.get_NumeroParcela()
+ select x);
+ if (observableCollection1 != null && observableCollection1.Count != 0 && observableCollection1[0].get_Documento() != null)
+ {
+ RegistroLog registroLog = list[i];
+ Parcelas parcela1 = new Parcelas();
+ parcela1.set_ParcelasList(observableCollection1);
+ parcela1.set_TipoRecebimento(observableCollection1[0].get_Documento().get_TipoRecebimento());
+ JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
+ jsonSerializerSetting.set_ReferenceLoopHandling(1);
+ registroLog.set_Descricao(JsonConvert.SerializeObject(parcela1, jsonSerializerSetting));
+ observableCollection.Insert(0, list[i]);
+ }
+ Label0:
+ }
+ List<RegistroLog> registroLogs = new List<RegistroLog>();
+ ObservableCollection<RegistroLog> logs = this.Logs;
+ List<RegistroLog> list1 = (
+ from x in logs
+ where x.get_ModeloNovo()
+ select x).ToList<RegistroLog>();
+ if (numparcela != 0)
+ {
+ foreach (RegistroLog registroLog1 in list1)
+ {
+ int num = this.BuscaNumeroParcela(registroLog1.get_Descricao());
+ if ((num == 0 || num != numparcela) && (numparcela == 0 || parcelas.Count != 1 || registroLog1.get_EntidadeId() == documento))
+ {
+ continue;
+ }
+ registroLogs.Add(registroLog1);
+ }
+ }
+ else
+ {
+ registroLogs.AddRange(list1);
+ }
+ this.Logs = observableCollection;
+ ExtensionMethods.AddRange<RegistroLog>(this.Logs, registroLogs);
+ if (this.Logs.Count <= 0)
+ {
+ this.SetListaFiltrada(this.Lists);
+ }
+ else
+ {
+ this.SelectedLog = this.Logs[0];
+ }
+ base.Loading(false);
+ }
+
+ public void MostrarCampos()
+ {
+ if (this.SelectedLog == null || this.SelectedLog.get_ModeloNovo())
+ {
+ return;
+ }
+ this.Mostrar = !this.Mostrar;
+ this.Lists = this.Lists;
+ }
+
+ private static int QntEspaco(string str)
+ {
+ return Regex.Match(str, "[^\\s]").Index;
+ }
+
+ private async void Seleciona(TipoTela tela, long id, List<long> parcelas = null, long? parcela = null)
+ {
+ base.Loading(true);
+ this.Logs = new ObservableCollection<RegistroLog>((IEnumerable<!0>)await this._servico.FindByEntityId(tela, id));
+ if (tela == 37)
+ {
+ ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
+ ObservableCollection<RegistroLog> logs = this.Logs;
+ List<RegistroLog> list = (
+ from x in logs
+ where !x.get_ModeloNovo()
+ select x).ToList<RegistroLog>();
+ for (int i = list.Count - 1; i >= 0; i--)
+ {
+ ObservableCollection<VendedorParcela> observableCollection1 = new ObservableCollection<VendedorParcela>();
+ for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--)
+ {
+ observableCollection1.Add(JsonConvert.DeserializeObject<VendedorParcela>(list[j].get_Descricao()));
+ i = j;
+ }
+ ObservableCollection<VendedorParcela> observableCollection2 = observableCollection1;
+ observableCollection1 = new ObservableCollection<VendedorParcela>(
+ from x in observableCollection2
+ orderby x.get_Id()
+ select x);
+ RegistroLog item = list[i];
+ VendedorParcelas vendedorParcela = new VendedorParcelas();
+ vendedorParcela.set_VendedorParcelasList(observableCollection1);
+ JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
+ jsonSerializerSetting.set_ReferenceLoopHandling(1);
+ item.set_Descricao(JsonConvert.SerializeObject(vendedorParcela, jsonSerializerSetting));
+ observableCollection.Insert(0, list[i]);
+ }
+ ObservableCollection<RegistroLog> logs1 = this.Logs;
+ List<RegistroLog> registroLogs = (
+ from x in logs1
+ where x.get_ModeloNovo()
+ select x).ToList<RegistroLog>();
+ this.Logs = observableCollection;
+ ExtensionMethods.AddRange<RegistroLog>(this.Logs, registroLogs);
+ }
+ if (this.Logs.Count <= 0)
+ {
+ this.SetListaFiltrada(this.Lists);
+ }
+ else
+ {
+ this.SelectedLog = this.Logs[0];
+ }
+ base.Loading(false);
+ }
+
+ public void SetListaFiltrada(List<TupleList> listAtual)
+ {
+ List<TupleList> tupleLists;
+ ObservableCollection<Tuple<string, string, string>> observableCollection;
+ List<TupleList>.Enumerator enumerator;
+ ObservableCollection<TupleList> observableCollection1;
+ ObservableCollection<TupleList> observableCollection2;
+ ObservableCollection<TupleList> observableCollection3;
+ if (this.Logs.Count == 0)
+ {
+ this.ListsAlterados = null;
+ this.ListsAdicionados = null;
+ this.ListsRemovidos = null;
+ return;
+ }
+ if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == 1)
+ {
+ this.TextAdicoes = "ALTERAÇÕES";
+ this.ListsAdicionados = null;
+ this.ListsRemovidos = null;
+ this.ListsAlterados = new ObservableCollection<TupleList>(this.Lists);
+ this.MostrarMensagem = false;
+ return;
+ }
+ if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == null)
+ {
+ this.TextAdicoes = "INCLUSÕES";
+ this.ListsAlterados = null;
+ this.ListsRemovidos = null;
+ this.ListsAdicionados = new ObservableCollection<TupleList>(listAtual);
+ this.MostrarMensagem = false;
+ return;
+ }
+ if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == 2)
+ {
+ this.TextAdicoes = "EXCLUSÕES";
+ this.ListsAlterados = null;
+ this.ListsAdicionados = null;
+ this.ListsRemovidos = new ObservableCollection<TupleList>(listAtual);
+ this.MostrarMensagem = false;
+ return;
+ }
+ if (this.Mostrar || (object)this.Logs.Last<RegistroLog>() == (object)this.SelectedLog)
+ {
+ this.TextAdicoes = ((object)this.Logs.Last<RegistroLog>() != (object)this.SelectedLog ? "LOG COMPLETO" : "INCLUSÃO");
+ this.ListsAlterados = null;
+ this.ListsAdicionados = new ObservableCollection<TupleList>(listAtual);
+ this.ListsRemovidos = null;
+ return;
+ }
+ this.TextAdicoes = "INCLUSÃO";
+ List<TupleList> tupleLists1 = new List<TupleList>();
+ try
+ {
+ switch (this._tipoTela)
+ {
+ case 1:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Cliente>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 2:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Documento>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14));
+ goto case 53;
+ }
+ case 3:
+ {
+ Item item = JsonConvert.DeserializeObject<Item>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
+ if (item.get_Aeronautico() != null)
+ {
+ tupleLists1 = Aeronautico.Log(item);
+ goto case 53;
+ }
+ else if (item.get_Auto() != null)
+ {
+ tupleLists1 = Auto.Log(item);
+ goto case 53;
+ }
+ else if (item.get_Granizo() != null)
+ {
+ tupleLists1 = Granizo.Log(item);
+ goto case 53;
+ }
+ else if (item.get_Patrimonial() != null)
+ {
+ tupleLists1 = Patrimonial.Log(item);
+ goto case 53;
+ }
+ else if (item.get_RiscosDiversos() == null)
+ {
+ if (item.get_Vida() == null)
+ {
+ goto case 53;
+ }
+ tupleLists1 = Vida.Log(item);
+ goto case 53;
+ }
+ else
+ {
+ tupleLists1 = RiscosDiversos.Log(item);
+ goto case 53;
+ }
+ }
+ case 4:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Trilha>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 5:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Parcelas>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14), base.Restricao(95));
+ goto case 53;
+ }
+ case 6:
+ case 8:
+ case 20:
+ case 21:
+ case 23:
+ case 25:
+ case 27:
+ case 32:
+ case 35:
+ case 39:
+ case 40:
+ case 44:
+ case 47:
+ case 49:
+ case 50:
+ case 51:
+ case 53:
+ {
+ break;
+ }
+ case 7:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Sinistro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 9:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Estipulante>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 10:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Produto>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 11:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Status>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 12:
+ {
+ Ramo ramo = JsonConvert.DeserializeObject<Ramo>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
+ List<CoberturaPadrao> list = (
+ from x in Recursos.Coberturas
+ where x.get_IdRamo() == ramo.get_Id()
+ orderby x.get_Padrao() descending, x.get_Descricao()
+ select x).ToList<CoberturaPadrao>();
+ tupleLists1 = ramo.Log(list);
+ goto case 53;
+ }
+ case 13:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Seguradora>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 14:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TipoVendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 15:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Vendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 16:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Usuario>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 17:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Credencial>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 18:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Empresa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 19:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Socio>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 22:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Parceiro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 24:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Fornecedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 26:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<BancosContas>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 28:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Planos>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 29:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Centro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 30:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<MetaVendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 31:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<MetaSeguradora>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 33:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Prospeccao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 34:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Agenda>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 36:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Adiantamento>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 37:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<VendedorParcelas>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14), base.Restricao(95));
+ goto case 53;
+ }
+ case 38:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Tarefa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 41:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TrocaCliente>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 42:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Recibo>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 43:
+ {
+ List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> tuples = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
+ tupleLists = new List<TupleList>();
+ foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> tuple in tuples)
+ {
+ observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>(string.Concat(tuple.Item1, "$"), "", "")
+ };
+ foreach (Tuple<string, List<Tuple<string, string>>> item2 in tuple.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item2.Item1, "$"), "", ""));
+ foreach (Tuple<string, string> item21 in item2.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item21.Item1), item21.Item2, ""));
+ }
+ }
+ TupleList tupleList = new TupleList();
+ tupleList.set_Tuples(observableCollection);
+ tupleLists.Add(tupleList);
+ }
+ enumerator = tupleLists.GetEnumerator();
+ try
+ {
+ while (enumerator.MoveNext())
+ {
+ tupleLists1.Add(enumerator.Current);
+ }
+ goto case 53;
+ }
+ finally
+ {
+ ((IDisposable)enumerator).Dispose();
+ }
+ break;
+ }
+ case 45:
+ {
+ List<Vendedor> vendedors = JsonConvert.DeserializeObject<List<Vendedor>>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
+ tupleLists = new List<TupleList>();
+ observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
+ };
+ foreach (Vendedor vendedor in vendedors)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Format(" VENDEDOR {0}", vendedors.IndexOf(vendedor) + 1), vendedor.get_Nome(), ""));
+ }
+ TupleList tupleList1 = new TupleList();
+ tupleList1.set_Tuples(observableCollection);
+ tupleLists.Add(tupleList1);
+ enumerator = tupleLists.GetEnumerator();
+ try
+ {
+ while (enumerator.MoveNext())
+ {
+ tupleLists1.Add(enumerator.Current);
+ }
+ goto case 53;
+ }
+ finally
+ {
+ ((IDisposable)enumerator).Dispose();
+ }
+ break;
+ }
+ case 46:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Expedicao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 48:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Qualificacao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 52:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<TipoDeTarefa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 54:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Repasse>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 55:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<NotaFiscal>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ case 56:
+ {
+ tupleLists1 = JsonConvert.DeserializeObject<Imposto>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
+ goto case 53;
+ }
+ default:
+ {
+ goto case 53;
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ }
+ ObservableCollection<TupleList> observableCollection4 = new ObservableCollection<TupleList>();
+ foreach (TupleList tupleList2 in listAtual)
+ {
+ int num = -1;
+ if (tupleLists1.Count - 1 < listAtual.IndexOf(tupleList2))
+ {
+ continue;
+ }
+ for (int i = 0; i < tupleList2.get_Tuples().Count; i++)
+ {
+ Tuple<string, string, string> item1 = tupleList2.get_Tuples()[i];
+ if (LogViewModel.QntEspaco(item1.Item1) != 0)
+ {
+ List<string> strs = new List<string>();
+ int num1 = LogViewModel.QntEspaco(item1.Item1);
+ for (int j = i; j >= 0; j--)
+ {
+ if (LogViewModel.QntEspaco(tupleList2.get_Tuples()[j].Item1) <= num1)
+ {
+ strs.Insert(0, tupleList2.get_Tuples()[j].Item1);
+ num1 = LogViewModel.QntEspaco(tupleList2.get_Tuples()[j].Item1);
+ }
+ }
+ bool flag = false;
+ int num2 = 0;
+ Label2:
+ foreach (string str in strs)
+ {
+ if (!flag)
+ {
+ int num3 = num2;
+ while (num3 < tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples().Count)
+ {
+ if (num3 == tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples().Count - 1 && str != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num3].Item1)
+ {
+ flag = true;
+ goto Label2;
+ }
+ else if (str != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num3].Item1)
+ {
+ num3++;
+ }
+ else
+ {
+ num2 = num3;
+ goto Label2;
+ }
+ }
+ }
+ else
+ {
+ goto Label1;
+ }
+ }
+ Label1:
+ if (!flag && item1.Item2 != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num2].Item2)
+ {
+ if (num < listAtual.IndexOf(tupleList2))
+ {
+ TupleList tupleList3 = new TupleList();
+ tupleList3.set_Tuples(new ObservableCollection<Tuple<string, string, string>>());
+ observableCollection4.Add(tupleList3);
+ num = listAtual.IndexOf(tupleList2);
+ }
+ int count = observableCollection4.Last<TupleList>().get_Tuples().Count;
+ int num4 = LogViewModel.QntEspaco(item1.Item1);
+ for (int k = i - 1; k >= 0; k--)
+ {
+ if (LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1) < LogViewModel.QntEspaco(item1.Item1) && LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1) < num4)
+ {
+ bool flag1 = false;
+ int count1 = observableCollection4.Last<TupleList>().get_Tuples().Count - 1;
+ while (count1 >= 0)
+ {
+ if (observableCollection4.Last<TupleList>().get_Tuples()[count1].Item1 != tupleList2.get_Tuples()[k].Item1)
+ {
+ count1--;
+ }
+ else
+ {
+ flag1 = true;
+ break;
+ }
+ }
+ if (flag1)
+ {
+ break;
+ }
+ num4 = LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1);
+ observableCollection4.Last<TupleList>().get_Tuples().Insert(count, new Tuple<string, string, string>(tupleList2.get_Tuples()[k].Item1, tupleList2.get_Tuples()[k].Item2, ""));
+ }
+ }
+ observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(item1.Item1, item1.Item2, tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num2].Item2));
+ }
+ }
+ else if (item1.Item2 != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[tupleList2.get_Tuples().IndexOf(item1)].Item2)
+ {
+ if (num < listAtual.IndexOf(tupleList2))
+ {
+ TupleList tupleList4 = new TupleList();
+ tupleList4.set_Tuples(new ObservableCollection<Tuple<string, string, string>>());
+ observableCollection4.Add(tupleList4);
+ num = listAtual.IndexOf(tupleList2);
+ }
+ observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(item1.Item1, item1.Item2, tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[tupleList2.get_Tuples().IndexOf(item1)].Item2));
+ }
+ }
+ }
+ if (observableCollection4.Count == 0)
+ {
+ observableCollection1 = null;
+ }
+ else
+ {
+ observableCollection1 = observableCollection4;
+ }
+ this.ListsAlterados = observableCollection1;
+ observableCollection4 = new ObservableCollection<TupleList>();
+ foreach (TupleList tupleList5 in listAtual)
+ {
+ int num5 = -1;
+ if (tupleLists1.Count - 1 < listAtual.IndexOf(tupleList5))
+ {
+ continue;
+ }
+ for (int l = 0; l < tupleList5.get_Tuples().Count; l++)
+ {
+ Tuple<string, string, string> tuple1 = tupleList5.get_Tuples()[l];
+ if (LogViewModel.QntEspaco(tuple1.Item1) > 0)
+ {
+ List<string> strs1 = new List<string>();
+ int num6 = LogViewModel.QntEspaco(tuple1.Item1);
+ for (int m = l; m >= 0; m--)
+ {
+ if (LogViewModel.QntEspaco(tupleList5.get_Tuples()[m].Item1) <= num6)
+ {
+ strs1.Insert(0, tupleList5.get_Tuples()[m].Item1);
+ num6 = LogViewModel.QntEspaco(tupleList5.get_Tuples()[m].Item1);
+ }
+ }
+ bool flag2 = false;
+ int num7 = 0;
+ Label4:
+ foreach (string str1 in strs1)
+ {
+ if (!flag2)
+ {
+ int num8 = num7;
+ while (num8 < tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples().Count)
+ {
+ if (num8 == tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples().Count - 1 && str1 != tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples()[num8].Item1)
+ {
+ flag2 = true;
+ goto Label4;
+ }
+ else if (str1 != tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples()[num8].Item1)
+ {
+ num8++;
+ }
+ else
+ {
+ num7 = num8;
+ goto Label4;
+ }
+ }
+ }
+ else
+ {
+ goto Label3;
+ }
+ }
+ Label3:
+ if (flag2)
+ {
+ if (num5 < listAtual.IndexOf(tupleList5))
+ {
+ TupleList tupleList6 = new TupleList();
+ tupleList6.set_Tuples(new ObservableCollection<Tuple<string, string, string>>());
+ observableCollection4.Add(tupleList6);
+ num5 = listAtual.IndexOf(tupleList5);
+ }
+ int count2 = observableCollection4.Last<TupleList>().get_Tuples().Count;
+ int num9 = LogViewModel.QntEspaco(tuple1.Item1);
+ for (int n = l - 1; n >= 0; n--)
+ {
+ if (LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1) < LogViewModel.QntEspaco(tuple1.Item1) && LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1) < num9)
+ {
+ bool flag3 = false;
+ int count3 = observableCollection4.Last<TupleList>().get_Tuples().Count - 1;
+ while (count3 >= 0)
+ {
+ if (observableCollection4.Last<TupleList>().get_Tuples()[count3].Item1 != tupleList5.get_Tuples()[n].Item1)
+ {
+ count3--;
+ }
+ else
+ {
+ flag3 = true;
+ break;
+ }
+ }
+ if (flag3)
+ {
+ break;
+ }
+ num9 = LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1);
+ observableCollection4.Last<TupleList>().get_Tuples().Insert(count2, new Tuple<string, string, string>(tupleList5.get_Tuples()[n].Item1, tupleList5.get_Tuples()[n].Item2, ""));
+ }
+ }
+ observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(tuple1.Item1, tuple1.Item2, ""));
+ }
+ }
+ }
+ }
+ if (observableCollection4.Count == 0)
+ {
+ observableCollection2 = null;
+ }
+ else
+ {
+ observableCollection2 = observableCollection4;
+ }
+ this.ListsAdicionados = observableCollection2;
+ observableCollection4 = new ObservableCollection<TupleList>();
+ foreach (TupleList tupleList7 in tupleLists1)
+ {
+ int num10 = -1;
+ for (int o = 0; o < tupleList7.get_Tuples().Count; o++)
+ {
+ Tuple<string, string, string> tuple2 = tupleList7.get_Tuples()[o];
+ if (LogViewModel.QntEspaco(tuple2.Item1) > 0)
+ {
+ List<string> strs2 = new List<string>();
+ int num11 = LogViewModel.QntEspaco(tuple2.Item1);
+ for (int p = o; p >= 0; p--)
+ {
+ if (LogViewModel.QntEspaco(tupleList7.get_Tuples()[p].Item1) <= num11)
+ {
+ strs2.Insert(0, tupleList7.get_Tuples()[p].Item1);
+ num11 = LogViewModel.QntEspaco(tupleList7.get_Tuples()[p].Item1);
+ }
+ }
+ bool flag4 = false;
+ int num12 = 0;
+ Label6:
+ foreach (string str2 in strs2)
+ {
+ if (!flag4)
+ {
+ if (listAtual.Count - 1 < tupleLists1.IndexOf(tupleList7))
+ {
+ continue;
+ }
+ int num13 = num12;
+ while (num13 < listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples().Count)
+ {
+ if (num13 == listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples().Count - 1 && str2 != listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples()[num13].Item1)
+ {
+ flag4 = true;
+ goto Label6;
+ }
+ else if (str2 != listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples()[num13].Item1)
+ {
+ num13++;
+ }
+ else
+ {
+ num12 = num13;
+ goto Label6;
+ }
+ }
+ }
+ else
+ {
+ goto Label5;
+ }
+ }
+ Label5:
+ if (flag4)
+ {
+ if (num10 < tupleLists1.IndexOf(tupleList7))
+ {
+ TupleList tupleList8 = new TupleList();
+ tupleList8.set_Tuples(new ObservableCollection<Tuple<string, string, string>>());
+ observableCollection4.Add(tupleList8);
+ num10 = tupleLists1.IndexOf(tupleList7);
+ }
+ int count4 = observableCollection4.Last<TupleList>().get_Tuples().Count;
+ int num14 = LogViewModel.QntEspaco(tuple2.Item1);
+ for (int q = o - 1; q >= 0; q--)
+ {
+ if (LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1) < LogViewModel.QntEspaco(tuple2.Item1) && LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1) < num14)
+ {
+ bool flag5 = false;
+ int count5 = observableCollection4.Last<TupleList>().get_Tuples().Count - 1;
+ while (count5 >= 0)
+ {
+ if (observableCollection4.Last<TupleList>().get_Tuples()[count5].Item1 != tupleList7.get_Tuples()[q].Item1)
+ {
+ count5--;
+ }
+ else
+ {
+ flag5 = true;
+ break;
+ }
+ }
+ if (flag5)
+ {
+ break;
+ }
+ num14 = LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1);
+ observableCollection4.Last<TupleList>().get_Tuples().Insert(count4, new Tuple<string, string, string>(tupleList7.get_Tuples()[q].Item1, tupleList7.get_Tuples()[q].Item2, ""));
+ }
+ }
+ observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(tuple2.Item1, "", tuple2.Item2));
+ }
+ }
+ }
+ }
+ if (observableCollection4.Count == 0)
+ {
+ observableCollection3 = null;
+ }
+ else
+ {
+ observableCollection3 = observableCollection4;
+ }
+ this.ListsRemovidos = observableCollection3;
+ }
+ }
+} \ No newline at end of file