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/Drawer/ArquivoDigitalViewModel.cs | 1414 -------------------- 1 file changed, 1414 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs (limited to 'Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs') diff --git a/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs b/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs deleted file mode 100644 index 6963a1e..0000000 --- a/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs +++ /dev/null @@ -1,1414 +0,0 @@ -using Assinador.Model.Domain; -using Assinador.Model.Generic; -using CsQuery.ExtensionMethods.Internal; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.Servicos.Generic; -using Gestor.Application.Servicos.Seguros; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Ferramentas; -using Gestor.Common.Security; -using Gestor.Common.Validation; -using Gestor.Model.API; -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.MalaDireta; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.Helper; -using Gestor.Model.License; -using System; -using System.Collections; -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 -{ - public class ArquivoDigitalViewModel : BaseSegurosViewModel - { - private readonly ClienteServico _servico; - - private Visibility _assinarVisibility = Visibility.Collapsed; - - private Visibility _visibilityWhatsApp = Visibility.Collapsed; - - private bool _carregando; - - private bool _activated = true; - - private bool _adDocumento; - - private Visibility _adDocumentoVisibility; - - private bool _isVisibleSalvar; - - private Visibility _enviarSelecionadosVisibility; - - private Cliente _selectedCliente = new Cliente(); - - private ObservableCollection _telefones = new ObservableCollection(); - - private ObservableCollection _arquivos = new ObservableCollection(); - - private ObservableCollection _arquivosTela = new ObservableCollection(); - - private IndiceArquivoDigital _selectedArquivo = new IndiceArquivoDigital(); - - private ObservableCollection _arquivosAnexados = new ObservableCollection(); - - private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital(); - - private string _titulo = ""; - - private ObservableCollection _emails = new ObservableCollection(); - - private string _assunto; - - private string _corpo; - - private string _nome; - - private string _documento; - - private string _email; - - private string _licencas; - - private string _assinadorKey; - - public bool Activated - { - get - { - return this._activated; - } - set - { - this._activated = value; - base.OnPropertyChanged("Activated"); - } - } - - public bool AdDocumento - { - get - { - return this._adDocumento; - } - set - { - this._adDocumento = value; - this.CarregarArquivos(); - base.OnPropertyChanged("AdDocumento"); - } - } - - public Visibility AdDocumentoVisibility - { - get - { - return this._adDocumentoVisibility; - } - set - { - this._adDocumentoVisibility = value; - base.OnPropertyChanged("AdDocumentoVisibility"); - } - } - - public ObservableCollection Arquivos - { - get - { - return this._arquivos; - } - set - { - this._arquivos = value; - this.ArquivosTela = value; - base.OnPropertyChanged("Arquivos"); - } - } - - public ObservableCollection ArquivosAnexados - { - get - { - return this._arquivosAnexados; - } - set - { - this._arquivosAnexados = value; - this.IsVisibleSalvar = (value == null ? false : value.Count > 0); - base.OnPropertyChanged("ArquivosAnexados"); - } - } - - public ObservableCollection ArquivosTela - { - get - { - return this._arquivosTela; - } - set - { - this._arquivosTela = value; - base.OnPropertyChanged("ArquivosTela"); - } - } - - public Visibility AssinarVisibility - { - get - { - return this._assinarVisibility; - } - set - { - this._assinarVisibility = value; - base.OnPropertyChanged("AssinarVisibility"); - } - } - - public string Assunto - { - get - { - return this._assunto; - } - set - { - this._assunto = value; - base.OnPropertyChanged("Assunto"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public string Corpo - { - get - { - return this._corpo; - } - set - { - this._corpo = value; - base.OnPropertyChanged("Corpo"); - } - } - - public string Documento - { - get - { - return this._documento; - } - set - { - this._documento = value; - base.OnPropertyChanged("Documento"); - } - } - - public string Email - { - get - { - return this._email; - } - set - { - string str; - if (value != null) - { - str = value.Trim(); - } - else - { - str = null; - } - this._email = str; - base.OnPropertyChanged("Email"); - } - } - - public ObservableCollection Emails - { - get - { - return this._emails; - } - set - { - this._emails = value; - base.OnPropertyChanged("Emails"); - } - } - - public Visibility EnviarSelecionadosVisibility - { - get - { - return this._enviarSelecionadosVisibility; - } - set - { - this._enviarSelecionadosVisibility = (!base.Restricao(20) ? value : Visibility.Collapsed); - base.OnPropertyChanged("EnviarSelecionadosVisibility"); - } - } - - private FiltroArquivoDigital Filtro - { - get; - } - - public bool IsVisibleSalvar - { - get - { - return this._isVisibleSalvar; - } - set - { - this._isVisibleSalvar = value; - base.OnPropertyChanged("IsVisibleSalvar"); - } - } - - public string Licencas - { - get - { - return this._licencas; - } - set - { - this._licencas = value; - base.OnPropertyChanged("Licencas"); - } - } - - 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 IndiceArquivoDigital SelectedArquivo - { - get - { - return this._selectedArquivo; - } - set - { - this._selectedArquivo = value; - base.OnPropertyChanged("SelectedArquivo"); - } - } - - public Cliente SelectedCliente - { - get - { - return this._selectedCliente; - } - set - { - this._selectedCliente = value; - base.OnPropertyChanged("SelectedCliente"); - } - } - - public ObservableCollection Telefones - { - get - { - return this._telefones; - } - set - { - this._telefones = value; - base.OnPropertyChanged("Telefones"); - } - } - - public string Titulo - { - get - { - return this._titulo; - } - set - { - this._titulo = value; - base.OnPropertyChanged("Titulo"); - } - } - - public Visibility VisibilityWhatsApp - { - get - { - return this._visibilityWhatsApp; - } - set - { - this._visibilityWhatsApp = value; - base.OnPropertyChanged("VisibilityWhatsApp"); - } - } - - public ArquivoDigitalViewModel(FiltroArquivoDigital filtro) - { - this.Filtro = filtro; - this._servico = new ClienteServico(); - this.CarregarArquivos(); - this.VisibilityWhatsApp = (filtro.get_Tipo() == 2 || filtro.get_Tipo() == 3 || filtro.get_Tipo() == 4 || filtro.get_Tipo() == 5 ? Visibility.Visible : Visibility.Collapsed); - this.AdDocumentoVisibility = ((filtro.get_Tipo() == 4 || filtro.get_Tipo() == 3 || filtro.get_Tipo() == 5) && (new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar() ? Visibility.Visible : Visibility.Collapsed); - base.EnableMenu = true; - switch (filtro.get_Tipo()) - { - case 0: - case 6: - case 7: - case 8: - case 9: - case 10: - case 12: - case 13: - case 14: - case 15: - case 17: - { - this.EnviarSelecionadosVisibility = Visibility.Collapsed; - return; - } - default: - { - this.EnviarSelecionadosVisibility = Visibility.Visible; - return; - } - } - } - - public async void Anexar() - { - ObservableCollection arquivos = this.Arquivos; - List list = arquivos.Select((IndiceArquivoDigital x) => { - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = new Gestor.Model.Domain.Common.ArquivoDigital(); - arquivoDigital.set_Descricao(x.get_Descricao()); - arquivoDigital.set_Extensao(x.get_Extensao()); - return arquivoDigital; - }).ToList(); - List arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList(), list); - if (arquivoDigitals != null) - { - List configuracoes = Recursos.Configuracoes; - if (!configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 47)) - { - arquivoDigitals = await base.ShowDialogAnexar(arquivoDigitals, false); - if (arquivoDigitals == null) - { - return; - } - } - arquivoDigitals.AddRange(this.ArquivosAnexados); - this.ArquivosAnexados = new ObservableCollection(arquivoDigitals); - } - } - - public async Task Assinar(IndiceArquivoDigital indice, bool lote = false) - { - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador; - object obj; - int num = 0; - try - { - AssinaturaServico assinaturaServico = new AssinaturaServico(); - Gestor.Application.Servicos.ArquivoDigitalServico arquivoDigitalServico = new Gestor.Application.Servicos.ArquivoDigitalServico(); - if (await assinaturaServico.VerificarAssinado(indice.get_Id())) - { - if (!lote) - { - await base.ShowMessage("ARQUIVO JÁ ASSINADO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (await assinaturaServico.VerificarEnviado(indice.get_Id())) - { - arquivoParaAssinaturaAssinador = await assinaturaServico.Reenviar(indice.get_Id()); - return arquivoParaAssinaturaAssinador; - } - else if (this.Nome == null || string.IsNullOrWhiteSpace(this.Nome)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM NOME VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Documento == null || !Gestor.Common.Validation.ValidationHelper.ValidateDocument(this.Documento)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM DOCUMENTO VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Documento.Length > 14) - { - if (!lote) - { - await base.ShowMessage("O DOCUMENTO DO ASSINANTE DEVE SER CPF E NÃO CNPJ", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Email == null || !Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(this.Email)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else - { - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = await arquivoDigitalServico.BuscarPorId(indice.get_IdArquivoDigital(), indice.get_Bd()); - long id = (long)0; - Gestor.Model.Domain.Seguros.Documento documento = new Gestor.Model.Domain.Seguros.Documento(); - switch (this.Filtro.get_Tipo()) - { - case 2: - { - id = ((Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente()).get_Id(); - break; - } - case 3: - { - id = ((Parcela)this.Filtro.get_Parente()).get_Documento().get_Id(); - break; - } - case 4: - { - id = ((Item)this.Filtro.get_Parente()).get_Documento().get_Id(); - break; - } - case 5: - { - id = ((Sinistro)this.Filtro.get_Parente()).get_ControleSinistro().get_Item().get_Documento().get_Id(); - break; - } - default: - { - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - } - AssinaturaServico assinaturaServico1 = assinaturaServico; - ApoliceAssinador apoliceAssinador = new ApoliceAssinador(); - apoliceAssinador.set_ArquivoId(indice.get_Id()); - apoliceAssinador.set_ClienteId(this.SelectedCliente.get_Id()); - apoliceAssinador.set_Cliente(this.Nome); - apoliceAssinador.set_Email(this.Email); - apoliceAssinador.set_Documento(this.Documento); - apoliceAssinador.set_Id(id); - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador1 = await assinaturaServico1.Assinar(arquivoDigital, apoliceAssinador); - arquivoParaAssinaturaAssinador = await assinaturaServico.Save(arquivoParaAssinaturaAssinador1); - return arquivoParaAssinaturaAssinador; - } - } - catch (Exception exception) - { - obj = exception; - num = 1; - } - if (num != 1) - { - throw null; - } - Exception exception1 = (Exception)obj; - string[] newLine = new string[] { "ERRO AO ENVIAR PARA ASSINATURA", Environment.NewLine, exception1.Message, Environment.NewLine, "POR FAVOR CONTATE A AGGER ATRAVÉS DO PAINEL DE ATENDIMENTOS" }; - await base.ShowMessage(string.Concat(newLine), "OK", "", false); - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - - private void AtualizaEmpresa() - { - Recursos.Empresa = (new BaseServico()).BuscarEmpresa(Recursos.Usuario.get_IdEmpresa()); - } - - public void Baixar(IndiceArquivoDigital arquivo, bool abrir = false) - { - if (arquivo == null || arquivo.get_IdArquivoDigital() == 0) - { - return; - } - base.Download(arquivo, abrir); - } - - public async Task BaixarTodos() - { - bool flag; - if (this.Arquivos == null || this.Arquivos.Count == 0) - { - flag = false; - } - else - { - flag = await base.DownloadAll(this.Arquivos.ToList(), this.Filtro.get_Id()); - } - return flag; - } - - public async Task CarregaArquivos() - { - TipoArquivoDigital tipo; - bool id; - string email; - object emailResponsavel; - object nomeResponsavel; - object documentoResponsavel; - string str; - string str1; - Cliente cliente; - FiltroArquivoDigital filtro = this.Filtro; - if (filtro != null) - { - id = filtro.get_Id() == (long)0; - } - else - { - id = false; - } - if (!id) - { - this.Carregando = true; - base.IsVisible = Visibility.Collapsed; - this.AssinarVisibility = Visibility.Collapsed; - if (this.Filtro != null) - { - List indiceArquivoDigitals = await this.ArquivoDigitalServico.BuscarPorTipo(this.Filtro.get_Tipo(), this.Filtro.get_Id()); - if (this.AdDocumento) - { - List indiceArquivoDigitals1 = indiceArquivoDigitals; - List indiceArquivoDigitals2 = await this.ArquivoDigitalServico.BuscarPorTipo(2, this.Filtro.get_IdApolice()); - indiceArquivoDigitals1.AddRange(indiceArquivoDigitals2); - indiceArquivoDigitals1 = null; - } - ArquivoDigitalViewModel observableCollection = this; - List indiceArquivoDigitals3 = indiceArquivoDigitals; - observableCollection.Arquivos = new ObservableCollection( - from x in indiceArquivoDigitals3 - orderby x.get_Descricao() - select x); - tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 2: - { - this.AssinarVisibility = Visibility.Visible; - Gestor.Model.Domain.Seguros.Documento parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - this.SelectedCliente = parente.get_Controle().get_Cliente(); - ArquivoDigitalViewModel arquivoDigitalViewModel = this; - str = (parente.get_Apolice() != string.Empty ? string.Concat("ARQUIVO DIGITAL DA APÓLICE \"", parente.get_Apolice(), "\"") : string.Concat("ARQUIVO DIGITAL DA PROPOSTA \"", parente.get_Proposta(), "\"")); - arquivoDigitalViewModel.Titulo = str; - break; - } - case 3: - { - this.AssinarVisibility = Visibility.Visible; - Parcela parcela = (Parcela)this.Filtro.get_Parente(); - this.SelectedCliente = parcela.get_Documento().get_Controle().get_Cliente(); - ArquivoDigitalViewModel arquivoDigitalViewModel1 = this; - str1 = (parcela.get_Documento().get_Apolice() != string.Empty ? string.Format("ARQUIVO DIGITAL DA PARCELA \"{0}\" DA APÓLICE \"{1}\"", parcela.get_NumeroParcela(), parcela.get_Documento().get_Apolice()) : string.Format("ARQUIVO DIGITAL DA PARCELA \"{0}\" DA PROPOSTA \"{1}\"", parcela.get_NumeroParcela(), parcela.get_Documento().get_Proposta())); - arquivoDigitalViewModel1.Titulo = str1; - DetalheExtrato detalheExtrato = await (new ServicoExtrato()).FindByParcelaId(parcela.get_Id()); - if (detalheExtrato == null) - { - break; - } - indiceArquivoDigitals = await this.ArquivoDigitalServico.BuscarPorTipo(7, detalheExtrato.get_Extrato().get_Id()); - List indiceArquivoDigitals4 = indiceArquivoDigitals; - indiceArquivoDigitals4.ForEach((IndiceArquivoDigital x) => x.set_NaoExcluir(true)); - ObservableCollection arquivos = this.Arquivos; - List indiceArquivoDigitals5 = indiceArquivoDigitals; - ExtensionMethods.AddRange(arquivos, new ObservableCollection( - from x in indiceArquivoDigitals5 - orderby x.get_Descricao() - select x)); - break; - } - case 4: - { - this.AssinarVisibility = Visibility.Visible; - Item item = (Item)this.Filtro.get_Parente(); - this.SelectedCliente = item.get_Documento().get_Controle().get_Cliente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO ITEM \"", item.get_Descricao(), "\""); - break; - } - case 5: - { - this.AssinarVisibility = Visibility.Visible; - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - this.SelectedCliente = sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente(); - string[] numero = new string[] { "ARQUIVO DIGITAL DO SINITRO \"", sinistro.get_Numero(), "\" DO ITEM \"", sinistro.get_ControleSinistro().get_Item().get_Descricao(), "\"" }; - this.Titulo = string.Concat(numero); - break; - } - case 6: - { - Vendedor vendedor = (Vendedor)this.Filtro.get_Parente(); - Cliente cliente1 = new Cliente(); - cliente1.set_Id(vendedor.get_Id()); - cliente1.set_Nome(vendedor.get_Nome()); - this.SelectedCliente = cliente1; - this.Titulo = string.Format("ARQUIVO DIGITAL DO VENDEDOR {0} {1}", vendedor.get_Nome(), vendedor.get_Id()); - break; - } - case 7: - { - Extrato extrato = (Extrato)this.Filtro.get_Parente(); - Cliente cliente2 = new Cliente(); - cliente2.set_Nome(string.Concat("EXTRATO ", extrato.get_Numero())); - this.SelectedCliente = cliente2; - this.Titulo = string.Format("ARQUIVO DIGITAL DO EXTRATO {0} ID:{1}", extrato.get_Numero(), extrato.get_Id()); - break; - } - case 8: - { - Seguradora seguradora = (Seguradora)this.Filtro.get_Parente(); - Cliente cliente3 = new Cliente(); - cliente3.set_Id(seguradora.get_Id()); - cliente3.set_Nome(seguradora.get_Nome()); - this.SelectedCliente = cliente3; - this.Titulo = string.Format("ARQUIVO DIGITAL DA SEGURADORA {0} {1}", seguradora.get_Nome(), seguradora.get_Id()); - break; - } - case 9: - { - Lancamento lancamento = (Lancamento)this.Filtro.get_Parente(); - if (!lancamento.get_Historico().Equals("TRANSFERÊNCIA ENTRE CONTAS")) - { - Cliente cliente4 = new Cliente(); - cliente4.set_Id(lancamento.get_Controle().get_Fornecedor().get_Id()); - cliente4.set_Nome(lancamento.get_Controle().get_Fornecedor().get_Nome()); - this.SelectedCliente = cliente4; - this.Titulo = string.Format("ARQUIVO DIGITAL DO LANCAMENTO {0}, PLANO {1}, CENTRO {2}", lancamento.get_Id(), lancamento.get_Controle().get_Plano().get_Nome(), lancamento.get_Controle().get_Centro().get_Descricao()); - break; - } - else - { - await base.ShowMessage("NÃO É POSSIVEL INCLUIR ARQUIVOS EM TRANSFERÊNCIA ENTRE CONTAS", "OK", "", false); - base.CloseDrawer(); - return; - } - } - case 10: - { - Fornecedor fornecedor = (Fornecedor)this.Filtro.get_Parente(); - Cliente cliente5 = new Cliente(); - cliente5.set_Id(fornecedor.get_Id()); - cliente5.set_Nome(fornecedor.get_Nome()); - this.SelectedCliente = cliente5; - this.Titulo = string.Format("ARQUIVO DIGITAL DO FORNECEDOR {0} {1}", fornecedor.get_Nome(), fornecedor.get_Id()); - break; - } - case 11: - { - Prospeccao prospeccao = (Prospeccao)this.Filtro.get_Parente(); - Cliente cliente6 = new Cliente(); - cliente6.set_Id(prospeccao.get_Id()); - cliente6.set_Nome(prospeccao.get_Nome()); - this.SelectedCliente = cliente6; - this.Titulo = string.Format("ARQUIVO DIGITAL DA PROSPECÇÃO {0} {1} {2}", prospeccao.get_Nome(), prospeccao.get_Id(), prospeccao.get_Item()); - break; - } - case 12: - { - Usuario usuario = (Usuario)this.Filtro.get_Parente(); - Cliente cliente7 = new Cliente(); - cliente7.set_Id(usuario.get_Id()); - cliente7.set_Nome(usuario.get_Nome()); - this.SelectedCliente = cliente7; - this.Titulo = string.Format("ARQUIVO DIGITAL DO USUÁRIO {0} {1}", usuario.get_Nome(), usuario.get_Id()); - break; - } - case 13: - { - Empresa empresa = (Empresa)this.Filtro.get_Parente(); - Cliente cliente8 = new Cliente(); - cliente8.set_Id(empresa.get_Id()); - cliente8.set_Nome(empresa.get_Nome()); - this.SelectedCliente = cliente8; - this.Titulo = string.Format("ARQUIVO DIGITAL DA EMPRESA {0} {1}", empresa.get_Nome(), empresa.get_Id()); - break; - } - case 14: - { - Socio socio = (Socio)this.Filtro.get_Parente(); - Cliente cliente9 = new Cliente(); - cliente9.set_Id(socio.get_Id()); - cliente9.set_Nome(socio.get_Nome()); - this.SelectedCliente = cliente9; - this.Titulo = string.Format("ARQUIVO DIGITAL DO SÓCIO {0} {1}", socio.get_Nome(), socio.get_Id()); - break; - } - case 15: - { - Tarefa tarefa = (Tarefa)this.Filtro.get_Parente(); - Cliente cliente10 = new Cliente(); - cliente10.set_Id(tarefa.get_Id()); - cliente10.set_Nome(string.Concat("TAREFA - ", tarefa.get_Titulo())); - this.SelectedCliente = cliente10; - this.Titulo = string.Format("ANEXO DA TAREFA {0} {1}", tarefa.get_Titulo(), tarefa.get_Id()); - break; - } - case 16: - { - NotaFiscal notaFiscal = (NotaFiscal)this.Filtro.get_Parente(); - Cliente cliente11 = new Cliente(); - cliente11.set_Id(notaFiscal.get_Id()); - cliente11.set_Nome(string.Format("NOTA FISCAL - {0} {1:d}", notaFiscal.get_Seguradora().get_NomeSocial(), notaFiscal.get_Data())); - this.SelectedCliente = cliente11; - this.Titulo = string.Format("ANEXO DA NOTA FISCAL {0} {1:d}", notaFiscal.get_Seguradora().get_NomeSocial(), notaFiscal.get_Data()); - break; - } - case 17: - { - Estipulante estipulante = (Estipulante)this.Filtro.get_Parente(); - Cliente cliente12 = new Cliente(); - cliente12.set_Id(estipulante.get_Id()); - cliente12.set_Nome(string.Concat("ESTIPULANTE - ", estipulante.get_Nome())); - this.SelectedCliente = cliente12; - this.Titulo = string.Concat("ANEXO DO ESTIPULANTE ", estipulante.get_Nome()); - break; - } - default: - { - this.SelectedCliente = (Cliente)this.Filtro.get_Parente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO CLIENTE \"", this.SelectedCliente.get_Nome(), "\""); - break; - } - } - indiceArquivoDigitals = null; - } - if (this.Filtro != null) - { - tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 1: - case 2: - case 3: - case 4: - case 5: - { - cliente = await this._servico.BuscarClienteAsync(this.SelectedCliente.get_Id()); - this.Telefones = await this._servico.BuscarTelefonesAsync(this.SelectedCliente.get_Id()); - ObservableCollection observableCollection1 = await (new ClienteServico()).BuscarEmailsAsync(this.SelectedCliente.get_Id()); - if (this.SelectedCliente.get_Documento() == null || Gestor.Common.Validation.ValidationHelper.OnlyNumber(this.SelectedCliente.get_Documento()).Length <= 11) - { - ArquivoDigitalViewModel arquivoDigitalViewModel2 = this; - ClienteEmail clienteEmail = observableCollection1.FirstOrDefault(); - if (clienteEmail != null) - { - email = clienteEmail.get_Email(); - } - else - { - email = null; - } - arquivoDigitalViewModel2.Email = email; - this.Nome = this.SelectedCliente.get_Nome(); - this.Documento = this.SelectedCliente.get_Documento(); - goto case 8; - } - else - { - ArquivoDigitalViewModel arquivoDigitalViewModel3 = this; - Cliente cliente13 = cliente; - if (cliente13 != null) - { - ResponsavelAssinatura responsavelAssinatura = cliente13.get_ResponsavelAssinatura(); - if (responsavelAssinatura != null) - { - emailResponsavel = responsavelAssinatura.get_EmailResponsavel(); - } - else - { - emailResponsavel = null; - } - } - else - { - emailResponsavel = null; - } - if (emailResponsavel == null) - { - ClienteEmail clienteEmail1 = observableCollection1.FirstOrDefault(); - if (clienteEmail1 != null) - { - emailResponsavel = clienteEmail1.get_Email(); - } - else - { - emailResponsavel = null; - } - } - arquivoDigitalViewModel3.Email = (string)emailResponsavel; - ArquivoDigitalViewModel arquivoDigitalViewModel4 = this; - Cliente cliente14 = cliente; - if (cliente14 != null) - { - ResponsavelAssinatura responsavelAssinatura1 = cliente14.get_ResponsavelAssinatura(); - if (responsavelAssinatura1 != null) - { - nomeResponsavel = responsavelAssinatura1.get_NomeResponsavel(); - } - else - { - nomeResponsavel = null; - } - } - else - { - nomeResponsavel = null; - } - if (nomeResponsavel == null) - { - nomeResponsavel = this.SelectedCliente.get_Nome(); - } - arquivoDigitalViewModel4.Nome = (string)nomeResponsavel; - ArquivoDigitalViewModel arquivoDigitalViewModel5 = this; - Cliente cliente15 = cliente; - if (cliente15 != null) - { - ResponsavelAssinatura responsavelAssinatura2 = cliente15.get_ResponsavelAssinatura(); - if (responsavelAssinatura2 != null) - { - documentoResponsavel = responsavelAssinatura2.get_DocumentoResponsavel(); - } - else - { - documentoResponsavel = null; - } - } - else - { - documentoResponsavel = null; - } - if (documentoResponsavel == null) - { - documentoResponsavel = this.SelectedCliente.get_Documento(); - } - arquivoDigitalViewModel5.Documento = (string)documentoResponsavel; - goto case 8; - } - } - case 6: - case 7: - case 8: - { - cliente = null; - break; - } - case 9: - { - Lancamento parente1 = (Lancamento)this.Filtro.get_Parente(); - ObservableCollection observableCollection2 = new ObservableCollection(); - ClienteTelefone clienteTelefone = new ClienteTelefone(); - clienteTelefone.set_Prefixo(parente1.get_Controle().get_Fornecedor().get_Prefixo1()); - clienteTelefone.set_Numero(parente1.get_Controle().get_Fornecedor().get_Telefone1()); - observableCollection2.Add(clienteTelefone); - ClienteTelefone clienteTelefone1 = new ClienteTelefone(); - clienteTelefone1.set_Prefixo(parente1.get_Controle().get_Fornecedor().get_Prefixo2()); - clienteTelefone1.set_Numero(parente1.get_Controle().get_Fornecedor().get_Telefone2()); - observableCollection2.Add(clienteTelefone1); - this.Telefones = observableCollection2; - goto case 8; - } - case 10: - { - Fornecedor fornecedor1 = (Fornecedor)this.Filtro.get_Parente(); - ObservableCollection observableCollection3 = new ObservableCollection(); - ClienteTelefone clienteTelefone2 = new ClienteTelefone(); - clienteTelefone2.set_Prefixo(fornecedor1.get_Prefixo1()); - clienteTelefone2.set_Numero(fornecedor1.get_Telefone1()); - observableCollection3.Add(clienteTelefone2); - ClienteTelefone clienteTelefone3 = new ClienteTelefone(); - clienteTelefone3.set_Prefixo(fornecedor1.get_Prefixo2()); - clienteTelefone3.set_Numero(fornecedor1.get_Telefone2()); - observableCollection3.Add(clienteTelefone3); - this.Telefones = observableCollection3; - goto case 8; - } - default: - { - if (tipo == 17) - { - Estipulante estipulante1 = (Estipulante)this.Filtro.get_Parente(); - ObservableCollection observableCollection4 = new ObservableCollection(); - ClienteTelefone clienteTelefone4 = new ClienteTelefone(); - clienteTelefone4.set_Prefixo(estipulante1.get_PrimeiroPrefixo()); - clienteTelefone4.set_Numero(estipulante1.get_PrimeiroTelefone()); - observableCollection4.Add(clienteTelefone4); - ClienteTelefone clienteTelefone5 = new ClienteTelefone(); - clienteTelefone5.set_Prefixo(estipulante1.get_SegundoPrefixo()); - clienteTelefone5.set_Numero(estipulante1.get_SegundoTelefone()); - observableCollection4.Add(clienteTelefone5); - this.Telefones = observableCollection4; - goto case 8; - } - else - { - goto case 8; - } - } - } - } - base.IsVisible = Visibility.Visible; - this.Carregando = false; - } - } - - public async void CarregarArquivos() - { - await base.PermissaoTela(6); - await base.PermissaoArquivoDigital(this.Filtro.get_Tipo()); - await this.CarregaArquivos(); - string str = "PRODUTO NÃO CONTRATADO"; - List produtos = LicenseHelper.Produtos; - if (produtos.Any((Licenca x) => x.get_Produto() == 86)) - { - this._assinadorKey = await AssinadorHelper.Key(); - int num = await AssinadorHelper.Licencas(this._assinadorKey); - str = string.Format("{0} LICENÇAS DISPONÍVEIS", num); - } - this.Licencas = str; - base.VerificarEnables(new long?((long)0)); - } - - public string CarregarMensagem() - { - Gestor.Model.Domain.Seguros.Documento parente; - Item item; - string str; - string str1; - this.AtualizaEmpresa(); - if (Recursos.Empresa.get_TipoTelefone1() == 11) - { - str1 = "0300"; - } - else - { - str1 = (Recursos.Empresa.get_TipoTelefone1() == 10 ? "0800" : ""); - } - string str2 = str1; - str2 = string.Concat(new string[] { str2, " ", Recursos.Empresa.get_PrimeiroPrefixo(), " ", Recursos.Empresa.get_PrimeiroTelefone() }); - TipoArquivoDigital tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 1: - { - return string.Concat(new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). ", Environment.NewLine, Environment.NewLine, "[*LINK*]", Environment.NewLine, Environment.NewLine, "<|LINKASSINATURA|>", Environment.NewLine, Environment.NewLine, "Para mais informações entre contato conosco pelo ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - } - case 2: - { - parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. ", Environment.NewLine, null }; - strArrays[4] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays); - } - case 3: - { - Parcela parcela = (Parcela)this.Filtro.get_Parente(); - parente = parcela.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays1 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente a sua parcela. ", Environment.NewLine, null, null }; - strArrays1[4] = string.Format("Parcela {0} de {1}, valor {2:C2} de vencimento {3:d}. {4}", new object[] { parcela.get_NumeroParcela(), parente.get_NumeroParcelas(), parcela.get_Valor(), parcela.get_Vencimento(), Environment.NewLine }); - strArrays1[5] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays1); - } - case 4: - { - item = (Item)this.Filtro.get_Parente(); - parente = item.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays2 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. ", Environment.NewLine, "Item ", item.get_Descricao(), ". ", Environment.NewLine, null }; - strArrays2[8] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays2); - } - case 5: - { - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - item = sinistro.get_ControleSinistro().get_Item(); - parente = item.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays3 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu sinistro. ", Environment.NewLine, "Sinistro de número ", sinistro.get_Numero(), " Item sinistrado ", sinistro.get_ItemSinistrado(), ". ", Environment.NewLine, null }; - strArrays3[10] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays3); - } - default: - { - if (tipo == 13) - { - break; - } - else - { - goto Label0; - } - } - } - return string.Concat(new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). ", Environment.NewLine, Environment.NewLine, "[*LINK*]", Environment.NewLine, Environment.NewLine, "<|LINKASSINATURA|>", Environment.NewLine, Environment.NewLine, "Para mais informações entre contato conosco pelo ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - Label0: - return string.Concat(new string[] { "Prezado(a), segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s).", Environment.NewLine, Environment.NewLine, "[*LINK*]", Environment.NewLine, Environment.NewLine, " Para mais informações entre contato conosco pelo ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - } - - public async Task CreateLink(IndiceArquivoDigital indice) - { - DateTime networkTime = Funcoes.GetNetworkTime(); - string str = string.Format("{0}:{1}:F:{2}", networkTime.Ticks, ApplicationHelper.IdFornecedor, indice.get_Id()).Base64Encode(); - return Recursos.ApiArquivo.AddQuery("search", str); - } - - 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 x) => x.get_Descricao() == arquivo.get_Descricao()); - this.ArquivosAnexados.Remove(arquivoDigital); - this.ArquivosAnexados = new ObservableCollection(this.ArquivosAnexados); - } - - public async void Editar(IndiceArquivoDigital arquivo) - { - if (arquivo != null && arquivo.get_IdArquivoDigital() != 0) - { - await this.ArquivoDigitalServico.Save(arquivo); - } - } - - public async Task EnviarParaAssinatura() - { - bool flag; - object obj; - ObservableCollection arquivosTela = this.ArquivosTela; - if (!arquivosTela.Any((IndiceArquivoDigital x) => x.get_Assinar())) - { - await base.ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIAR PARA ASSINATURA.", "OK", "", false); - flag = false; - } - else if (!await base.ShowMessage("DESEJA ENVIAR OS ARQUIVOS SELECIONADOS PARA ASSINATURA ELETRÔNICA DO SEGURADO?", "SIM", "NÃO", false)) - { - flag = false; - } - else if (!this.Email.EndsWith(";")) - { - base.Loading(true); - this._assinadorKey = await AssinadorHelper.Key(); - int num = await AssinadorHelper.Licencas(this._assinadorKey); - int num1 = num; - ObservableCollection arquivos = this.Arquivos; - if (num1 >= arquivos.Count((IndiceArquivoDigital x) => { - if (!x.get_Assinar()) - { - return false; - } - return !x.get_EnviadoAssinatura(); - })) - { - AssinadorHelper.Parametros = await AssinaturaServico.BuscarParametrosAssinatura(Recursos.Usuario.get_IdEmpresa()); - int num2 = 0; - ObservableCollection observableCollection = this.ArquivosTela; - int num3 = ( - from x in observableCollection - where x.get_Assinar() - select x).Count(); - ObservableCollection arquivosTela1 = this.ArquivosTela; - foreach (IndiceArquivoDigital indiceArquivoDigital in - from x in arquivosTela1 - where x.get_Assinar() - select x) - { - if (indiceArquivoDigital.get_Assinado()) - { - continue; - } - if (!indiceArquivoDigital.get_EnviadoAssinatura()) - { - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador = await this.Assinar(indiceArquivoDigital, false); - if (arquivoParaAssinaturaAssinador == null) - { - continue; - } - num--; - indiceArquivoDigital.set_EnviadoAssinatura(true); - indiceArquivoDigital.set_UrlAssinatura(arquivoParaAssinaturaAssinador.get_UrlAssinatura()); - num2++; - indiceArquivoDigital = null; - } - else - { - await (new AssinaturaServico()).Reenviar(indiceArquivoDigital.get_Id()); - } - } - base.Loading(false); - this.Arquivos = new ObservableCollection(this.Arquivos); - await base.ShowMessage(string.Format("{0} DE {1} ARQUIVOS FORAM ENVIADOS PARA ASSINATURA. VOCÊ SERÁ NOTIFICADO QUANDO OS DOCUMENTOS FOREM ASSINADOS", num2, num3), "OK", "", false); - flag = true; - } - else if (base.Restricao(113)) - { - await base.ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS E O USUÁRIO NÃO PODE CONTRATAR, ENTRE EM CONTATO COM O ADMINISTRADOR DO SISTEMA.", "OK", "", false); - base.Loading(false); - flag = false; - } - else if (await base.ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS, DESEJA CONTRATAR MAIS?", "SIM", "NÃO", false)) - { - Token token = new Token(); - object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Id(), null }; - obj = (ApplicationHelper.Beta ? "1" : "0"); - numeroSerial[3] = obj; - string str = token.Encrypt(string.Format("{0}:{1}:{2}:{3}", numeroSerial)); - Parameters parameter = new Parameters(); - parameter.set_Beta(ApplicationHelper.Beta); - parameter.set_Type(8); - parameter.set_Application("Assinador.Application.exe"); - parameter.set_Directory("Assinador.Application"); - parameter.set_Arguments(str); - parameter.set_Run(true); - (new DownloadWindow(parameter)).Show(); - base.Loading(false); - flag = false; - } - else - { - base.Loading(false); - flag = false; - } - } - else - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO", "OK", "", false); - flag = false; - } - return flag; - } - - public async Task Excluir(IndiceArquivoDigital arquivo) - { - if (arquivo != null && arquivo.get_IdArquivoDigital() != 0) - { - if (await this.ArquivoDigitalServico.DeleteAttachment(arquivo)) - { - await this.CarregaArquivos(); - } - } - } - - public void LimparAnexos() - { - this.ArquivosAnexados = new ObservableCollection(); - } - - public async Task PrepararEnvio() - { - MalaDireta malaDiretum; - Item item; - string str; - Item item1; - string str1; - MalaDireta malaDiretum1; - Gestor.Model.Domain.Seguros.Documento parente; - Parcela parcela; - ObservableCollection arquivos = this.Arquivos; - if (arquivos.Any((IndiceArquivoDigital x) => x.get_Selecionado())) - { - MalaDireta malaDiretum2 = new MalaDireta(); - malaDiretum2.set_Cliente(this.SelectedCliente); - ObservableCollection observableCollection = this.Arquivos; - malaDiretum2.set_ArquivoDigital(( - from x in observableCollection - where x.get_Selecionado() - select x).ToList()); - malaDiretum1 = malaDiretum2; - TipoArquivoDigital tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 2: - { - parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - List items = await base.CarregarItem(parente.get_Controle().get_Id(), 0); - MalaDireta malaDiretum3 = malaDiretum1; - if (items.Count > 1) - { - item = new Item(); - item.set_Id((long)0); - item.set_Descricao("APÓLICE COLETIVA"); - } - else - { - item = items.FirstOrDefault(); - } - malaDiretum3.set_Item(item); - malaDiretum1.set_Apolice(parente); - ArquivoDigitalViewModel arquivoDigitalViewModel = this; - str = (parente.get_Apolice() != string.Empty ? string.Concat("DOCUMENTOS REFERENTES A APÓLICE ", parente.get_Apolice()) : string.Concat("DOCUMENTOS REFERENTES A PROPOSTA ", parente.get_Proposta())); - arquivoDigitalViewModel.Assunto = str; - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU SEGURO."); - malaDiretum1.set_Tela(2); - break; - } - case 3: - { - parcela = (Parcela)this.Filtro.get_Parente(); - malaDiretum1.set_Apolice(parcela.get_Documento()); - malaDiretum1.set_Parcela(parcela); - List items1 = await base.CarregarItem(parcela.get_Documento().get_Controle().get_Id(), 0); - MalaDireta malaDiretum4 = malaDiretum1; - if (items1.Count > 1) - { - item1 = new Item(); - item1.set_Id((long)0); - item1.set_Descricao("APÓLICE COLETIVA"); - } - else - { - item1 = items1.FirstOrDefault(); - } - malaDiretum4.set_Item(item1); - ArquivoDigitalViewModel arquivoDigitalViewModel1 = this; - str1 = (parcela.get_Documento().get_Apolice() != string.Empty ? string.Format("DOCUMENTOS REFERENTE A PARCELA {0} DA APÓLICE {1}", parcela.get_NumeroParcela(), parcela.get_Documento().get_Apolice()) : string.Format("DOCUMENTOS REFERENTE A PARCELA {0} DA PROPOSTA {1}", parcela.get_NumeroParcela(), parcela.get_Documento().get_Proposta())); - arquivoDigitalViewModel1.Assunto = str1; - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AS PARCELAS DE SEU SEGURO."); - malaDiretum1.set_Tela(5); - break; - } - case 4: - { - Item parente1 = (Item)this.Filtro.get_Parente(); - malaDiretum1.set_Apolice(parente1.get_Documento()); - malaDiretum1.set_Item(parente1); - this.Assunto = string.Concat("DOCUMENTOS REFERENTES AO ITEM ", parente1.get_Descricao()); - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU BEM."); - malaDiretum1.set_Tela(3); - break; - } - case 5: - { - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - malaDiretum1.set_Sinistro(sinistro); - malaDiretum1.set_Item(sinistro.get_ControleSinistro().get_Item()); - malaDiretum1.set_Apolice(sinistro.get_ControleSinistro().get_Item().get_Documento()); - this.Titulo = string.Concat("DOCUMENTOS REFERENTES AO SINITRO ", sinistro.get_Numero()); - string[] nome = new string[] { "PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES SINISTRO DO ITEM ", sinistro.get_ControleSinistro().get_Item().get_Descricao(), "." }; - this.Corpo = string.Concat(nome); - malaDiretum1.set_Tela(7); - break; - } - default: - { - if (tipo == 11) - { - Prospeccao prospeccao = (Prospeccao)this.Filtro.get_Parente(); - malaDiretum1.set_Prospeccao(prospeccao); - malaDiretum1.get_Cliente().set_Id((long)0); - this.Assunto = string.Concat("DOCUMENTOS REFERENTES PROSPECÇÃO ", prospeccao.get_Nome()); - this.Corpo = ""; - malaDiretum1.set_Tela(33); - break; - } - else - { - this.SelectedCliente = (Cliente)this.Filtro.get_Parente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO CLIENTE \"", this.SelectedCliente.get_Nome(), "\""); - break; - } - } - } - parente = null; - parcela = null; - malaDiretum = malaDiretum1; - } - else - { - await base.ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIO.", "OK", "", false); - malaDiretum = null; - } - malaDiretum1 = null; - return malaDiretum; - } - - public async Task SalvarAnexos() - { - if (this.ArquivosAnexados != null && this.ArquivosAnexados.Count != 0) - { - this.Carregando = true; - List list = this.ArquivosAnexados.ToList(); - if (await base.SalvarAttachments(list, this.Filtro.get_Tipo(), this.Filtro.get_Id())) - { - await this.CarregaArquivos(); - this.ArquivosAnexados = new ObservableCollection(); - this.Carregando = false; - } - else - { - this.Carregando = false; - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3