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 --- .../ViewModels/AnaliticoViewModel.cs | 210 --------------------- 1 file changed, 210 deletions(-) delete mode 100644 Gestor.Application/ViewModels/AnaliticoViewModel.cs (limited to 'Gestor.Application/ViewModels/AnaliticoViewModel.cs') diff --git a/Gestor.Application/ViewModels/AnaliticoViewModel.cs b/Gestor.Application/ViewModels/AnaliticoViewModel.cs deleted file mode 100644 index bdf394b..0000000 --- a/Gestor.Application/ViewModels/AnaliticoViewModel.cs +++ /dev/null @@ -1,210 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.Servicos.Generic; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.BI; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Relatorios; -using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; - -namespace Gestor.Application.ViewModels -{ - internal class AnaliticoViewModel : BaseSegurosViewModel - { - private string _head; - - public string Head - { - get - { - return this._head; - } - set - { - this._head = value; - base.OnPropertyChanged("Head"); - } - } - - public TipoTela Tela { get; set; } = 1; - - public string Tipo - { - get; - set; - } - - public AnaliticoViewModel(string tipo) - { - this.Tipo = tipo; - string str = this.Tipo; - if (str == "PARCELAS") - { - this.Tela = 5; - return; - } - if (str != "APOLICES") - { - this.Tela = 1; - return; - } - this.Tela = 2; - } - - private async Task GerarHtml(DataGrid grid) - { - PropertyInfo[] properties = typeof(Analitico).GetProperties(); - List list = ( - from x in (IEnumerable)properties - select x.Name).ToList(); - List strs = new List(); - for (int i = 0; i < grid.Columns.Count; i++) - { - if (!(grid.Columns[i] is DataGridTemplateColumn)) - { - Binding binding = (grid.Columns[i] as DataGridBoundColumn).Binding as Binding; - strs.Add(binding.Path.Path); - } - } - List list1 = list.Except(strs).ToList(); - IEnumerable analiticos = grid.Items.Cast(); - string str = await Funcoes.GenerateTable(( - from x in analiticos - where x.get_Selecionado() - select x).ToList(), list1, false, true, "", null); - string str1 = Funcoes.CreateCard("", str, false); - TipoRelatorio tipoRelatorio = new TipoRelatorio(); - tipoRelatorio.set_Nome(string.Concat("ANALÍTICO - ", this.Head)); - string str2 = str1; - if (str2 == null) - { - str2 = ""; - } - string str3 = Funcoes.ExportarHtml(tipoRelatorio, str2, "60", "landscape", false, ""); - return str3; - } - - public async Task Print(DataGrid grid) - { - IEnumerable analiticos = grid.Items.Cast(); - if (analiticos.Any((Analitico x) => x.get_Selecionado())) - { - string str = await this.GerarHtml(grid); - if (!string.IsNullOrEmpty(str)) - { - string tempPath = Path.GetTempPath(); - string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (new Regex(string.Concat("[", Regex.Escape(string.Concat(new string(Path.GetInvalidFileNameChars()), new string(Path.GetInvalidPathChars()))), "]"))).Replace(this.Head, ""), Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8); - streamWriter.Write(str); - streamWriter.Close(); - Process.Start(str1); - } - } - else - { - await base.ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM DOCUMENTO", "OK", "", false); - } - } - - public async Task Salvar(Trilha destino) - { - Trilha trilha; - List fases = destino.get_Fases(); - TarefaServico tarefaServico = new TarefaServico(); - Trilha trilha1 = await tarefaServico.Salvar(destino); - if (tarefaServico.Sucesso) - { - fases.ForEach((Fase x) => x.set_Trilha(trilha1)); - fases = await tarefaServico.Salvar(fases); - if (tarefaServico.Sucesso) - { - trilha1.set_Fases(fases); - trilha = trilha1; - } - else - { - trilha = null; - } - } - else - { - trilha = null; - } - fases = null; - tarefaServico = null; - return trilha; - } - - public async Task Save(List tarefas) - { - await (new TarefaServico()).Salvar(tarefas); - } - - public async Task> Validar(List analitico, Trilha trilha) - { - List list; - List analiticos; - TarefaServico tarefaServico = new TarefaServico(); - string tipo = this.Tipo; - if (tipo == "CLIENTES") - { - List analiticos1 = analitico; - list = ( - from x in analiticos1 - select x.get_Cliente().get_Id()).ToList(); - } - else if (tipo == "PARCELAS" || tipo == "COMISSÃO") - { - List analiticos2 = analitico; - list = ( - from x in analiticos2 - select x.get_Parcela().get_Id()).ToList(); - } - else - { - List analiticos3 = analitico; - list = ( - from x in analiticos3 - select x.get_Documento().get_Id()).ToList(); - } - List nums = await tarefaServico.Validar(list, trilha.get_Id()); - List nums1 = nums; - tipo = this.Head; - if (tipo == "CLIENTES") - { - analiticos = ( - from x in analitico - where nums1.Contains(x.get_Cliente().get_Id()) - select x).ToList(); - } - else - { - analiticos = (tipo == "PARCELAS" || tipo == "COMISSÃO" ? ( - from x in analitico - where nums1.Contains(x.get_Parcela().get_Id()) - select x).ToList() : ( - from x in analitico - where nums1.Contains(x.get_Documento().get_Id()) - select x).ToList()); - } - List list1 = analitico.Except(analiticos).ToList(); - return list1; - } - } -} \ No newline at end of file -- cgit v1.2.3