From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../AtendimentosViewModel.cs | 472 +++++++++++++++++++++ 1 file changed, 472 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs new file mode 100644 index 0000000..05ffe12 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs @@ -0,0 +1,472 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +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; + +namespace Gestor.Application.ViewModels.Drawer.Ajuda; + +public class AtendimentosViewModel : BaseViewModel +{ + private readonly AjudaServico _ajudaServico; + + private List _status; + + private string _webbody; + + private Visibility _envioEmailVisibility = (Visibility)2; + + private Visibility _atendimentoVisibility; + + private ObservableCollection _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 _arquivosAnexados = new ObservableCollection(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private string _head; + + public HorarioAtendimento HorarioAtendimento { get; set; } + + public List Status + { + get + { + return _status; + } + set + { + _status = value; + OnPropertyChanged("Status"); + } + } + + public string WebBody + { + get + { + return _webbody?.ToUpper().Trim(); + } + set + { + _webbody = value; + OnPropertyChanged("WebBody"); + } + } + + public Visibility EnvioEmailVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _envioEmailVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _envioEmailVisibility = value; + OnPropertyChanged("EnvioEmailVisibility"); + } + } + + public Visibility AtendimentoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _atendimentoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _atendimentoVisibility = value; + OnPropertyChanged("AtendimentoVisibility"); + } + } + + public ObservableCollection Atendimentos + { + get + { + return _atendimentos; + } + set + { + _atendimentos = value; + OnPropertyChanged("Atendimentos"); + } + } + + public Atendimento SelectedAtendimento + { + get + { + return _selectedAtendimento; + } + set + { + _selectedAtendimento = value; + WorkOnSelectedAtendimento(value); + OnPropertyChanged("SelectedAtendimento"); + } + } + + public string Nome + { + get + { + return _nome; + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + public string Ddd + { + get + { + return _ddd; + } + set + { + _ddd = value; + OnPropertyChanged("Ddd"); + } + } + + public string Telefone + { + get + { + return _telefone; + } + set + { + _telefone = value; + OnPropertyChanged("Telefone"); + } + } + + public string Email + { + get + { + return _email; + } + set + { + _email = value; + OnPropertyChanged("Email"); + } + } + + public string Assunto + { + get + { + return _assunto; + } + set + { + _assunto = value; + OnPropertyChanged("Assunto"); + } + } + + public string IdAcesso + { + get + { + return _idacesso; + } + set + { + _idacesso = value; + OnPropertyChanged("IdAcesso"); + } + } + + public string Corpo + { + get + { + return _corpo; + } + set + { + _corpo = value; + OnPropertyChanged("Corpo"); + } + } + + public string SenhaAcesso + { + get + { + return _senhaacesso; + } + set + { + _senhaacesso = value; + OnPropertyChanged("SenhaAcesso"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + private async void HabilitarAtendimento(HorarioAtendimento horario) + { + if (horario == null || horario.Autorizado) + { + AtendimentosViewModel atendimentosViewModel = this; + Usuario usuario = Recursos.Usuario; + atendimentosViewModel.EnableButtons = usuario != null && ((DomainBase)usuario).Id > 0; + return; + } + base.EnableButtons = false; + string text = (horario.InicioDia.HasValue ? (" de " + horario.InicioDia.DiaDaSemana() + " à " + horario.FimDia.DiaDaSemana() + ", das " + horario.InicioHora + "hs às " + horario.FimHora + "hs") : (" das " + horario.InicioHora + "hs às " + horario.FimHora + "hs")); + await ShowMessage("Prezado Cliente," + Environment.NewLine + Environment.NewLine + "Informamos Nosso horário de atendimento e recepção dos mesmos é " + text + "." + 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ê."); + } + + public AtendimentosViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Expected O, but got Unknown + base.EnableButtons = true; + _ajudaServico = new AjudaServico(); + LoadCombo(); + InitialLoad(); + } + + private async void InitialLoad() + { + base.IsEnabled = false; + HorarioAtendimento = await Connection.Get("Attendance"); + HabilitarAtendimento(HorarioAtendimento); + base.IsEnabled = true; + } + + private void LoadCombo() + { + Status = new List { "PENDENTES", "FINALIZADOS" }; + } + + public async void WorkOnSelectedStatus(string value) + { + Atendimentos = await _ajudaServico.BuscarAtendimentos(value); + SelecionaAtendimento(); + } + + public void SelecionaAtendimento() + { + if (Atendimentos != null && Atendimentos.Count > 0) + { + SelectedAtendimento = Atendimentos[0]; + } + AtendimentoVisibility = (Visibility)0; + EnvioEmailVisibility = (Visibility)2; + } + + private async void WorkOnSelectedAtendimento(Atendimento value) + { + if (value != null) + { + WebBody = await _ajudaServico.BuscarCorpoAtendimentos(value.IdAtendimento); + } + } + + public async void Anexar() + { + List list = await AddAttachments(new List(), new List()); + if (list != null) + { + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(list); + } + } + + public async Task>> Enviar() + { + try + { + List> list = Validate(); + if (list.Count > 0) + { + return list; + } + CustomerData val = new CustomerData + { + Corretora = Recursos.Empresa.Nome, + Name = Nome, + AreaCode = Ddd, + Number = Telefone, + Email = Email + }; + string body = $"{Corpo}

ID Acesso: {IdAcesso}
Senha Acesso: {SenhaAcesso}

VERSÃO DO SISTEMA: {ApplicationHelper.Versao}
USUÁRIO SISTEMA:{((DomainBase)Recursos.Usuario).Id} {Recursos.Usuario.Login}

{JsonConvert.SerializeObject((object)val)}

"; + CustomerAttendance keyValues = new CustomerAttendance + { + CustomerData = val, + Subject = Assunto, + Body = body, + Attachments = ((IEnumerable)ArquivosAnexados).Select((Func)((ArquivoDigital x) => new Attachment + { + Description = x.Descricao, + Extension = x.Extensao, + File = x.Arquivo + })).ToList() + }; + bool num = await Connection.Post("Attendance/Send", keyValues) == null; + LimparComponentes(); + SelecionaAtendimento(); + return num ? null : new List> + { + new KeyValuePair("fail", "") + }; + } + catch (Exception) + { + return new List> + { + new KeyValuePair("fail", "") + }; + } + } + + public void LimparComponentes() + { + Nome = Recursos.Usuario.Nome; + Ddd = Recursos.Usuario.Prefixo; + Telefone = Recursos.Usuario.Telefone; + Email = Recursos.Usuario.Email; + Assunto = null; + IdAcesso = null; + SenhaAcesso = null; + Corpo = string.Empty; + ArquivosAnexados = new ObservableCollection(); + } + + public List> Validate() + { + List> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Nome)) + { + ValidationHelper.AddValue(list, "Nome", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(Ddd)) + { + ValidationHelper.AddValue(list, "Ddd", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoPrefixo(Ddd)) + { + ValidationHelper.AddValue(list, "Ddd", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Telefone)) + { + ValidationHelper.AddValue(list, "Telefone", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoTelefone(Telefone)) + { + ValidationHelper.AddValue(list, "Telefone", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Email)) + { + ValidationHelper.AddValue(list, "Email", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoEmail(Email)) + { + ValidationHelper.AddValue(list, "Email", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Corpo)) + { + ValidationHelper.AddValue(list, "Corpo", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(Assunto)) + { + ValidationHelper.AddValue(list, "Assunto", Messages.Obrigatorio, true); + } + return list; + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } +} -- cgit v1.2.3