summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs112
1 files changed, 0 insertions, 112 deletions
diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
deleted file mode 100644
index fe46bb4..0000000
--- a/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Model.Ajuda;
-using Gestor.Application.Servicos.Ajuda;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.License;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Drawer.Ajuda
-{
- public class ContratosViewModel : BaseViewModel
- {
- private readonly AjudaServico _ajudaServico;
-
- private bool _carregando;
-
- private List<Licenca> _contratos;
-
- private Licenca _selectedContrato;
-
- public bool Carregando
- {
- get
- {
- return this._carregando;
- }
- set
- {
- this._carregando = value;
- base.IsEnabled = !value;
- base.EnableMenu = !value;
- base.OnPropertyChanged("Carregando");
- }
- }
-
- public List<Licenca> Contratos
- {
- get
- {
- return this._contratos;
- }
- set
- {
- this._contratos = value;
- base.OnPropertyChanged("Contratos");
- }
- }
-
- public Licenca SelectedContrato
- {
- get
- {
- return this._selectedContrato;
- }
- set
- {
- this._selectedContrato = value;
- this.WorkOnSelectedContrato(value);
- base.OnPropertyChanged("SelectedContrato");
- }
- }
-
- public ContratosViewModel()
- {
- this._ajudaServico = new AjudaServico();
- this.Contratos = LicenseHelper.Produtos;
- }
-
- internal async void WorkOnSelectedContrato(Licenca value)
- {
- Contrato contrato = await this._ajudaServico.BuscarContrato(value.get_Produto());
- if (!string.IsNullOrEmpty(contrato.HtmlContrato) || contrato.IdModulo != (long)7)
- {
- if (string.IsNullOrEmpty(contrato.HtmlContrato) && contrato.IdModulo != (long)7)
- {
- contrato = await this._ajudaServico.BuscarContrato(1);
- }
- string empty = string.Empty;
- LicenseHelper.Produtos.ForEach((Licenca x) => empty = string.Concat(empty, (string.IsNullOrEmpty(empty) ? ValidationHelper.GetDescription(x.get_Produto()) : string.Concat("/ ", ValidationHelper.GetDescription(x.get_Produto())))));
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;NOME&gt;]", Recursos.Empresa.get_Nome());
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;ENDERECO&gt;]", Recursos.Empresa.get_Endereco());
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;CIDADE&gt;]", Recursos.Empresa.get_Cidade());
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;CNPJ&gt;]", Recursos.Empresa.get_Documento());
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;NS&gt;]", Recursos.Empresa.get_Serial());
- string htmlContrato = contrato.HtmlContrato;
- DateTime date = Funcoes.GetNetworkTime().Date;
- contrato.HtmlContrato = htmlContrato.Replace("[&lt;DATA&gt;]", date.ToString("dd/MM/yyyy"));
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;VALOR&gt;]", "Conforme Mensalidade");
- contrato.HtmlContrato = contrato.HtmlContrato.Replace("[&lt;OUTROS&gt;]", empty.Replace("*", ""));
- string tempPath = Path.GetTempPath();
- string str = 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(ValidationHelper.GetDescription(value.get_Produto()), ""), Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str, true, Encoding.UTF8);
- streamWriter.Write(contrato.HtmlContrato);
- streamWriter.Close();
- Process.Start(str);
- }
- else
- {
- Process.Start(string.Format("https://aggilizador.com.br/Contrato.aspx?id={0}", ApplicationHelper.IdFornecedor));
- }
- }
- }
-} \ No newline at end of file