diff options
Diffstat (limited to 'Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs')
| -rw-r--r-- | Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs | 1453 |
1 files changed, 0 insertions, 1453 deletions
diff --git a/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs b/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs deleted file mode 100644 index 33d1096..0000000 --- a/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs +++ /dev/null @@ -1,1453 +0,0 @@ -using Gestor.Application.Actions;
-using Gestor.Application.Drawers;
-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.Generic;
-using Gestor.Application.Views.Seguros;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.MalaDireta;
-using Gestor.Model.Domain.Seguros;
-using Gestor.Model.Helper;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace Gestor.Application.ViewModels.BI
-{
- public class TarefaBIViewModel : BaseTarefaViewModel
- {
- private bool _enableAlterarTarefa = true;
-
- private bool _administrador;
-
- private DateTime _inicio;
-
- private DateTime _fim;
-
- private List<string> _status;
-
- private string _selectedStatus;
-
- private Visibility _isVisibleCliente;
-
- private Visibility _isVisibleApolice;
-
- private Visibility _isVisibleArquivoDigital;
-
- private Visibility _isVisibleSinistro;
-
- private ObservableCollection<Usuario> _usuariosFiltro;
-
- private ObservableCollection<Usuario> _usuarios;
-
- private ObservableCollection<TipoDeTarefa> _tiposTarefa;
-
- private TipoDeTarefa _selectedTipoTarefa;
-
- private Usuario _selectedUsuarioFiltro;
-
- private Usuario _selectedUsuario;
-
- private DateTime _dataAgendamento;
-
- private DateTime _horaAgendamento;
-
- private bool _isAnotacoes;
-
- private string _descricao;
-
- private string _historicoInterno;
-
- private ObservableCollection<Tarefa> _tarefas;
-
- private Tarefa _selectedTarefa;
-
- private ObservableCollection<TelefoneBase> _telefones;
-
- private long _cancelTarefa;
-
- private ObservableCollection<Tarefa> _tarefasFiltradas;
-
- private string _filtro;
-
- private ObservableCollection<string> _filtroTarefa;
-
- private GridLength _columnUsuarioPrincipal;
-
- private GridLength _columnUsuarios;
-
- public bool Administrador
- {
- get
- {
- return this._administrador;
- }
- set
- {
- this._administrador = value;
- base.OnPropertyChanged("Administrador");
- }
- }
-
- private Gestor.Application.Servicos.Seguros.ClienteServico ClienteServico
- {
- get;
- }
-
- public GridLength ColumnUsuarioPrincipal
- {
- get
- {
- return this._columnUsuarioPrincipal;
- }
- set
- {
- this._columnUsuarioPrincipal = value;
- base.OnPropertyChanged("ColumnUsuarioPrincipal");
- }
- }
-
- public GridLength ColumnUsuarios
- {
- get
- {
- return this._columnUsuarios;
- }
- set
- {
- this._columnUsuarios = value;
- base.OnPropertyChanged("ColumnUsuarios");
- }
- }
-
- public DateTime DataAgendamento
- {
- get
- {
- return this._dataAgendamento;
- }
- set
- {
- this._dataAgendamento = value;
- if (this.SelectedTarefa != null)
- {
- this.SelectedTarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", value, this.SelectedTarefa.get_Agendamento())));
- }
- base.OnPropertyChanged("DataAgendamento");
- }
- }
-
- public string Descricao
- {
- get
- {
- return this._descricao;
- }
- set
- {
- this._descricao = value;
- base.OnPropertyChanged("Descricao");
- }
- }
-
- public override bool EnableAlterarTarefa
- {
- get
- {
- return this._enableAlterarTarefa;
- }
- set
- {
- this._enableAlterarTarefa = this._alterarPermissEnabled & value;
- base.OnPropertyChanged("EnableAlterarTarefa");
- }
- }
-
- public string Filtro
- {
- get
- {
- return this._filtro;
- }
- set
- {
- this._filtro = value;
- base.OnPropertyChanged("Filtro");
- }
- }
-
- public ObservableCollection<string> FiltroTarefa
- {
- get
- {
- return this._filtroTarefa;
- }
- set
- {
- this._filtroTarefa = value;
- base.OnPropertyChanged("FiltroTarefa");
- }
- }
-
- public DateTime Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Fim");
- }
- }
-
- public string HistoricoInterno
- {
- get
- {
- return this._historicoInterno;
- }
- set
- {
- this._historicoInterno = value;
- base.OnPropertyChanged("HistoricoInterno");
- }
- }
-
- public DateTime HoraAgendamento
- {
- get
- {
- return this._horaAgendamento;
- }
- set
- {
- this._horaAgendamento = value;
- if (this.SelectedTarefa != null)
- {
- this.SelectedTarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", this.SelectedTarefa.get_Agendamento(), value)));
- }
- base.OnPropertyChanged("HoraAgendamento");
- }
- }
-
- public DateTime Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public bool IsAnotacoes
- {
- get
- {
- return this._isAnotacoes;
- }
- set
- {
- this._isAnotacoes = value;
- base.OnPropertyChanged("IsAnotacoes");
- }
- }
-
- public Visibility IsVisibleApolice
- {
- get
- {
- return this._isVisibleApolice;
- }
- set
- {
- this._isVisibleApolice = value;
- base.OnPropertyChanged("IsVisibleApolice");
- }
- }
-
- public Visibility IsVisibleArquivoDigital
- {
- get
- {
- return this._isVisibleArquivoDigital;
- }
- set
- {
- this._isVisibleArquivoDigital = value;
- base.OnPropertyChanged("IsVisibleArquivoDigital");
- }
- }
-
- public Visibility IsVisibleCliente
- {
- get
- {
- return this._isVisibleCliente;
- }
- set
- {
- this._isVisibleCliente = value;
- base.OnPropertyChanged("IsVisibleCliente");
- }
- }
-
- public Visibility IsVisibleSinistro
- {
- get
- {
- return this._isVisibleSinistro;
- }
- set
- {
- this._isVisibleSinistro = value;
- base.OnPropertyChanged("IsVisibleSinistro");
- }
- }
-
- public string SelectedStatus
- {
- get
- {
- return this._selectedStatus;
- }
- set
- {
- this._selectedStatus = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("SelectedStatus");
- }
- }
-
- public override Tarefa SelectedTarefa
- {
- get
- {
- return this._selectedTarefa;
- }
- set
- {
- long? nullable;
- this._cancelTarefa = (value != null ? value.get_Id() : (long)0);
- this.WorkOnSelectedTarefa(value);
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- this._selectedTarefa = value;
- base.ValidaPermissaoParaEditarTarefa();
- base.OnPropertyChanged("SelectedTarefa");
- }
- }
-
- public TipoDeTarefa SelectedTipoTarefa
- {
- get
- {
- return this._selectedTipoTarefa;
- }
- set
- {
- this._selectedTipoTarefa = value;
- base.OnPropertyChanged("SelectedTipoTarefa");
- }
- }
-
- public Usuario SelectedUsuario
- {
- get
- {
- return this._selectedUsuario;
- }
- set
- {
- this._selectedUsuario = value;
- base.OnPropertyChanged("SelectedUsuario");
- }
- }
-
- public Usuario SelectedUsuarioFiltro
- {
- get
- {
- return this._selectedUsuarioFiltro;
- }
- set
- {
- this._selectedUsuarioFiltro = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("SelectedUsuarioFiltro");
- }
- }
-
- private new TarefaServico Servico
- {
- get;
- }
-
- public List<string> Status
- {
- get
- {
- return this._status;
- }
- set
- {
- this._status = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Status");
- }
- }
-
- public ObservableCollection<Tarefa> Tarefas
- {
- get
- {
- return this._tarefas;
- }
- set
- {
- this._tarefas = value;
- base.OnPropertyChanged("Tarefas");
- }
- }
-
- public ObservableCollection<Tarefa> TarefasFiltradas
- {
- get
- {
- return this._tarefasFiltradas;
- }
- set
- {
- this._tarefasFiltradas = value;
- base.IsVisible = (value.Count > 0 ? Visibility.Visible : Visibility.Collapsed);
- base.OnPropertyChanged("TarefasFiltradas");
- }
- }
-
- public ObservableCollection<TelefoneBase> Telefones
- {
- get
- {
- return this._telefones;
- }
- set
- {
- this._telefones = value;
- base.OnPropertyChanged("Telefones");
- }
- }
-
- public ObservableCollection<TipoDeTarefa> TiposTarefa
- {
- get
- {
- return this._tiposTarefa;
- }
- set
- {
- this._tiposTarefa = value;
- base.OnPropertyChanged("TiposTarefa");
- }
- }
-
- public ObservableCollection<Usuario> Usuarios
- {
- get
- {
- return this._usuarios;
- }
- set
- {
- this._usuarios = value;
- base.OnPropertyChanged("Usuarios");
- }
- }
-
- public ObservableCollection<Usuario> UsuariosFiltro
- {
- get
- {
- return this._usuariosFiltro;
- }
- set
- {
- this._usuariosFiltro = value;
- base.OnPropertyChanged("UsuariosFiltro");
- }
- }
-
- public TarefaBIViewModel()
- {
- this._enableAlterarTarefa = true;
- DateTime date = Funcoes.GetNetworkTime().Date;
- this._inicio = date.AddDays(-4);
- date = Funcoes.GetNetworkTime().Date;
- this._fim = date.AddDays(4);
- this._status = new List<string>()
- {
- "TODAS AS TAREFAS",
- Gestor.Common.Validation.ValidationHelper.GetDescription((StatusTarefa)0),
- Gestor.Common.Validation.ValidationHelper.GetDescription((StatusTarefa)2)
- };
- this._isVisibleCliente = Visibility.Collapsed;
- this._isVisibleApolice = Visibility.Collapsed;
- this._isVisibleArquivoDigital = Visibility.Collapsed;
- this._isVisibleSinistro = Visibility.Collapsed;
- this._selectedUsuarioFiltro = new Usuario();
- this._selectedUsuario = new Usuario();
- this._dataAgendamento = Funcoes.GetNetworkTime();
- this._horaAgendamento = Funcoes.GetNetworkTime();
- this._isAnotacoes = true;
- this._descricao = "";
- this._historicoInterno = "";
- this._tarefasFiltradas = new ObservableCollection<Tarefa>();
- this._filtro = "";
- this._filtroTarefa = new ObservableCollection<string>();
- this._columnUsuarioPrincipal = new GridLength(1, GridUnitType.Star);
- this._columnUsuarios = new GridLength(0, GridUnitType.Pixel);
- base();
- this.Servico = new TarefaServico();
- this.ClienteServico = new Gestor.Application.Servicos.Seguros.ClienteServico();
- this.Administrador = (Recursos.Usuario.get_Id() == 0 ? true : Recursos.Usuario.get_Administrador());
- this.CarregarUsuarios();
- List<Usuario> list = Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (!Recursos.Configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema c) => c.get_Configuracao() == 36) && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>();
- Usuario usuario = new Usuario();
- usuario.set_Nome("TODOS OS USUÁRIOS");
- usuario.set_Id((long)0);
- list.Insert(0, usuario);
- this.UsuariosFiltro = new ObservableCollection<Usuario>(list);
- this.TiposTarefa = new ObservableCollection<TipoDeTarefa>((
- from x in Recursos.TiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- this.SelectedUsuarioFiltro = this.UsuariosFiltro.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == Recursos.Usuario.get_Id()) ?? this.UsuariosFiltro.FirstOrDefault<Usuario>();
- this.SelectedStatus = this.Status[1];
- this.CarregaTarefas(true);
- }
-
- public async void Abrir(TipoTarefa tipo)
- {
- double? nullable;
- long? nullable1;
- long? nullable2;
- switch (tipo)
- {
- case 0:
- {
- long idEntidade = this.SelectedTarefa.get_IdEntidade();
- if (this.SelectedTarefa.get_Entidade() == 4)
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- if (sinistro != null)
- {
- ControleSinistro controleSinistro = sinistro.get_ControleSinistro();
- if (controleSinistro != null)
- {
- Item item = controleSinistro.get_Item();
- if (item != null)
- {
- Documento documento = item.get_Documento();
- if (documento != null)
- {
- nullable2 = new long?(documento.get_Id());
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- nullable1 = nullable2;
- idEntidade = nullable1.GetValueOrDefault();
- }
- if (idEntidade != 0)
- {
- nullable = null;
- double? nullable3 = nullable;
- nullable = null;
- (new HosterWindow(new ApoliceView(await base.CarregaApolice(idEntidade), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.SelectedTarefa.get_Cliente()), nullable3, nullable, false)).Show();
- goto case 1;
- }
- else
- {
- break;
- }
- }
- case 1:
- {
- break;
- }
- case 2:
- {
- nullable = null;
- double? nullable4 = nullable;
- nullable = null;
- (new HosterWindow(new ClienteView(await base.CarregaCliente(this.SelectedTarefa.get_IdCliente()), true, null), string.Concat("CADASTRO DE CLIENTES - ", this.SelectedTarefa.get_Cliente()), nullable4, nullable, false)).Show();
- goto case 1;
- }
- case 3:
- {
- nullable = null;
- double? nullable5 = nullable;
- nullable = null;
- (new HosterWindow(new ApoliceView(await base.CarregaApoliceParcela(this.SelectedTarefa.get_IdEntidade()), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.SelectedTarefa.get_Cliente(), " - ", this.SelectedTarefa.get_Referencia()), nullable5, nullable, false)).Show();
- goto case 1;
- }
- case 4:
- {
- Sinistro sinistro1 = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- if (sinistro1 != null)
- {
- nullable = null;
- double? nullable6 = nullable;
- nullable = null;
- (new HosterWindow(new SinistroView(sinistro1.get_ControleSinistro().get_Item(), false), string.Concat("CADASTRO DE SINISTROS - ", this.SelectedTarefa.get_Cliente(), " - ", this.SelectedTarefa.get_Referencia()), nullable6, nullable, false)).Show();
- goto case 1;
- }
- else
- {
- await base.ShowMessage("SINISTRO NÃO ENCONTRADO!", "OK", "", false);
- break;
- }
- }
- default:
- {
- goto case 1;
- }
- }
- }
-
- public async void AbrirArquivoDigital()
- {
- FiltroArquivoDigital filtroArquivoDigital;
- if (this.SelectedTarefa.get_IdEntidade() != 0)
- {
- filtroArquivoDigital = new FiltroArquivoDigital();
- switch (this.SelectedTarefa.get_Entidade())
- {
- case 0:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar())
- {
- Documento documento = await base.CarregaApolice(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(documento.get_Id());
- filtroArquivoDigital.set_Tipo(2);
- filtroArquivoDigital.set_Parente(documento);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)2), "."), "OK", "", false);
- break;
- }
- }
- case 1:
- case 6:
- case 7:
- {
- base.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false);
- break;
- }
- case 2:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 1).get_Consultar())
- {
- Cliente cliente = await base.CarregaCliente(this.SelectedTarefa.get_IdCliente());
- filtroArquivoDigital.set_Id(cliente.get_Id());
- filtroArquivoDigital.set_Tipo(1);
- filtroArquivoDigital.set_Parente(cliente);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)1), "."), "OK", "", false);
- break;
- }
- }
- case 3:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 3).get_Consultar())
- {
- Parcela parcela = await base.CarregaParcela(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(parcela.get_Id());
- filtroArquivoDigital.set_Tipo(3);
- filtroArquivoDigital.set_Parente(parcela);
- filtroArquivoDigital.set_IdApolice(parcela.get_Documento().get_Id());
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)3), "."), "OK", "", false);
- break;
- }
- }
- case 4:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 5).get_Consultar())
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(sinistro.get_Id());
- filtroArquivoDigital.set_Tipo(5);
- filtroArquivoDigital.set_Parente(sinistro);
- filtroArquivoDigital.set_IdApolice(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Id());
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)5), "."), "OK", "", false);
- break;
- }
- }
- case 5:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 11).get_Consultar())
- {
- Prospeccao prospeccao = await base.CarregarProspeccao(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(prospeccao.get_Id());
- filtroArquivoDigital.set_Tipo(11);
- filtroArquivoDigital.set_Parente(prospeccao);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)11), "."), "OK", "", false);
- break;
- }
- }
- case 8:
- {
- break;
- }
- default:
- {
- goto case 7;
- }
- }
- }
- filtroArquivoDigital = null;
- }
-
- public void AdcionarFiltro()
- {
- if (string.IsNullOrEmpty(this.Filtro))
- {
- return;
- }
- if (this.FiltroTarefa == null)
- {
- this.FiltroTarefa = new ObservableCollection<string>();
- }
- this.FiltroTarefa.Add(this.Filtro);
- this.Filtro = string.Empty;
- this.FiltrarTarefa();
- }
-
- public async Task AdcionarResponsavel()
- {
- if (!await base.ValidaPermissaoParaEditarTarefa())
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!", "OK", "", false);
- }
- else if (this.SelectedUsuario != null)
- {
- ObservableCollection<ResponsavelTarefa> responsaveis = base.Responsaveis;
- ResponsavelTarefa responsavelTarefa = new ResponsavelTarefa();
- responsavelTarefa.set_Usuario(this.SelectedUsuario);
- responsavelTarefa.set_IdTarefa(this.SelectedTarefa.get_Id());
- responsaveis.Add(responsavelTarefa);
- this.Usuarios.Remove(this.SelectedUsuario);
- this.SelectedUsuario = null;
- }
- }
-
- public async Task AlterarTarefa()
- {
- GridLength gridLength;
- GridLength gridLength1;
- if (this.SelectedTarefa != null)
- {
- if (await base.ValidaPermissaoParaEditarTarefa())
- {
- this.CarregarUsuarios();
- base.Alterar(true);
- TarefaBIViewModel tarefaBIViewModel = this;
- gridLength = (base.EnableFields ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star));
- tarefaBIViewModel.ColumnUsuarioPrincipal = gridLength;
- TarefaBIViewModel tarefaBIViewModel1 = this;
- gridLength1 = (base.EnableFields ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel));
- tarefaBIViewModel1.ColumnUsuarios = gridLength1;
- base.ListaUsuariosResponsaveis();
- base.HasResponsaveis = true;
- this.SelectedUsuario = null;
- base.Responsaveis.ToList<ResponsavelTarefa>().ForEach((ResponsavelTarefa x) => this.Usuarios.Remove(this.Usuarios.FirstOrDefault<Usuario>((Usuario u) => u.get_Id() == x.get_Usuario().get_Id())));
- }
- else
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!", "OK", "", false);
- }
- }
- }
-
- public async Task Cancelar()
- {
- if (this._cancelTarefa != 0)
- {
- long num = this._cancelTarefa;
- await this.CarregarTarefas();
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>((Tarefa x) => x.get_Id() == num);
- base.Alterar(false);
- }
- }
-
- public async Task CarregarTarefas()
- {
- long id;
- bool? nullable;
- this.ColumnUsuarioPrincipal = new GridLength(1, GridUnitType.Star);
- this.ColumnUsuarios = new GridLength(0, GridUnitType.Pixel);
- this.Filtro = string.Empty;
- TarefaServico servico = this.Servico;
- Usuario selectedUsuarioFiltro = this.SelectedUsuarioFiltro;
- if (selectedUsuarioFiltro != null)
- {
- id = selectedUsuarioFiltro.get_Id();
- }
- else
- {
- id = (long)0;
- }
- DateTime inicio = this.Inicio;
- DateTime fim = this.Fim;
- if (this.SelectedStatus == "TODAS AS TAREFAS")
- {
- nullable = null;
- }
- else
- {
- nullable = new bool?(this.SelectedStatus != "PENDENTE");
- }
- List<Tarefa> tarefas = await servico.BuscarTarefas(id, inicio, fim, nullable);
- TarefaBIViewModel observableCollection = this;
- List<Tarefa> tarefas1 = tarefas;
- IEnumerable<Tarefa> entidade =
- from x in tarefas1
- where x.get_Entidade() != 1
- select x;
- observableCollection.Tarefas = new ObservableCollection<Tarefa>(
- from x in entidade
- orderby x.get_Agendamento()
- select x);
- this.TarefasFiltradas = this.Tarefas;
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- if (this.FiltroTarefa.Count > 0)
- {
- this.FiltrarTarefa();
- }
- }
-
- private void CarregarUsuarios()
- {
- this.Usuarios = new ObservableCollection<Usuario>(Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (!Recursos.Configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema c) => c.get_Configuracao() == 36) && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>());
- }
-
- public async void CarregaTarefas(bool permissoes = false)
- {
- if (permissoes)
- {
- await base.PermissaoTela(38);
- base.Alterar(false);
- }
- await this.CarregarTarefas();
- }
-
- public async Task<Tarefa> ConcluirTarefa(Tarefa tarefa)
- {
- Tarefa tarefa1;
- if (await base.ValidaPermissaoParaEditarTarefa())
- {
- tarefa1 = await this.Servico.Salvar(tarefa);
- }
- else
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EDITAR ESSA TAREFA!", "OK", "", false);
- tarefa1 = null;
- }
- return tarefa1;
- }
-
- public async Task<MalaDireta> CriarMalaDireta(TipoTarefa tipo)
- {
- MalaDireta malaDiretum;
- switch (tipo)
- {
- case 0:
- {
- Documento documento = await base.CarregaApolice(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum1 = new MalaDireta();
- malaDiretum1.set_Cliente(documento.get_Controle().get_Cliente());
- malaDiretum1.set_Apolice(documento);
- malaDiretum1.set_Tela(2);
- malaDiretum = malaDiretum1;
- break;
- }
- case 1:
- case 6:
- case 7:
- {
- malaDiretum = null;
- break;
- }
- case 2:
- {
- Cliente cliente = await base.CarregaCliente(this.SelectedTarefa.get_IdCliente());
- MalaDireta malaDiretum2 = new MalaDireta();
- malaDiretum2.set_Cliente(cliente);
- malaDiretum2.set_Tela(1);
- malaDiretum = malaDiretum2;
- break;
- }
- case 3:
- {
- Documento documento1 = await base.CarregaApoliceParcela(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum3 = new MalaDireta();
- malaDiretum3.set_Cliente(documento1.get_Controle().get_Cliente());
- malaDiretum3.set_Apolice(documento1);
- malaDiretum3.set_Tela(5);
- malaDiretum = malaDiretum3;
- break;
- }
- case 4:
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum4 = new MalaDireta();
- malaDiretum4.set_Cliente(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente());
- malaDiretum4.set_Apolice(sinistro.get_ControleSinistro().get_Item().get_Documento());
- malaDiretum4.set_Sinistro(sinistro);
- malaDiretum4.set_Tela(7);
- malaDiretum = malaDiretum4;
- break;
- }
- case 5:
- {
- Prospeccao prospeccao = await base.CarregarProspeccao(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum5 = new MalaDireta();
- malaDiretum5.set_Prospeccao(prospeccao);
- malaDiretum5.set_Tela(33);
- malaDiretum = malaDiretum5;
- break;
- }
- case 8:
- {
- malaDiretum = null;
- break;
- }
- default:
- {
- goto case 7;
- }
- }
- return malaDiretum;
- }
-
- public async Task Excluir()
- {
- bool id;
- string titulo;
- Tarefa selectedTarefa = this.SelectedTarefa;
- if (selectedTarefa != null)
- {
- id = selectedTarefa.get_Id() == (long)0;
- }
- else
- {
- id = false;
- }
- if (!id)
- {
- TarefaBIViewModel tarefaBIViewModel = this;
- string[] newLine = new string[] { "DESEJA REALMENTE EXCLUIR A TAREFA ", null, null, null, null };
- Tarefa tarefa = this.SelectedTarefa;
- if (tarefa != null)
- {
- titulo = tarefa.get_Titulo();
- }
- else
- {
- titulo = null;
- }
- newLine[1] = titulo;
- newLine[2] = "?";
- newLine[3] = Environment.NewLine;
- newLine[4] = "ESSE PROCEDIMENTO É IRREVERSÍVEL";
- if (await tarefaBIViewModel.ShowMessage(string.Concat(newLine), "SIM", "NÃO", false))
- {
- if (await this.Servico.Excluir(this.SelectedTarefa.get_Id()))
- {
- await this.CarregarTarefas();
- Action atualizaTrilhas = Gestor.Application.Actions.Actions.AtualizaTrilhas;
- if (atualizaTrilhas != null)
- {
- atualizaTrilhas();
- }
- else
- {
- }
- base.Alterar(false);
- }
- else
- {
- base.Alterar(false);
- }
- }
- }
- }
-
- public void ExcluirFiltro(string filtro)
- {
- this.FiltroTarefa.Remove(filtro);
- this.FiltrarTarefa();
- }
-
- private List<Tarefa> Filtrar()
- {
- List<Tarefa> list = this.Tarefas.ToList<Tarefa>();
- this.FiltroTarefa.ToList<string>().ForEach((string f) => list = list.Where<Tarefa>((Tarefa x) => {
- if (Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Titulo()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Cliente()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Referencia()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_Agendamento().ToString("d").ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_Id().ToString().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_TipoDeTarefa() != null && Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_TipoDeTarefa().get_Nome()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)))
- {
- return true;
- }
- if (x.get_Usuario() == null)
- {
- return false;
- }
- return x.get_Usuario().get_Nome().ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f));
- }).ToList<Tarefa>());
- return list;
- }
-
- public void FiltrarTarefa()
- {
- this.TarefasFiltradas = new ObservableCollection<Tarefa>(this.Filtrar());
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- }
-
- public string GerarHtml()
- {
- string nome;
- string str = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=yes'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title> TAREFA </title></head><body bgcolor='#FFFFFF'><div align='center'>";
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>");
- str = string.Concat(str, "TAREFA</h4></td></table><br>");
- str = string.Concat(str, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 4pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- int num = 0;
- string[] cliente = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num1 = num;
- num = num1 + 1;
- cliente[2] = (num1 % 2 == 0 ? "WhiteSmoke" : "White");
- cliente[3] = "'><p align='left'><b>CLIENTE: </b>";
- cliente[4] = this.SelectedTarefa.get_Cliente();
- cliente[5] = "</p></td></tr>";
- str = string.Concat(cliente);
- string[] referencia = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num2 = num;
- num = num2 + 1;
- referencia[2] = (num2 % 2 == 0 ? "WhiteSmoke" : "White");
- referencia[3] = "'><p align='left'><b>REFERÊNCIA: </b>";
- referencia[4] = this.SelectedTarefa.get_Referencia();
- referencia[5] = "</p></td></tr>";
- str = string.Concat(referencia);
- string[] titulo = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num3 = num;
- num = num3 + 1;
- titulo[2] = (num3 % 2 == 0 ? "WhiteSmoke" : "White");
- titulo[3] = "'><p align='left'><b>TÍTULO: </b>";
- titulo[4] = this.SelectedTarefa.get_Titulo();
- titulo[5] = "</p></td></tr>";
- str = string.Concat(titulo);
- string[] strArrays = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num4 = num;
- num = num4 + 1;
- strArrays[2] = (num4 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays[3] = "'><p align='left'><b>AGENDAMENTO: </b>";
- DateTime agendamento = this.SelectedTarefa.get_Agendamento();
- strArrays[4] = agendamento.ToString();
- strArrays[5] = "</p></td></tr>";
- str = string.Concat(strArrays);
- string[] nome1 = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num5 = num;
- num = num5 + 1;
- nome1[2] = (num5 % 2 == 0 ? "WhiteSmoke" : "White");
- nome1[3] = "'><p align='left'><b>RESPONSÁVEL PRINCIPAL: </b>";
- nome1[4] = this.SelectedTarefa.get_Usuario().get_Nome();
- nome1[5] = "</p></td></tr>";
- str = string.Concat(nome1);
- string[] description = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num6 = num;
- num = num6 + 1;
- description[2] = (num6 % 2 == 0 ? "WhiteSmoke" : "White");
- description[3] = "'><p align='left'><b>STATUS: </b>";
- description[4] = Gestor.Common.Validation.ValidationHelper.GetDescription(this.SelectedTarefa.get_Status());
- description[5] = "</p></td></tr>";
- str = string.Concat(description);
- string[] strArrays1 = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- strArrays1[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays1[3] = "'><p align='left'><b>TIPO DE TAREFA: </b>";
- TipoDeTarefa selectedTipoTarefa = this.SelectedTipoTarefa;
- if (selectedTipoTarefa != null)
- {
- nome = selectedTipoTarefa.get_Nome();
- }
- else
- {
- nome = null;
- }
- strArrays1[4] = nome;
- strArrays1[5] = "</p></td></tr>";
- str = string.Concat(strArrays1);
- str = string.Concat(str, "</font></table>");
- if (base.Responsaveis != null && base.Responsaveis.Count > 0)
- {
- str = string.Concat(str, "<h2>RESPONSÁVEIS VINCULADOS</h2>");
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- List<string> strs = new List<string>();
- foreach (ResponsavelTarefa responsavei in base.Responsaveis)
- {
- strs.Add(responsavei.get_Usuario().get_Nome().Trim().ToUpper());
- }
- str = string.Concat(str, "<tr><td width='333'><p align='left'>", string.Join(", ", strs), "</p></td></tr>");
- str = string.Concat(str, "</font></table>");
- str = string.Concat(str, "<br><br>");
- }
- str = string.Concat(str, "<br><br>");
- if (this.SelectedTarefa.get_Descricao() != null)
- {
- str = string.Concat(str, "<h2>ANOTAÇÕES</h2>");
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- str = string.Concat(str, "<tr><td width='333'><p align='left'>", this.SelectedTarefa.get_Descricao().Replace("<BODY>", "").Replace("</BODY>", ""), "</p></td></tr>");
- str = string.Concat(str, "</font></table>");
- str = string.Concat(str, "<br><br>");
- }
- str = string.Concat(str, "</div></body>");
- return str;
- }
-
- public void Print()
- {
- string str = this.GerarHtml();
- string tempPath = Path.GetTempPath();
- string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoTela)38, Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8);
- streamWriter.Write(str);
- streamWriter.Close();
- Process.Start(str1);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar(string titulo)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- Usuario usuario;
- string str;
- if (this.SelectedTarefa != null)
- {
- DateTime networkTime = Funcoes.GetNetworkTime();
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (configuracoes.All<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() != 45) && this.SelectedTarefa.get_Status() != 2 && this.SelectedTarefa.get_Agendamento() < networkTime)
- {
- this.SelectedTarefa.set_Agendamento(networkTime);
- }
- if (this.SelectedTarefa.get_Status() == 2)
- {
- this.SelectedTarefa.set_Conclusao(new DateTime?(networkTime));
- }
- this.SelectedTarefa.set_Responsaveis(base.Responsaveis.ToList<ResponsavelTarefa>());
- Tarefa selectedTarefa = this.SelectedTarefa;
- ResponsavelTarefa responsavelTarefa = base.Responsaveis.FirstOrDefault<ResponsavelTarefa>();
- if (responsavelTarefa != null)
- {
- usuario = responsavelTarefa.get_Usuario();
- }
- else
- {
- usuario = null;
- }
- selectedTarefa.set_Usuario(usuario);
- Tarefa tarefa = this.SelectedTarefa;
- List<ConfiguracaoSistema> configuracaoSistemas = Recursos.Configuracoes;
- tarefa.set_AgendamentoRetroativo(configuracaoSistemas.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 45));
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedTarefa.Validate();
- string text = Funcoes.GetText(this.SelectedTarefa.get_Anotacoes());
- string text1 = Funcoes.GetText(this.SelectedTarefa.get_AnotacoesInternas());
- if (string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text1))
- {
- keyValuePairs1.Add(new KeyValuePair<string, string>("Anotações", "OBRIGATÓRIO"));
- }
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedTarefa.set_Anotacoes(Funcoes.AdicionarLog(this.SelectedTarefa.get_Anotacoes()));
- this.SelectedTarefa.set_Descricao(string.Concat(this.SelectedTarefa.get_Anotacoes(), " <p> ", this.Descricao, " </p>"));
- Tarefa selectedTarefa1 = this.SelectedTarefa;
- str = (string.IsNullOrWhiteSpace(this.SelectedTarefa.get_AnotacoesInternas()) ? this.HistoricoInterno : string.Concat(this.SelectedTarefa.get_AnotacoesInternas(), " <p> ", this.HistoricoInterno, " </p>"));
- selectedTarefa1.set_DescricaoInterna(str);
- this.SelectedTarefa.set_TipoDeTarefa(this.SelectedTipoTarefa);
- this.SelectedTarefa.set_Titulo(titulo);
- this.SelectedTarefa = await this.Servico.Salvar(this.SelectedTarefa);
- if (this.Servico.Sucesso)
- {
- long id = this.SelectedTarefa.get_Id();
- await this.CarregarTarefas();
- TarefaBIViewModel tarefaBIViewModel = this;
- Tarefa tarefa1 = this.TarefasFiltradas.FirstOrDefault<Tarefa>((Tarefa x) => x.get_Id() == id);
- if (tarefa1 == null)
- {
- tarefa1 = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- }
- tarefaBIViewModel.SelectedTarefa = tarefa1;
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- }
- else
- {
- keyValuePairs = null;
- }
- return keyValuePairs;
- }
-
- private async void WorkOnSelectedTarefa(Tarefa value)
- {
- Usuario usuario;
- ObservableCollection<ResponsavelTarefa> observableCollection;
- TipoTelefone tipoTelefone;
- TipoTelefone tipoTelefone1;
- bool flag;
- ObservableCollection<ResponsavelTarefa> observableCollection1;
- if (value != null)
- {
- TarefaBIViewModel tarefaBIViewModel = this;
- if (value.get_Usuario() != null)
- {
- usuario = this.Usuarios.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == value.get_Usuario().get_Id());
- }
- else
- {
- usuario = null;
- }
- tarefaBIViewModel.SelectedUsuario = usuario;
- this.DataAgendamento = value.get_Agendamento();
- this.HoraAgendamento = value.get_Agendamento();
- this.Descricao = value.get_Descricao();
- this.HistoricoInterno = value.get_DescricaoInterna();
- TarefaBIViewModel tarefaBIViewModel1 = this;
- if (value == null)
- {
- observableCollection = new ObservableCollection<ResponsavelTarefa>();
- }
- else
- {
- observableCollection = (value.get_Responsaveis() == null ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>(value.get_Responsaveis()));
- }
- tarefaBIViewModel1.Responsaveis = observableCollection;
- if (!base.Responsaveis.Any<ResponsavelTarefa>())
- {
- TarefaBIViewModel tarefaBIViewModel2 = this;
- Tarefa tarefa = value;
- if (tarefa != null)
- {
- flag = tarefa.get_Usuario();
- }
- else
- {
- flag = false;
- }
- if (!flag)
- {
- observableCollection1 = new ObservableCollection<ResponsavelTarefa>();
- }
- else
- {
- ResponsavelTarefa[] responsavelTarefaArray = new ResponsavelTarefa[1];
- ResponsavelTarefa responsavelTarefa = new ResponsavelTarefa();
- responsavelTarefa.set_Usuario(value.get_Usuario());
- responsavelTarefaArray[0] = responsavelTarefa;
- observableCollection1 = new ObservableCollection<ResponsavelTarefa>(responsavelTarefaArray);
- }
- tarefaBIViewModel2.Responsaveis = observableCollection1;
- }
- if (value.get_TipoDeTarefa() != null)
- {
- if (!this.TiposTarefa.All<TipoDeTarefa>((TipoDeTarefa x) => x.get_Id() != value.get_Id()) || value.get_TipoDeTarefa().get_Ativo())
- {
- TarefaBIViewModel observableCollection2 = this;
- ObservableCollection<TipoDeTarefa> tiposTarefa = this.TiposTarefa;
- observableCollection2.TiposTarefa = new ObservableCollection<TipoDeTarefa>((
- from x in tiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- }
- else
- {
- this.TiposTarefa.Add(value.get_TipoDeTarefa());
- }
- }
- this.SelectedTipoTarefa = value.get_TipoDeTarefa();
- this.IsVisibleCliente = Visibility.Collapsed;
- this.IsVisibleApolice = Visibility.Collapsed;
- this.IsVisibleSinistro = Visibility.Collapsed;
- this.IsVisibleArquivoDigital = Visibility.Collapsed;
- TipoTarefa entidade = value.get_Entidade();
- switch (entidade)
- {
- case 0:
- case 3:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleApolice = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- case 1:
- {
- entidade = value.get_Entidade();
- if (entidade == 5)
- {
- Prospeccao prospeccao = await (new ProspeccaoServico()).BuscarProspeccao(value.get_IdEntidade());
- this.Telefones = new ObservableCollection<TelefoneBase>();
- if (prospeccao != null && prospeccao.get_Telefone1() != null)
- {
- ObservableCollection<TelefoneBase> telefones = this.Telefones;
- TelefoneBase telefoneBase1 = new TelefoneBase();
- tipoTelefone1 = (prospeccao.get_Telefone1().StartsWith("9") ? 3 : 7);
- telefoneBase1.set_Tipo(new TipoTelefone?(tipoTelefone1));
- telefoneBase1.set_Numero(prospeccao.get_Telefone1());
- telefoneBase1.set_Prefixo(prospeccao.get_Prefixo1());
- telefones.Add(telefoneBase1);
- }
- if (prospeccao != null && prospeccao.get_Telefone2() != null)
- {
- ObservableCollection<TelefoneBase> telefones1 = this.Telefones;
- TelefoneBase telefoneBase2 = new TelefoneBase();
- tipoTelefone = (prospeccao.get_Telefone2().StartsWith("9") ? 3 : 7);
- telefoneBase2.set_Tipo(new TipoTelefone?(tipoTelefone));
- telefoneBase2.set_Numero(prospeccao.get_Telefone2());
- telefoneBase2.set_Prefixo(prospeccao.get_Prefixo2());
- telefones1.Add(telefoneBase2);
- }
- }
- else if (entidade == 8)
- {
- this.Telefones = new ObservableCollection<TelefoneBase>();
- }
- else
- {
- ObservableCollection<ClienteTelefone> observableCollection3 = await this.ClienteServico.BuscarTelefonesAsync(value.get_IdCliente());
- TarefaBIViewModel tarefaBIViewModel3 = this;
- ObservableCollection<ClienteTelefone> observableCollection4 = observableCollection3;
- IEnumerable<ClienteTelefone> clienteTelefones =
- from x in observableCollection4
- where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero())
- select x;
- tarefaBIViewModel3.Telefones = new ObservableCollection<TelefoneBase>(clienteTelefones.Select<ClienteTelefone, TelefoneBase>((ClienteTelefone x) => {
- TelefoneBase telefoneBase = new TelefoneBase();
- telefoneBase.set_Tipo(x.get_Tipo());
- telefoneBase.set_Id(x.get_Id());
- telefoneBase.set_Numero(x.get_Numero());
- telefoneBase.set_Prefixo(x.get_Prefixo());
- return telefoneBase;
- }).ToList<TelefoneBase>());
- }
- break;
- }
- case 2:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- case 4:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleApolice = Visibility.Visible;
- this.IsVisibleSinistro = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- default:
- {
- goto case 1;
- }
- }
- }
- else
- {
- base.Responsaveis = new ObservableCollection<ResponsavelTarefa>();
- }
- }
- }
-}
\ No newline at end of file |