summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Drawer/Ajuda
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
commit674ca83ba9243a9e95a7568c797668dab6aee26a (patch)
tree4a905b3fb1d827665a34d63f67bc5559f8e7235b /Gestor.Application/ViewModels/Drawer/Ajuda
downloadgestor-674ca83ba9243a9e95a7568c797668dab6aee26a.tar.gz
gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.zip
feat: upload files
Diffstat (limited to 'Gestor.Application/ViewModels/Drawer/Ajuda')
-rw-r--r--Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs514
-rw-r--r--Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs122
-rw-r--r--Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs112
-rw-r--r--Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs281
4 files changed, 1029 insertions, 0 deletions
diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs
new file mode 100644
index 0000000..6adad6a
--- /dev/null
+++ b/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs
@@ -0,0 +1,514 @@
+using Gestor.Application.Helpers;
+using Gestor.Application.Model.Ajuda;
+using Gestor.Application.Servicos.Ajuda;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.API;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Gestor.Application.ViewModels.Drawer.Ajuda
+{
+ public class AtendimentosViewModel : BaseViewModel
+ {
+ private readonly AjudaServico _ajudaServico;
+
+ private List<string> _status;
+
+ private string _webbody;
+
+ private Visibility _envioEmailVisibility = Visibility.Collapsed;
+
+ private Visibility _atendimentoVisibility;
+
+ private ObservableCollection<Atendimento> _atendimentos;
+
+ private Atendimento _selectedAtendimento;
+
+ private string _nome;
+
+ private string _ddd;
+
+ private string _telefone;
+
+ private string _email;
+
+ private string _assunto;
+
+ private string _idacesso;
+
+ private string _corpo;
+
+ private string _senhaacesso;
+
+ private ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> _arquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
+
+ private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital();
+
+ private string _head;
+
+ public ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> ArquivosAnexados
+ {
+ get
+ {
+ return this._arquivosAnexados;
+ }
+ set
+ {
+ this._arquivosAnexados = value;
+ base.OnPropertyChanged("ArquivosAnexados");
+ }
+ }
+
+ public string Assunto
+ {
+ get
+ {
+ return this._assunto;
+ }
+ set
+ {
+ this._assunto = value;
+ base.OnPropertyChanged("Assunto");
+ }
+ }
+
+ public ObservableCollection<Atendimento> Atendimentos
+ {
+ get
+ {
+ return this._atendimentos;
+ }
+ set
+ {
+ this._atendimentos = value;
+ base.OnPropertyChanged("Atendimentos");
+ }
+ }
+
+ public Visibility AtendimentoVisibility
+ {
+ get
+ {
+ return this._atendimentoVisibility;
+ }
+ set
+ {
+ this._atendimentoVisibility = value;
+ base.OnPropertyChanged("AtendimentoVisibility");
+ }
+ }
+
+ public string Corpo
+ {
+ get
+ {
+ return this._corpo;
+ }
+ set
+ {
+ this._corpo = value;
+ base.OnPropertyChanged("Corpo");
+ }
+ }
+
+ public string Ddd
+ {
+ get
+ {
+ return this._ddd;
+ }
+ set
+ {
+ this._ddd = value;
+ base.OnPropertyChanged("Ddd");
+ }
+ }
+
+ public string Email
+ {
+ get
+ {
+ return this._email;
+ }
+ set
+ {
+ this._email = value;
+ base.OnPropertyChanged("Email");
+ }
+ }
+
+ public Visibility EnvioEmailVisibility
+ {
+ get
+ {
+ return this._envioEmailVisibility;
+ }
+ set
+ {
+ this._envioEmailVisibility = value;
+ base.OnPropertyChanged("EnvioEmailVisibility");
+ }
+ }
+
+ public string Head
+ {
+ get
+ {
+ return this._head;
+ }
+ set
+ {
+ this._head = value;
+ base.OnPropertyChanged("Head");
+ }
+ }
+
+ public Gestor.Model.API.HorarioAtendimento HorarioAtendimento
+ {
+ get;
+ set;
+ }
+
+ public string IdAcesso
+ {
+ get
+ {
+ return this._idacesso;
+ }
+ set
+ {
+ this._idacesso = value;
+ base.OnPropertyChanged("IdAcesso");
+ }
+ }
+
+ public string Nome
+ {
+ get
+ {
+ return this._nome;
+ }
+ set
+ {
+ this._nome = value;
+ base.OnPropertyChanged("Nome");
+ }
+ }
+
+ public Gestor.Model.Domain.Common.ArquivoDigital SelectedAnexado
+ {
+ get
+ {
+ return this._selectedAnexado;
+ }
+ set
+ {
+ this._selectedAnexado = value;
+ base.OnPropertyChanged("SelectedAnexado");
+ }
+ }
+
+ public Atendimento SelectedAtendimento
+ {
+ get
+ {
+ return this._selectedAtendimento;
+ }
+ set
+ {
+ this._selectedAtendimento = value;
+ this.WorkOnSelectedAtendimento(value);
+ base.OnPropertyChanged("SelectedAtendimento");
+ }
+ }
+
+ public string SenhaAcesso
+ {
+ get
+ {
+ return this._senhaacesso;
+ }
+ set
+ {
+ this._senhaacesso = value;
+ base.OnPropertyChanged("SenhaAcesso");
+ }
+ }
+
+ public List<string> Status
+ {
+ get
+ {
+ return this._status;
+ }
+ set
+ {
+ this._status = value;
+ base.OnPropertyChanged("Status");
+ }
+ }
+
+ public string Telefone
+ {
+ get
+ {
+ return this._telefone;
+ }
+ set
+ {
+ this._telefone = value;
+ base.OnPropertyChanged("Telefone");
+ }
+ }
+
+ public string WebBody
+ {
+ get
+ {
+ string str = this._webbody;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._webbody = value;
+ base.OnPropertyChanged("WebBody");
+ }
+ }
+
+ public AtendimentosViewModel()
+ {
+ base.EnableButtons = true;
+ this._ajudaServico = new AjudaServico();
+ this.LoadCombo();
+ this.InitialLoad();
+ }
+
+ public async void Anexar()
+ {
+ List<Gestor.Model.Domain.Common.ArquivoDigital> arquivoDigitals = await base.AddAttachments(new List<Gestor.Model.Domain.Common.ArquivoDigital>(), new List<Gestor.Model.Domain.Common.ArquivoDigital>());
+ if (arquivoDigitals != null)
+ {
+ arquivoDigitals.AddRange(this.ArquivosAnexados);
+ this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(arquivoDigitals);
+ }
+ }
+
+ public void Delete(Gestor.Model.Domain.Common.ArquivoDigital arquivo)
+ {
+ if (this.SelectedAnexado == null)
+ {
+ return;
+ }
+ Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = this.ArquivosAnexados.First<Gestor.Model.Domain.Common.ArquivoDigital>((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao());
+ this.ArquivosAnexados.Remove(arquivoDigital);
+ this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(this.ArquivosAnexados);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Enviar()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs;
+ object obj;
+ try
+ {
+ List<KeyValuePair<string, string>> keyValuePairs1 = this.Validate();
+ if (keyValuePairs1.Count <= 0)
+ {
+ CustomerData customerDatum = new CustomerData();
+ customerDatum.set_Corretora(Recursos.Empresa.get_Nome());
+ customerDatum.set_Name(this.Nome);
+ customerDatum.set_AreaCode(this.Ddd);
+ customerDatum.set_Number(this.Telefone);
+ customerDatum.set_Email(this.Email);
+ CustomerData customerDatum1 = customerDatum;
+ object[] corpo = new object[] { this.Corpo, this.IdAcesso, this.SenhaAcesso, ApplicationHelper.Versao, Recursos.Usuario.get_Id(), Recursos.Usuario.get_Login(), JsonConvert.SerializeObject(customerDatum1) };
+ string str = string.Format("{0}<hr><p><b>ID Acesso:</b> {1}<br><b>Senha Acesso:</b> {2}</p><p>VERSÃO DO SISTEMA: {3}<br />USUÁRIO SISTEMA:{4} {5}</p><p>{6}</p>", corpo);
+ CustomerAttendance customerAttendance = new CustomerAttendance();
+ customerAttendance.set_CustomerData(customerDatum1);
+ customerAttendance.set_Subject(this.Assunto);
+ customerAttendance.set_Body(str);
+ ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> arquivosAnexados = this.ArquivosAnexados;
+ customerAttendance.set_Attachments(arquivosAnexados.Select<Gestor.Model.Domain.Common.ArquivoDigital, Attachment>((Gestor.Model.Domain.Common.ArquivoDigital x) => {
+ Attachment attachment = new Attachment();
+ attachment.set_Description(x.get_Descricao());
+ attachment.set_Extension(x.get_Extensao());
+ attachment.set_File(x.get_Arquivo());
+ return attachment;
+ }).ToList<Attachment>());
+ this.LimparComponentes();
+ this.SelecionaAtendimento();
+ if (await Connection.Post<CustomerAttendance>("Attendance/Send", customerAttendance) == null)
+ {
+ obj = null;
+ }
+ else
+ {
+ obj = new List<KeyValuePair<string, string>>();
+ ((List<KeyValuePair<string, string>>)obj).Add(new KeyValuePair<string, string>("fail", ""));
+ }
+ keyValuePairs = (List<KeyValuePair<string, string>>)obj;
+ }
+ else
+ {
+ keyValuePairs = keyValuePairs1;
+ }
+ }
+ catch (Exception exception)
+ {
+ keyValuePairs = new List<KeyValuePair<string, string>>()
+ {
+ new KeyValuePair<string, string>("fail", "")
+ };
+ }
+ return keyValuePairs;
+ }
+
+ private async void HabilitarAtendimento(Gestor.Model.API.HorarioAtendimento horario)
+ {
+ bool id;
+ string str;
+ if (horario == null || horario.get_Autorizado())
+ {
+ AtendimentosViewModel atendimentosViewModel = this;
+ Usuario usuario = Recursos.Usuario;
+ if (usuario != null)
+ {
+ id = usuario.get_Id() > (long)0;
+ }
+ else
+ {
+ id = false;
+ }
+ atendimentosViewModel.EnableButtons = id;
+ }
+ else
+ {
+ base.EnableButtons = false;
+ if (horario.get_InicioDia().HasValue)
+ {
+ string[] strArrays = new string[] { " de ", horario.get_InicioDia().DiaDaSemana(), " à ", horario.get_FimDia().DiaDaSemana(), ", das ", horario.get_InicioHora(), "hs às ", horario.get_FimHora(), "hs" };
+ str = string.Concat(strArrays);
+ }
+ else
+ {
+ string[] inicioHora = new string[] { " das ", horario.get_InicioHora(), "hs às ", horario.get_FimHora(), "hs" };
+ str = string.Concat(inicioHora);
+ }
+ string str1 = str;
+ string[] newLine = new string[] { "Prezado Cliente,", Environment.NewLine, Environment.NewLine, "Informamos Nosso horário de atendimento e recepção dos mesmos é ", str1, ".", Environment.NewLine, "Infelizmente não realizamos agendamento de data/hora de atendimento, por gentileza realize a solicitação dentro do horário comercial que retornaremos a você." };
+ await base.ShowMessage(string.Concat(newLine), "OK", "", false);
+ }
+ }
+
+ private async void InitialLoad()
+ {
+ base.IsEnabled = false;
+ this.HorarioAtendimento = await Connection.Get<Gestor.Model.API.HorarioAtendimento>("Attendance", true, false);
+ this.HabilitarAtendimento(this.HorarioAtendimento);
+ base.IsEnabled = true;
+ }
+
+ public void LimparComponentes()
+ {
+ this.Nome = Recursos.Usuario.get_Nome();
+ this.Ddd = Recursos.Usuario.get_Prefixo();
+ this.Telefone = Recursos.Usuario.get_Telefone();
+ this.Email = Recursos.Usuario.get_Email();
+ this.Assunto = null;
+ this.IdAcesso = null;
+ this.SenhaAcesso = null;
+ this.Corpo = string.Empty;
+ this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
+ }
+
+ private void LoadCombo()
+ {
+ this.Status = new List<string>()
+ {
+ "PENDENTES",
+ "FINALIZADOS"
+ };
+ }
+
+ public void SelecionaAtendimento()
+ {
+ if (this.Atendimentos != null && this.Atendimentos.Count > 0)
+ {
+ this.SelectedAtendimento = this.Atendimentos[0];
+ }
+ this.AtendimentoVisibility = Visibility.Visible;
+ this.EnvioEmailVisibility = Visibility.Collapsed;
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Nome))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Nome", Messages.get_Obrigatorio(), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Ddd))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Ddd", Messages.get_Obrigatorio(), true);
+ }
+ else if (!ValidationHelper.ValidacaoPrefixo(this.Ddd))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Ddd", Messages.get_Invalido(), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Telefone))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Telefone", Messages.get_Obrigatorio(), true);
+ }
+ else if (!ValidationHelper.ValidacaoTelefone(this.Telefone))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Telefone", Messages.get_Invalido(), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Email))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Email", Messages.get_Obrigatorio(), true);
+ }
+ else if (!ValidationHelper.ValidacaoEmail(this.Email))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Email", Messages.get_Invalido(), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Corpo))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Corpo", Messages.get_Obrigatorio(), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Assunto))
+ {
+ ValidationHelper.AddValue<string, string>(keyValuePairs, "Assunto", Messages.get_Obrigatorio(), true);
+ }
+ return keyValuePairs;
+ }
+
+ private async void WorkOnSelectedAtendimento(Atendimento value)
+ {
+ if (value != null)
+ {
+ this.WebBody = await this._ajudaServico.BuscarCorpoAtendimentos(value.IdAtendimento);
+ }
+ }
+
+ public async void WorkOnSelectedStatus(string value)
+ {
+ this.Atendimentos = await this._ajudaServico.BuscarAtendimentos(value);
+ this.SelecionaAtendimento();
+ }
+ }
+} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs
new file mode 100644
index 0000000..6f2e250
--- /dev/null
+++ b/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs
@@ -0,0 +1,122 @@
+using Gestor.Application.Model.Ajuda;
+using Gestor.Application.Servicos.Ajuda;
+using Gestor.Application.ViewModels.Generic;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+
+namespace Gestor.Application.ViewModels.Drawer.Ajuda
+{
+ public class BoletosNotasViewModel : BaseViewModel
+ {
+ private readonly AjudaServico _ajudaServico;
+
+ private bool _carregando;
+
+ private List<Boleto> _boletos;
+
+ private string _boletoDisponivel;
+
+ private List<string> _status;
+
+ public string BoletoDisponivel
+ {
+ get
+ {
+ return this._boletoDisponivel;
+ }
+ set
+ {
+ this._boletoDisponivel = value;
+ base.OnPropertyChanged("BoletoDisponivel");
+ }
+ }
+
+ public List<Boleto> Boletos
+ {
+ get
+ {
+ return this._boletos;
+ }
+ set
+ {
+ this._boletos = value;
+ base.OnPropertyChanged("Boletos");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return this._carregando;
+ }
+ set
+ {
+ this._carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ base.OnPropertyChanged("Carregando");
+ }
+ }
+
+ public List<string> Status
+ {
+ get
+ {
+ return this._status;
+ }
+ set
+ {
+ this._status = value;
+ base.OnPropertyChanged("Status");
+ }
+ }
+
+ public BoletosNotasViewModel()
+ {
+ this._ajudaServico = new AjudaServico();
+ this.LoadCombos();
+ this.BoletoDisponivel = "Disponível para impressão a partir de\n10 (dez) dias antes do vencimento";
+ }
+
+ private void LoadCombos()
+ {
+ this.Status = new List<string>()
+ {
+ "PENDENTES",
+ "BAIXADOS"
+ };
+ }
+
+ public async void WorkOnSelectedStatus(string value)
+ {
+ List<Boleto> list;
+ this.Carregando = true;
+ this.Boletos = new List<Boleto>();
+ List<Boleto> boletos = await this._ajudaServico.BuscarBoletosNotas(value);
+ BoletosNotasViewModel boletosNotasViewModel = this;
+ if (value == "BAIXADOS")
+ {
+ List<Boleto> boletos1 = boletos;
+ IEnumerable<Boleto> hasValue =
+ from x in boletos1
+ where x.Pagamento.HasValue
+ select x;
+ list = (
+ from x in hasValue
+ orderby x.Pagamento descending
+ select x).ToList<Boleto>();
+ }
+ else
+ {
+ list = boletos;
+ }
+ boletosNotasViewModel.Boletos = list;
+ this.Carregando = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
new file mode 100644
index 0000000..fe46bb4
--- /dev/null
+++ b/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs
@@ -0,0 +1,112 @@
+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
diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs
new file mode 100644
index 0000000..8ee9f0b
--- /dev/null
+++ b/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs
@@ -0,0 +1,281 @@
+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.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.License;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace Gestor.Application.ViewModels.Drawer.Ajuda
+{
+ public class InstalacaoViewModel : BaseViewModel
+ {
+ private readonly AjudaServico _ajudaServico;
+
+ private bool _enableExclusao;
+
+ private bool _mostrarAggilizador;
+
+ private string _infoGestor;
+
+ private string _infoAggilizador;
+
+ private bool _carregando;
+
+ private List<Gestor.Application.Model.Ajuda.Instalacao> _agger;
+
+ private ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> _aggerFiltrado;
+
+ private List<Gestor.Application.Model.Ajuda.Instalacao> _aggilizador;
+
+ public List<Gestor.Application.Model.Ajuda.Instalacao> Agger
+ {
+ get
+ {
+ return this._agger;
+ }
+ set
+ {
+ this._agger = value;
+ base.OnPropertyChanged("Agger");
+ }
+ }
+
+ public ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> AggerFiltrado
+ {
+ get
+ {
+ return this._aggerFiltrado;
+ }
+ set
+ {
+ this._aggerFiltrado = value;
+ base.OnPropertyChanged("AggerFiltrado");
+ }
+ }
+
+ public List<Gestor.Application.Model.Ajuda.Instalacao> Aggilizador
+ {
+ get
+ {
+ return this._aggilizador;
+ }
+ set
+ {
+ this._aggilizador = value;
+ base.OnPropertyChanged("Aggilizador");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return this._carregando;
+ }
+ set
+ {
+ this._carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ base.OnPropertyChanged("Carregando");
+ }
+ }
+
+ public bool EnableExclusao
+ {
+ get
+ {
+ return this._enableExclusao;
+ }
+ set
+ {
+ this._enableExclusao = value;
+ base.OnPropertyChanged("EnableExclusao");
+ }
+ }
+
+ public string InfoAggilizador
+ {
+ get
+ {
+ return this._infoAggilizador;
+ }
+ set
+ {
+ this._infoAggilizador = value;
+ base.OnPropertyChanged("InfoAggilizador");
+ }
+ }
+
+ public string InfoGestor
+ {
+ get
+ {
+ return this._infoGestor;
+ }
+ set
+ {
+ this._infoGestor = value;
+ base.OnPropertyChanged("InfoGestor");
+ }
+ }
+
+ public AutoCompleteFilterPredicate<object> InstalacaoItemFilter
+ {
+ get
+ {
+ AutoCompleteFilterPredicate<object> u003cu003e9_370 = InstalacaoViewModel.u003cu003ec.u003cu003e9__37_0;
+ if (u003cu003e9_370 == null)
+ {
+ u003cu003e9_370 = new AutoCompleteFilterPredicate<object>(InstalacaoViewModel.u003cu003ec.u003cu003e9, (string searchText, object obj) => {
+ if (((Gestor.Application.Model.Ajuda.Instalacao)obj).Maquina.ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Application.Model.Ajuda.Instalacao)obj).Usuario.ToUpper().Contains(searchText.ToUpper()))
+ {
+ return true;
+ }
+ return ((Gestor.Application.Model.Ajuda.Instalacao)obj).DataIntalacao.ToString().Contains(searchText.ToUpper());
+ });
+ InstalacaoViewModel.u003cu003ec.u003cu003e9__37_0 = u003cu003e9_370;
+ }
+ return u003cu003e9_370;
+ }
+ }
+
+ public bool MostrarAggilizador
+ {
+ get
+ {
+ return this._mostrarAggilizador;
+ }
+ set
+ {
+ this._mostrarAggilizador = value;
+ base.OnPropertyChanged("MostrarAggilizador");
+ }
+ }
+
+ public InstalacaoViewModel()
+ {
+ Usuario usuario = Recursos.Usuario;
+ if (usuario != null)
+ {
+ id = usuario.get_Id() > (long)0;
+ }
+ else
+ {
+ id = false;
+ }
+ this._enableExclusao = id;
+ base();
+ bool id;
+ this._ajudaServico = new AjudaServico();
+ this.LoadInstalacoes();
+ }
+
+ public async void Excluir(long id)
+ {
+ if (await this._ajudaServico.ExcluirInstalacao(id))
+ {
+ this.LoadInstalacoes();
+ }
+ }
+
+ internal async Task<List<Gestor.Application.Model.Ajuda.Instalacao>> Filtrar(string value)
+ {
+ List<Gestor.Application.Model.Ajuda.Instalacao> instalacaos = await Task.Run<List<Gestor.Application.Model.Ajuda.Instalacao>>(() => this.FiltrarInstalacao(value));
+ return instalacaos;
+ }
+
+ public List<Gestor.Application.Model.Ajuda.Instalacao> FiltrarInstalacao(string filter)
+ {
+ this.AggerFiltrado = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger) : new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger.Where<Gestor.Application.Model.Ajuda.Instalacao>((Gestor.Application.Model.Ajuda.Instalacao x) => {
+ if (ValidationHelper.RemoveDiacritics(x.Maquina.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Usuario.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)))
+ {
+ return true;
+ }
+ return x.DataIntalacao.ToString().Contains(ValidationHelper.RemoveDiacritics(filter));
+ })));
+ return this.AggerFiltrado.ToList<Gestor.Application.Model.Ajuda.Instalacao>();
+ }
+
+ private async void LoadInstalacoes()
+ {
+ int? nullable;
+ List<Gestor.Application.Model.Ajuda.Instalacao> instalacaos;
+ int? nullable1;
+ int? nullable2;
+ string str;
+ this.Carregando = true;
+ ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection = await this._ajudaServico.BuscarLicencas();
+ InstalacaoViewModel list = this;
+ ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection1 = observableCollection;
+ list.Agger = (
+ from x in observableCollection1
+ where !string.IsNullOrEmpty(x.IdGerenciador)
+ select x).ToList<Gestor.Application.Model.Ajuda.Instalacao>();
+ this.AggerFiltrado = new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger);
+ InstalacaoViewModel instalacaoViewModel = this;
+ List<Licenca> produtos = LicenseHelper.Produtos;
+ if (produtos.Any<Licenca>((Licenca x) => x.get_Produto() == 81))
+ {
+ instalacaos = new List<Gestor.Application.Model.Ajuda.Instalacao>();
+ }
+ else
+ {
+ ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection2 = observableCollection;
+ instalacaos = (
+ from x in observableCollection2
+ where !string.IsNullOrEmpty(x.IdAggilizador)
+ select x).ToList<Gestor.Application.Model.Ajuda.Instalacao>();
+ }
+ instalacaoViewModel.Aggilizador = instalacaos;
+ InstalacaoViewModel instalacaoViewModel1 = this;
+ object count = this.Agger.Count;
+ List<Licenca> licencas = LicenseHelper.Produtos;
+ Licenca licenca = licencas.FirstOrDefault<Licenca>((Licenca x) => x.get_Produto() == 1);
+ if (licenca != null)
+ {
+ nullable1 = new int?(licenca.get_Quantidade());
+ }
+ else
+ {
+ nullable = null;
+ nullable1 = nullable;
+ }
+ instalacaoViewModel1.InfoGestor = string.Format("{0} LICENÇAS INSTALADAS DE {1} LICENÇAS CONTRATADAS.", count, nullable1);
+ InstalacaoViewModel instalacaoViewModel2 = this;
+ if (this.Aggilizador.Count > 0)
+ {
+ object obj = this.Aggilizador.Count;
+ List<Licenca> produtos1 = LicenseHelper.Produtos;
+ Licenca licenca1 = produtos1.FirstOrDefault<Licenca>((Licenca x) => x.get_Produto() == 81);
+ if (licenca1 != null)
+ {
+ nullable2 = new int?(licenca1.get_Quantidade());
+ }
+ else
+ {
+ nullable = null;
+ nullable2 = nullable;
+ }
+ str = string.Format("{0} LICENÇAS INSTALADAS DE {1} LICENÇAS CONTRATADAS.", obj, nullable2);
+ }
+ else
+ {
+ str = "";
+ }
+ instalacaoViewModel2.InfoAggilizador = str;
+ this.MostrarAggilizador = this.Aggilizador.Count > 0;
+ this.Carregando = false;
+ }
+ }
+} \ No newline at end of file