using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using Gestor.Application.Helpers; using Gestor.Application.Servicos; using Gestor.Application.Servicos.Seguros; using Gestor.Application.ViewModels.Generic; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Configuracoes; using Gestor.Model.Domain.Ferramentas; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Seguros; using Gestor.Model.Helper; namespace Gestor.Application.ViewModels.Drawer; public class TarefaDrawerViewModel : BaseTarefaViewModel { private bool _enableMenu = true; private GridLength _dados = new GridLength(0.0, (GridUnitType)1); private GridLength _grid = new GridLength(1.0, (GridUnitType)2); private GridLength _anotacoesLength = new GridLength(0.0, (GridUnitType)1); private GridLength _descricaoLength = new GridLength(1.0, (GridUnitType)2); private GridLength _anotacoesInternasLength = new GridLength(0.0, (GridUnitType)1); private GridLength _descricaoInternaLength = new GridLength(1.0, (GridUnitType)2); private bool _enableAlterarTarefa = true; private Visibility _visibilityMenu; private bool _isVisibleDescricao; private bool _isSelected; private bool _concluido; private bool _carregando; private string _tituloTarefas; private string _titulo; private string _subTitulo; private Tarefa _tarefa = new Tarefa(); private ObservableCollection _tarefasFiltradas = new ObservableCollection(); private List _tarefas = new List(); private bool _isAnotacoes = true; private Tarefa _selectedTarefa; private ObservableCollection _usuarios; private ObservableCollection _tiposTarefa; private List _telefones; private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); private Usuario _selectedUsuario; private TipoDeTarefa _selectedTipoTarefa; private ArquivoDigital _selectedAnexado = new ArquivoDigital(); private ObservableCollection _arquivosAnexados = new ObservableCollection(); private List _arquivosFinais = new List(); private bool _inclusaoArquivoDigitalEnable = true; private new TarefaServico Servico { get; } public GridLength Dados { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _dados; } 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) _dados = value; OnPropertyChanged("Dados"); } } public GridLength Grid { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _grid; } 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) _grid = value; OnPropertyChanged("Grid"); } } public GridLength AnotacoesLength { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _anotacoesLength; } 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) _anotacoesLength = value; OnPropertyChanged("AnotacoesLength"); } } public GridLength DescricaoLength { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _descricaoLength; } 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) _descricaoLength = value; OnPropertyChanged("DescricaoLength"); } } public GridLength AnotacoesInternasLength { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _anotacoesInternasLength; } 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) _anotacoesInternasLength = value; OnPropertyChanged("AnotacoesInternasLength"); } } public GridLength DescricaoInternaLength { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _descricaoInternaLength; } 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) _descricaoInternaLength = value; OnPropertyChanged("DescricaoInternaLength"); } } public override bool EnableAlterarTarefa { get { return _enableAlterarTarefa; } set { _enableAlterarTarefa = _alterarPermissEnabled && value; OnPropertyChanged("EnableAlterarTarefa"); } } public long IdCliente { get; set; } private int Index { get; set; } = 1; public Visibility VisibilityMenu { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _visibilityMenu; } 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) _visibilityMenu = value; OnPropertyChanged("VisibilityMenu"); } } public bool IsVisibleDescricao { get { return _isVisibleDescricao; } set { _isVisibleDescricao = value; OnPropertyChanged("IsVisibleDescricao"); } } public bool IsSelected { get { return _isSelected; } set { _isSelected = value; OnPropertyChanged("IsSelected"); } } public bool Concluido { get { return _concluido; } set { _concluido = value; OnPropertyChanged("Concluido"); } } public bool Carregando { get { return _carregando; } set { _carregando = value; base.IsEnabled = !value; OnPropertyChanged("Carregando"); } } public string TituloTarefas { get { return _tituloTarefas; } set { _tituloTarefas = value; OnPropertyChanged("TituloTarefas"); } } public string Titulo { get { return _titulo; } set { _titulo = value; OnPropertyChanged("Titulo"); } } public string SubTitulo { get { return _subTitulo; } set { _subTitulo = value; OnPropertyChanged("SubTitulo"); } } public Tarefa Tarefa { get { return _tarefa; } set { _tarefa = value; OnPropertyChanged("Tarefa"); } } public ObservableCollection TarefasFiltradas { get { return _tarefasFiltradas; } set { _tarefasFiltradas = value; OnPropertyChanged("TarefasFiltradas"); } } public List Tarefas { get { return _tarefas; } set { _tarefas = value; OnPropertyChanged("Tarefas"); } } public bool IsAnotacoes { get { return _isAnotacoes; } set { _isAnotacoes = value; OnPropertyChanged("IsAnotacoes"); } } public override Tarefa SelectedTarefa { get { return _selectedTarefa; } set { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) DateTime networkTime = Funcoes.GetNetworkTime(); IsSelected = value != null; _selectedTarefa = value; Tarefa obj = value; DataAgendamento = ((obj != null) ? obj.Agendamento : networkTime); Tarefa obj2 = value; HoraAgendamento = ((obj2 != null) ? obj2.Agendamento : networkTime); IsVisibleDescricao = value != null; Tarefa obj3 = value; Concluido = obj3 != null && (int)obj3.Status == 2; base.Responsaveis = ((value == null) ? new ObservableCollection() : ((value.Responsaveis == null) ? new ObservableCollection() : new ObservableCollection(value.Responsaveis))); if (!base.Responsaveis.Any()) { Tarefa obj4 = value; base.Responsaveis = ((((obj4 != null) ? obj4.Usuario : null) == null) ? new ObservableCollection() : new ObservableCollection((IEnumerable)(object)new ResponsavelTarefa[1] { new ResponsavelTarefa { Usuario = value.Usuario } })); } if (value != null && ((DomainBase)value).Id > 0) { AlterarTamanho(alterar: false); } if (value != null) { AnotacoesLength = new GridLength(0.0, (GridUnitType)1); AnotacoesInternasLength = new GridLength(0.0, (GridUnitType)1); DescricaoLength = (string.IsNullOrWhiteSpace(value.Descricao) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); DescricaoInternaLength = (string.IsNullOrWhiteSpace(value.DescricaoInterna) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); } Tarefa obj5 = value; if (((obj5 != null) ? obj5.TipoDeTarefa : null) != null) { if (TiposTarefa.All((TipoDeTarefa x) => ((DomainBase)x).Id != ((DomainBase)value).Id) && !value.TipoDeTarefa.Ativo) { TiposTarefa.Add(value.TipoDeTarefa); } else { TiposTarefa = new ObservableCollection(TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); } } Tarefa obj6 = value; SelectedTipoTarefa = ((obj6 != null) ? obj6.TipoDeTarefa : null); if (base.EnableIncluir || base.EnableFields || base.EnableButtons) { Tarefa obj7 = value; VerificarEnables((obj7 != null) ? new long?(((DomainBase)obj7).Id) : null); } ValidaPermissaoParaEditarTarefa(); OnPropertyChanged("SelectedTarefa"); } } public ObservableCollection Usuarios { get { return _usuarios; } set { _usuarios = value; OnPropertyChanged("Usuarios"); } } public ObservableCollection TiposTarefa { get { return _tiposTarefa; } set { _tiposTarefa = value; OnPropertyChanged("TiposTarefa"); } } public List Telefones { get { return _telefones; } set { _telefones = value; OnPropertyChanged("Telefones"); } } public DateTime DataAgendamento { get { return _dataAgendamento; } set { _dataAgendamento = value; if (SelectedTarefa != null) { SelectedTarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedTarefa.Agendamento:T}"); } OnPropertyChanged("DataAgendamento"); } } public DateTime HoraAgendamento { get { return _horaAgendamento; } set { _horaAgendamento = value; if (SelectedTarefa != null) { SelectedTarefa.Agendamento = DateTime.Parse($"{SelectedTarefa.Agendamento:d} {value:T}"); } OnPropertyChanged("HoraAgendamento"); } } public Usuario SelectedUsuario { get { return _selectedUsuario; } set { _selectedUsuario = value; OnPropertyChanged("SelectedUsuario"); } } public TipoDeTarefa SelectedTipoTarefa { get { return _selectedTipoTarefa; } set { _selectedTipoTarefa = value; OnPropertyChanged("SelectedTipoTarefa"); } } public ArquivoDigital SelectedAnexado { get { return _selectedAnexado; } set { _selectedAnexado = value; OnPropertyChanged("SelectedAnexado"); } } public ObservableCollection ArquivosAnexados { get { return _arquivosAnexados; } set { _arquivosAnexados = value; OnPropertyChanged("ArquivosAnexados"); } } public List ArquivosFinais { get { return _arquivosFinais; } set { _arquivosFinais = value; OnPropertyChanged("ArquivosFinais"); } } public bool InclusaoArquivoDigitalEnable { get { return _inclusaoArquivoDigitalEnable; } set { _inclusaoArquivoDigitalEnable = value; OnPropertyChanged("InclusaoArquivoDigitalEnable"); } } public TarefaDrawerViewModel(Tarefa tarefa, bool enableMenu) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown Servico = new TarefaServico(); Tarefa = tarefa; _enableMenu = enableMenu; CarregarUsuarios(); TiposTarefa = new ObservableCollection(Recursos.TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); SelecionarTarefas(tarefa, tarefa.Conclusao.HasValue); TituloTarefas = (tarefa.Conclusao.HasValue ? "TAREFAS CONCLUÍDAS" : "TAREFAS PENDENTES"); base.EnableMenu = true; } private void CarregarUsuarios() { Usuarios = new ObservableCollection((from x in Recursos.Usuarios where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido && x.PermissaoAggilizador != 4 orderby x.Nome select x).ToList()); } public async void SelecionarTarefas(Tarefa tarefa, bool? concluido) { await PermissaoTela((TipoTela)38); CarregarInformacoes(tarefa); await CarregarTarefas(tarefa, concluido); if (((DomainBase)tarefa).Id != 0L && !_enableMenu) { VisibilityMenu = (Visibility)2; } } public async void CarregarInformacoes(Tarefa tarefa) { ClienteServico clienteServico = new ClienteServico(); SubTitulo = ((tarefa.IdEntidade != 0L) ? "TODAS AS TAREFAS PENDENTES DO CLIENTE" : ""); IdCliente = tarefa.IdCliente; Titulo = tarefa.Cliente; Telefones = (await clienteServico.BuscarTelefonesAsync(tarefa.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase { Tipo = ((TelefoneBase)x).Tipo, Id = ((DomainBase)x).Id, Numero = ((TelefoneBase)x).Numero, Prefixo = ((TelefoneBase)x).Prefixo })).ToList(); if (tarefa.IdEntidade == 0L) { return; } TipoTarefa entidade = tarefa.Entidade; if ((int)entidade != 0) { if ((int)entidade != 4) { return; } Sinistro val = await new SinistroServico().BuscarSinistro(tarefa.IdEntidade); if (val != null) { IdCliente = ((DomainBase)val.ControleSinistro.Item.Documento.Controle.Cliente).Id; Titulo = val.ControleSinistro.Item.Documento.Controle.Cliente.Nome; SubTitulo = "SINISTRO " + val.Numero + " ITEM " + val.ItemSinistrado; Telefones = (await clienteServico.BuscarTelefonesAsync(IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase { Tipo = ((TelefoneBase)x).Tipo, Id = ((DomainBase)x).Id, Numero = ((TelefoneBase)x).Numero, Prefixo = ((TelefoneBase)x).Prefixo })).ToList(); } } else { Documento val2 = await new ApoliceServico().BuscarApoliceAsync(tarefa.IdEntidade); IdCliente = ((DomainBase)val2.Controle.Cliente).Id; Titulo = val2.Controle.Cliente.Nome; SubTitulo = ((val2.Tipo == 0 && !string.IsNullOrWhiteSpace(val2.Apolice)) ? ("APÓLICE NÚMERO " + val2.Apolice) : ((val2.Tipo > 0) ? ("APÓLICE NÚMERO " + val2.Apolice + " ENDOSSO " + val2.Endosso) : ("PROPOSTA NÚMERO " + val2.Proposta))); Telefones = (await clienteServico.BuscarTelefonesAsync(((DomainBase)val2.Controle.Cliente).Id)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase { Tipo = ((TelefoneBase)x).Tipo, Id = ((DomainBase)x).Id, Numero = ((TelefoneBase)x).Numero, Prefixo = ((TelefoneBase)x).Prefixo })).ToList(); } } public async Task CarregarTarefas(int index) { if (Tarefa.IdEntidade != 0L) { Carregando = true; Tarefa tarefa = new Tarefa { Cliente = Tarefa.Cliente, IdCliente = Tarefa.IdCliente, Entidade = Tarefa.Entidade, IdEntidade = Tarefa.IdEntidade }; Index = index; List source; switch (index) { default: CarregarInformacoes(tarefa); source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, true); break; case 1: CarregarInformacoes(tarefa); source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, false); break; case 2: tarefa.Entidade = (TipoTarefa)2; CarregarInformacoes(tarefa); source = await Servico.BuscarTarefasCliente(Tarefa.IdCliente); break; } Tarefas = source.OrderByDescending((Tarefa x) => x.Agendamento).ToList(); TarefasFiltradas = new ObservableCollection(Tarefas); SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First()))); Carregando = false; } } public async Task CarregarTarefas(Tarefa tarefa, bool? concluido) { Carregando = true; if (tarefa.IdEntidade != 0L) { Tarefas = (await Servico.BuscarTarefas(tarefa.Entidade, tarefa.IdEntidade, concluido)).OrderBy((Tarefa x) => x.Agendamento).ToList(); TarefasFiltradas = new ObservableCollection(Tarefas); SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First()))); } else if (((DomainBase)tarefa).Id > 0) { SelectedTarefa = await Servico.BuscarTarefa(((DomainBase)tarefa).Id); } Carregando = false; } public async Task Incluir() { CarregarUsuarios(); base.Responsaveis = new ObservableCollection(); SelectedTarefa = new Tarefa { IdCliente = IdCliente, Cliente = Titulo, Referencia = SubTitulo, Entidade = Tarefa.Entidade, IdEntidade = Tarefa.IdEntidade, Trilha = Tarefa.Trilha, Status = (StatusTarefa)0, Agendamento = Funcoes.GetNetworkTime().AddHours(1.0), UsuarioCadastro = Recursos.Usuario, Usuario = ((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)), Restrito = false, Responsaveis = base.Responsaveis.ToList() }; ArquivosFinais = new List(); AlterarTamanho(alterar: true); TituloTarefas += " (INCLUINDO)"; Alterar(alterar: true); AnotacoesLength = new GridLength(1.0, (GridUnitType)2); AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2); DescricaoLength = new GridLength(0.0, (GridUnitType)1); DescricaoInternaLength = new GridLength(0.0, (GridUnitType)1); EnableAlterarTarefa = false; } public void AlterarTamanho(bool alterar) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!alterar) { if (TituloTarefas.Contains("TODAS")) { TituloTarefas = "TODAS TAREFAS DO CLIENTE"; } else if (TituloTarefas.Contains("PENDENTES")) { TituloTarefas = "TAREFAS PENDENTES"; } else if (TituloTarefas.Contains("CONCLUÍDAS")) { TituloTarefas = "TAREFAS CONCLUÍDAS"; } } Grid = (alterar ? new GridLength(0.0, (GridUnitType)2) : new GridLength(1.0, (GridUnitType)2)); Dados = (alterar ? new GridLength(1.0, (GridUnitType)2) : new GridLength(360.0, (GridUnitType)1)); } public async Task>> Salvar(string anotacoes, string anotacoesInternas) { DateTime networkTime = Funcoes.GetNetworkTime(); if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 45) && (int)SelectedTarefa.Status != 2 && SelectedTarefa.Agendamento < networkTime) { SelectedTarefa.Agendamento = networkTime; } if ((int)SelectedTarefa.Status == 2) { SelectedTarefa.Conclusao = networkTime; } if ((int)SelectedTarefa.Status == 0) { SelectedTarefa.Conclusao = null; } SelectedTarefa.Responsaveis = base.Responsaveis.ToList(); Tarefa selectedTarefa = SelectedTarefa; ResponsavelTarefa? obj = base.Responsaveis.FirstOrDefault(); selectedTarefa.Usuario = ((obj != null) ? obj.Usuario : null); SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); List> list = SelectedTarefa.Validate(); if (SelectedTarefa.Descricao == null && string.IsNullOrWhiteSpace(anotacoes) && string.IsNullOrWhiteSpace(anotacoesInternas)) { list.Add(new KeyValuePair("ANOTAÇÕES", "OBRIGATÓRIO")); } if (list.Count > 0) { return list; } if (!string.IsNullOrWhiteSpace(anotacoes)) { SelectedTarefa.Anotacoes = Funcoes.AdicionarLog(SelectedTarefa.Anotacoes); SelectedTarefa.Descricao = SelectedTarefa.Anotacoes + "

" + SelectedTarefa.Descricao + "

"; } if (!string.IsNullOrWhiteSpace(anotacoesInternas)) { SelectedTarefa.AnotacoesInternas = Funcoes.AdicionarLog(SelectedTarefa.AnotacoesInternas); SelectedTarefa.DescricaoInterna = SelectedTarefa.AnotacoesInternas + "

" + SelectedTarefa.DescricaoInterna + "

"; } SelectedTarefa.TipoDeTarefa = SelectedTipoTarefa; bool inclusao = ((DomainBase)SelectedTarefa).Id == 0; SelectedTarefa = await Servico.Salvar(SelectedTarefa); string text = (inclusao ? "INCLUIU" : "ALTEROU"); RegistrarAcao(text + " TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}"); if (inclusao) { foreach (ArquivoDigital arquivosFinai in ArquivosFinais) { arquivosFinai.IdTarefa = ((DomainBase)SelectedTarefa).Id; } await ArquivoDigitalServico.Insert(ArquivosFinais); } if (!Servico.Sucesso) { return null; } long id = ((DomainBase)SelectedTarefa).Id; await CarregarTarefas(Index); SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)); return null; } public void AlterarTarefa() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) CarregarUsuarios(); if (SelectedTarefa != null) { EnableAlterarTarefa = false; AlterarTamanho(alterar: true); TituloTarefas = TituloTarefas + " (ALTERANDO \"" + SelectedTarefa.Titulo + "\")"; Alterar(alterar: true); AnotacoesLength = new GridLength(1.0, (GridUnitType)2); AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2); Tarefa selectedTarefa = SelectedTarefa; DescricaoLength = (string.IsNullOrWhiteSpace((selectedTarefa != null) ? selectedTarefa.Descricao : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); Tarefa selectedTarefa2 = SelectedTarefa; DescricaoInternaLength = (string.IsNullOrWhiteSpace((selectedTarefa2 != null) ? selectedTarefa2.DescricaoInterna : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); TarefasFiltradas = new ObservableCollection { SelectedTarefa }; ListaUsuariosResponsaveis(); base.Responsaveis.ToList().ForEach(delegate(ResponsavelTarefa x) { Usuarios.Remove(x.Usuario); }); } } public async Task Cancelar() { CarregarUsuarios(); AlterarTamanho(alterar: false); Tarefa selectedTarefa = SelectedTarefa; long id = ((selectedTarefa != null) ? ((DomainBase)selectedTarefa).Id : 0); await CarregarTarefas(Index); Alterar(alterar: false); await ValidaPermissaoParaEditarTarefa(); if (id != 0L) { SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)); } } public async Task Excluir(Tarefa item) { if ((int)VisibilityMenu == 2) { await ShowMessage("NÃO É POSSÍVEL EXCLUIR TAREFA PELO RELATÓRIO!"); return false; } if (!(await ShowMessage("DESEJA REALMENTE EXCLUIR A TAREFA " + item.Titulo + "?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL", "SIM", "NÃO"))) { return false; } string titulo = item.Titulo; long id = ((DomainBase)item).Id; if (!(await Servico.Excluir(((DomainBase)item).Id))) { Alterar(alterar: false); return true; } RegistrarAcao("EXCLUIU TAREFA", ((DomainBase)item).Id, (TipoTela)38, $"TAREFA \"{titulo}\", ID: {id}"); await CarregarTarefas(Index); Alterar(alterar: false); return true; } public void AdcionarResponsavel() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if (SelectedUsuario != null) { base.Responsaveis.Add(new ResponsavelTarefa { Usuario = SelectedUsuario, IdTarefa = ((DomainBase)SelectedTarefa).Id }); Usuarios.Remove(SelectedUsuario); SelectedUsuario = null; } } public async void Editar(IndiceArquivoDigital arquivo) { if (arquivo != null && arquivo.IdArquivoDigital != 0L) { await ArquivoDigitalServico.Save(arquivo); } } 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); } } public async void Anexar() { InclusaoArquivoDigitalEnable = false; List arquivos = await AddAttachments(ArquivosAnexados.ToList(), new List()); await Task.Run(async delegate { await Task.Delay(200); InclusaoArquivoDigitalEnable = true; }); if (arquivos != null) { arquivos.AddRange(ArquivosAnexados); ArquivosAnexados = new ObservableCollection(arquivos); } } public void SalvarAnexos() { ArquivosFinais = ArquivosAnexados.ToList(); } public void LimparAnexos() { ArquivosAnexados = new ObservableCollection(); } public void Print() { string value = GerarHtml(); string tempPath = Path.GetTempPath(); string text = $"{tempPath}{(object)(TipoTela)38}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); streamWriter.Write(value); streamWriter.Close(); Process.Start(text); RegistrarAcao("IMPRIMIU A TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}"); } public string GerarHtml() { //IL_0205: Unknown result type (might be due to invalid IL or missing references) string text = " TAREFA
"; text += "
"; text += "

"; text += "TAREFA


"; text += ""; int num = 0; text = text + ""; text = text + ""; text = text + ""; text = text + ""; text = text + ""; text = text + ""; string[] obj = new string[6] { text, ""; text = string.Concat(obj); text += "

CLIENTE: " + SelectedTarefa.Cliente + "

REFERÊNCIA: " + SelectedTarefa.Referencia + "

TÍTULO: " + SelectedTarefa.Titulo + "

AGENDAMENTO: " + SelectedTarefa.Agendamento.ToString() + "

RESPONSÁVEL PRINCIPAL: " + SelectedTarefa.Usuario.Nome + "

STATUS: " + ValidationHelper.GetDescription((Enum)(object)SelectedTarefa.Status) + "

TIPO DE TAREFA: ", null, null }; TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa; obj[4] = ((selectedTipoTarefa != null) ? selectedTipoTarefa.Nome : null); obj[5] = "

"; if (base.Responsaveis != null && base.Responsaveis.Count > 0) { text += "

RESPONSÁVEIS VINCULADOS

"; text += "
"; text += ""; List list = new List(); foreach (ResponsavelTarefa responsavei in base.Responsaveis) { list.Add(responsavei.Usuario.Nome.Trim().ToUpper()); } text = text + ""; text += "

" + string.Join(", ", list) + "

"; text += "

"; } text += "

"; if (SelectedTarefa.Descricao != null) { text += "

ANOTAÇÕES

"; text += "
"; text += ""; text = text + ""; text += "

" + SelectedTarefa.Descricao.Replace("", "").Replace("", "") + "

"; text += "

"; } return text + "
"; } }