diff options
Diffstat (limited to 'Gestor.Application/Views/Menus/DashboardView.cs')
| -rw-r--r-- | Gestor.Application/Views/Menus/DashboardView.cs | 1002 |
1 files changed, 0 insertions, 1002 deletions
diff --git a/Gestor.Application/Views/Menus/DashboardView.cs b/Gestor.Application/Views/Menus/DashboardView.cs deleted file mode 100644 index 1b130e6..0000000 --- a/Gestor.Application/Views/Menus/DashboardView.cs +++ /dev/null @@ -1,1002 +0,0 @@ -using Gestor.Application.Drawers;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Seguros;
-using Gestor.Application.ViewModels;
-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.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos;
-using Gestor.Model.Domain.Relatorios.Dashboard;
-using Gestor.Model.Domain.Relatorios.Renovacao;
-using Gestor.Model.Domain.Seguros;
-using MaterialDesignThemes.Wpf;
-using System;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Markup;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Menus
-{
- public class DashboardView : BaseUserControl, IComponentConnector, IStyleConnector
- {
- internal Chip UsuarioChip;
-
- internal Button TileRenovacao;
-
- internal Button TileAniversariantes;
-
- internal Button TileTarefas;
-
- internal Button TileSinistro;
-
- internal Button TileProspeccao;
-
- internal TextBox TituloBox;
-
- internal TextBox DescricaoBox;
-
- internal Grid RenovacaoGrid;
-
- internal Grid AniversariantesGrid;
-
- internal Grid TarefasGrid;
-
- internal Grid ProspeccaoGrid;
-
- internal DatePicker InicioBox;
-
- internal DatePicker FimBox;
-
- internal ComboBox FiltroDocumento;
-
- internal Grid SinistroGrid;
-
- internal DatePicker InicioBox2;
-
- internal DatePicker FimBox2;
-
- private bool _contentLoaded;
-
- public DashboardViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public DashboardView(DashboardViewModel viewModel)
- {
- base.Tag = "DASHBOARD";
- this.ViewModel = viewModel;
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher;
- if (dispatcher == null)
- {
- return;
- }
- dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad));
- }
-
- private async void AbrirAniversariante_OnClick(object sender, RoutedEventArgs e)
- {
- ClientesAtivosInativos dataContext = (ClientesAtivosInativos)((Button)sender).DataContext;
- Cliente cliente = await (new ClienteServico()).BuscarClienteAsync(dataContext.get_EntidadeCliente().get_Id());
- double? nullable = null;
- double? nullable1 = nullable;
- nullable = null;
- (new HosterWindow(new ClienteView(cliente, true, null), string.Concat("CADASTRO DE CLIENTES - ", cliente.get_Nome()), nullable1, nullable, false)).ShowDialog();
- }
-
- private async Task AbrirProspeccao(Prospeccao data)
- {
- bool flag;
- this.InicioBox.Text = ValidationHelper.FormatDate(this.InicioBox.Text);
- this.FimBox.Text = ValidationHelper.FormatDate(this.FimBox.Text);
- while (true)
- {
- data = await this.ViewModel.ShowProspeccaoDialog(data);
- if (data == null)
- {
- return;
- }
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.SalvarProspeccao(data);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- if (flag)
- {
- break;
- }
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- this.ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO.", true);
- await this.CarregarForce();
- return;
- }
-
- private async void AbrirRenovacao_OnClick(object sender, RoutedEventArgs e)
- {
- Renovacao dataContext = (Renovacao)((Button)sender).DataContext;
- if (dataContext.get_Documento() != null)
- {
- Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(dataContext.get_Documento().get_Id(), false, false);
- double? nullable = null;
- double? nullable1 = nullable;
- nullable = null;
- (new HosterWindow(new ApoliceView(documento, true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", documento.get_Controle().get_Cliente().get_Nome()), nullable1, nullable, false)).Show();
- }
- else
- {
- this.ViewModel.Loading(true);
- await this.AbrirProspeccao(dataContext.get_Prospeccao());
- this.ViewModel.Loading(false);
- }
- }
-
- private async void AbrirSinistro_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = (Button)sender;
- if (button.DataContext != null)
- {
- Sinistro dataContext = (Sinistro)button.DataContext;
- if (dataContext != null)
- {
- dataContext = await this.ViewModel.CarregaSinistroApolice(dataContext.get_Id());
- Item item = dataContext.get_ControleSinistro().get_Item();
- SinistroView sinistroView = new SinistroView(item, false);
- string[] nome = new string[] { "CADASTRO DE SINISTROS - ", item.get_Documento().get_Controle().get_Cliente().get_Nome(), " - ", item.get_Documento().get_Apolice(), " ", item.get_Documento().get_Endosso() };
- double? nullable = null;
- double? nullable1 = nullable;
- nullable = null;
- (new HosterWindow(sinistroView, string.Concat(nome), nullable1, nullable, false)).Show();
- }
- }
- }
-
- private void AbrirTarefa_OnClick(object sender, RoutedEventArgs e)
- {
- Tarefa dataContext = (Tarefa)((Button)sender).DataContext;
- this.ViewModel.ShowDrawer(new TarefaDrawer(dataContext, true), 0, false);
- }
-
- private void AdicionarNota_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.EnableFields = true;
- this.TituloBox.Text = string.Empty;
- this.DescricaoBox.Text = string.Empty;
- this.ViewModel.Publica = false;
- }
-
- private void Cancelar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.EnableFields = false;
- }
-
- private async Task Carregar()
- {
- this.ViewModel.Loading(true);
- this.RenovacaoGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.AniversariantesGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.TarefasGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.ProspeccaoGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.SinistroGrid.Visibility = System.Windows.Visibility.Collapsed;
- if (this.ViewModel.Filtros == null)
- {
- await this.ViewModel.CarregarFiltros();
- }
- await this.ViewModel.CarregarNotas();
- switch (this.ViewModel.SelectedTile)
- {
- case 1:
- {
- await this.ViewModel.CarregarRenovacoes(false);
- this.RenovacaoGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 2:
- {
- await this.ViewModel.CarregarAniversariantes(false);
- this.AniversariantesGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 3:
- {
- await this.ViewModel.CarregarTarefas(false);
- this.TarefasGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 4:
- {
- DashboardViewModel viewModel = this.ViewModel;
- DateTime value = this.InicioBox.SelectedDate.Value;
- await viewModel.CarregarProspect(value, this.FimBox.SelectedDate.Value);
- this.ProspeccaoGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 5:
- {
- await this.ViewModel.CarregarSinistros(false);
- this.SinistroGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- }
- this.ViewModel.Loading(false);
- }
-
- private async Task CarregarForce()
- {
- this.ViewModel.Loading(true);
- this.RenovacaoGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.AniversariantesGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.TarefasGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.ProspeccaoGrid.Visibility = System.Windows.Visibility.Collapsed;
- this.SinistroGrid.Visibility = System.Windows.Visibility.Collapsed;
- await this.ViewModel.CarregarFiltros();
- List<RestricaoUsuario> restricoes = this.ViewModel.Restricoes;
- bool flag = restricoes.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 24)
- {
- return false;
- }
- return x.get_Restricao();
- });
- List<RestricaoUsuario> restricaoUsuarios = this.ViewModel.Restricoes;
- bool flag1 = restricaoUsuarios.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 49)
- {
- return false;
- }
- return x.get_Restricao();
- });
- List<RestricaoUsuario> restricoes1 = this.ViewModel.Restricoes;
- bool flag2 = restricoes1.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 19)
- {
- return false;
- }
- return x.get_Restricao();
- });
- List<RestricaoUsuario> restricaoUsuarios1 = this.ViewModel.Restricoes;
- bool flag3 = restricaoUsuarios1.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 25)
- {
- return false;
- }
- return x.get_Restricao();
- });
- if (!flag)
- {
- await this.ViewModel.CarregarRenovacoes(true);
- }
- if (!flag1)
- {
- await this.ViewModel.CarregarAniversariantes(true);
- }
- if (!flag2)
- {
- await this.ViewModel.CarregarTarefas(true);
- }
- if (!flag3)
- {
- await this.ViewModel.CarregarSinistros(true);
- }
- await this.ViewModel.CarregarNotas();
- switch (this.ViewModel.SelectedTile)
- {
- case 1:
- {
- this.RenovacaoGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 2:
- {
- this.AniversariantesGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 3:
- {
- this.TarefasGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 4:
- {
- this.ProspeccaoGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- case 5:
- {
- this.SinistroGrid.Visibility = System.Windows.Visibility.Visible;
- break;
- }
- }
- this.ViewModel.Loading(false);
- }
-
- private async void ContentLoad()
- {
- DateTime? selectedDate;
- this.UsuarioChip.Content = Recursos.Usuario.get_Nome();
- await this.ViewModel.BuscarRestricoes();
- await this.ViewModel.CarregarNotas();
- await this.ViewModel.CarregarFiltros();
- List<RestricaoUsuario> restricoes = this.ViewModel.Restricoes;
- bool flag = restricoes.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 24)
- {
- return false;
- }
- return x.get_Restricao();
- });
- List<RestricaoUsuario> restricaoUsuarios = this.ViewModel.Restricoes;
- bool flag1 = restricaoUsuarios.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 49)
- {
- return false;
- }
- return x.get_Restricao();
- });
- List<PermissaoUsuario> permissoes = this.ViewModel.Permissoes;
- bool flag2 = permissoes.Any<PermissaoUsuario>((PermissaoUsuario x) => {
- if (x.get_Tela() != 38)
- {
- return false;
- }
- return !x.get_Consultar();
- });
- bool hasValue = !Recursos.Usuario.get_PermissaoAggilizador().HasValue;
- List<RestricaoUsuario> restricoes1 = this.ViewModel.Restricoes;
- bool flag3 = restricoes1.Any<RestricaoUsuario>((RestricaoUsuario x) => {
- if (x.get_Tipo() != 25)
- {
- return false;
- }
- return x.get_Restricao();
- });
- this.FiltroDocumento.SelectedIndex = 0;
- List<Task> tasks = new List<Task>();
- if (hasValue)
- {
- this.TileProspeccao.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- this.ViewModel.CarregarRamos();
- this.TileProspeccao.Visibility = System.Windows.Visibility.Visible;
- if (!this.InicioBox.SelectedDate.HasValue)
- {
- this.InicioBox.SelectedDate = new DateTime?(DateTime.Today);
- }
- if (!this.FimBox.SelectedDate.HasValue)
- {
- DatePicker fimBox = this.FimBox;
- selectedDate = this.InicioBox.SelectedDate;
- fimBox.SelectedDate = new DateTime?(selectedDate.Value);
- }
- DashboardViewModel viewModel = this.ViewModel;
- DateTime value = this.InicioBox.SelectedDate.Value;
- selectedDate = this.FimBox.SelectedDate;
- tasks.Add(viewModel.CarregarProspect(value, selectedDate.Value));
- }
- if (flag2)
- {
- this.TileTarefas.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- this.TileTarefas.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.SelectedTile = 3;
- tasks.Add(this.ViewModel.CarregarTarefas(false));
- }
- if (flag1)
- {
- this.TileAniversariantes.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- this.TileAniversariantes.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.SelectedTile = 2;
- tasks.Add(this.ViewModel.CarregarAniversariantes(false));
- }
- if (flag3)
- {
- this.TileSinistro.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- this.TileSinistro.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.SelectedTile = 5;
- tasks.Add(this.ViewModel.CarregarSinistros(false));
- }
- if (flag)
- {
- this.TileRenovacao.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- this.TileRenovacao.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.SelectedTile = 1;
- tasks.Add(this.ViewModel.CarregarRenovacoes(false));
- }
- await Task.WhenAll(tasks);
- this.ViewModel.Load = false;
- }
-
- private void DatePicker_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.LimparProspeccao();
- }
-
- private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e)
- {
- string str;
- if (!this.ViewModel.Restricao(32))
- {
- Button button = (Button)sender;
- if (button.DataContext != null)
- {
- ClienteTelefone dataContext = button.DataContext as ClienteTelefone;
- if (dataContext != null)
- {
- str = (!dataContext.get_Tipo().HasValue || dataContext.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", dataContext.get_Prefixo(), dataContext.get_Numero().Clear()) : string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).Clear());
- if (!str.EnviarWhatsapp(this.ViewModel.Anotacoes))
- {
- await this.ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS", "OK", "", false);
- }
- return;
- }
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP", "OK", "", false);
- }
- }
-
- private async void ExcluirNota_OnClick(object sender, RoutedEventArgs e)
- {
- Tarefa dataContext = ((Button)sender).DataContext as Tarefa;
- if (dataContext != null)
- {
- await this.ViewModel.ExcluirNota(dataContext);
- await this.ViewModel.CarregarNotas();
- }
- }
-
- private void FiltroCliente_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.LimparProspeccao();
- }
-
- private async void GerarCsv_OnClick(object sender, RoutedEventArgs e)
- {
- DateTime date = DateTime.Now.Date;
- string.Concat("NovosNegocios", date.ToString("d").Replace("/", ""), ".csv");
- if (this.ViewModel.Prospeccoes.Count != 0)
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.GerarCsv();
- this.ViewModel.Loading(false);
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO HÁ DADOS A SEREM EXPORTADOS NO .CSV", "OK", "", false);
- }
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- {
- return;
- }
- this._contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/views/menus/dashboardview.xaml", UriKind.Relative));
- }
-
- private async void NotaConcluida_OnClick(object sender, RoutedEventArgs e)
- {
- Tarefa dataContext = ((Button)sender).DataContext as Tarefa;
- if (dataContext != null)
- {
- dataContext.set_Conclusao(new DateTime?(Funcoes.GetNetworkTime()));
- dataContext.set_Status(2);
- await this.ViewModel.SalvarNota(dataContext);
- await this.ViewModel.CarregarNotas();
- }
- }
-
- private void PopupBox_OnClosed(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Anotacoes = "";
- }
-
- private void PopupBoxAniversariante_OnOpened(object sender, RoutedEventArgs e)
- {
- ClientesAtivosInativos dataContext = (ClientesAtivosInativos)((PopupBox)sender).DataContext;
- this.ViewModel.Telefones = dataContext.get_EntidadeCliente().get_Telefones();
- }
-
- private void PopupBoxProspeccao_OnOpened(object sender, RoutedEventArgs e)
- {
- Prospectar dataContext = (Prospectar)((PopupBox)sender).DataContext;
- this.ViewModel.Telefones = dataContext.get_EntidadeCliente().get_Telefones();
- }
-
- private void PopupBoxRenovacao_OnOpened(object sender, RoutedEventArgs e)
- {
- PopupBox popupBox = (PopupBox)sender;
- ObservableCollection<ClienteTelefone> observableCollection = new ObservableCollection<ClienteTelefone>();
- Renovacao dataContext = (Renovacao)popupBox.DataContext;
- if (dataContext.get_Documento() == null)
- {
- if (!string.IsNullOrEmpty(dataContext.get_Prospeccao().get_Telefone1()))
- {
- ClienteTelefone clienteTelefone = new ClienteTelefone();
- clienteTelefone.set_Prefixo(dataContext.get_Prospeccao().get_Prefixo1());
- clienteTelefone.set_Numero(dataContext.get_Prospeccao().get_Telefone1());
- observableCollection.Add(clienteTelefone);
- }
- if (!string.IsNullOrEmpty(dataContext.get_Prospeccao().get_Telefone2()))
- {
- ClienteTelefone clienteTelefone1 = new ClienteTelefone();
- clienteTelefone1.set_Prefixo(dataContext.get_Prospeccao().get_Prefixo2());
- clienteTelefone1.set_Numero(dataContext.get_Prospeccao().get_Telefone2());
- observableCollection.Add(clienteTelefone1);
- }
- }
- else
- {
- observableCollection = dataContext.get_Documento().get_Controle().get_Cliente().get_Telefones();
- }
- this.ViewModel.Telefones = observableCollection;
- }
-
- private void Ramo_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.LimparProspeccao();
- }
-
- private void Referencia_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.LimparProspeccao();
- }
-
- private async void Refresh_OnClick(object sender, RoutedEventArgs e)
- {
- await this.CarregarForce();
- }
-
- private async void RefreshProspectar_OnClick(object sender, RoutedEventArgs e)
- {
- if (!this.InicioBox.SelectedDate.HasValue || !this.FimBox.SelectedDate.HasValue)
- {
- await this.ViewModel.ShowMessage("INÍCIO E FIM DEVEM ESTAR PREENCHIDOS.", "OK", "", false);
- }
- else if (this.InicioBox.SelectedDate.Value > this.FimBox.SelectedDate.Value)
- {
- await this.ViewModel.ShowMessage("INÍCIO NÃO DEVE SER MAIOR QUE O FIM.", "OK", "", false);
- }
- else if ((this.FimBox.SelectedDate.Value - this.InicioBox.SelectedDate.Value).TotalDays <= 31)
- {
- this.ViewModel.Loading(true);
- DashboardViewModel viewModel = this.ViewModel;
- DateTime value = this.InicioBox.SelectedDate.Value;
- await viewModel.CarregarProspect(value, this.FimBox.SelectedDate.Value);
- this.ProspeccaoGrid.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.Loading(false);
- }
- else
- {
- await this.ViewModel.ShowMessage("O PERIODO TOTAL DO RELATÓRIO NÃO PODE SER MAIOR QUE 30 DIAS.", "OK", "", false);
- }
- }
-
- private async void RefreshSinsitro_OnClick(object sender, RoutedEventArgs e)
- {
- if (!this.InicioBox2.SelectedDate.HasValue || !this.FimBox2.SelectedDate.HasValue)
- {
- await this.ViewModel.ShowMessage("INÍCIO E FIM DEVEM ESTAR PREENCHIDOS.", "OK", "", false);
- }
- else if (this.InicioBox2.SelectedDate.Value > this.FimBox2.SelectedDate.Value)
- {
- await this.ViewModel.ShowMessage("INÍCIO NÃO DEVE SER MAIOR QUE O FIM.", "OK", "", false);
- }
- else if ((this.FimBox2.SelectedDate.Value - this.InicioBox2.SelectedDate.Value).TotalDays <= 31)
- {
- this.ViewModel.Loading(true);
- DashboardViewModel viewModel = this.ViewModel;
- DateTime value = this.InicioBox2.SelectedDate.Value;
- await viewModel.CarregarSinistros(value, this.FimBox2.SelectedDate.Value);
- this.SinistroGrid.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.Loading(false);
- }
- else
- {
- await this.ViewModel.ShowMessage("O PERIODO TOTAL DO RELATÓRIO NÃO PODE SER MAIOR QUE 30 DIAS.", "OK", "", false);
- }
- }
-
- private async void SalvarNota_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- Tarefa tarefa = new Tarefa();
- tarefa.set_Agendamento(Funcoes.GetNetworkTime());
- tarefa.set_Titulo(this.TituloBox.Text);
- tarefa.set_Anotacoes(this.DescricaoBox.Text);
- tarefa.set_Usuario(Recursos.Usuario);
- tarefa.set_UsuarioCadastro(Recursos.Usuario);
- tarefa.set_Entidade(1);
- tarefa.set_Status(0);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar(tarefa);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- else
- {
- this.ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO.", true);
- this.ViewModel.EnableFields = false;
- await this.ViewModel.CarregarNotas();
- }
- }
-
- private async void SarvarNota_OnClick(object sender, RoutedEventArgs e)
- {
- Tarefa dataContext = ((Button)sender).DataContext as Tarefa;
- if (dataContext != null)
- {
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar(dataContext);
- if (keyValuePairs != null && keyValuePairs.Count != 0)
- {
- await this.ViewModel.CarregarNotas();
- }
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- this.UsuarioChip = (Chip)target;
- return;
- }
- case 2:
- {
- ((Button)target).Click += new RoutedEventHandler(this.Refresh_OnClick);
- return;
- }
- case 3:
- {
- this.TileRenovacao = (Button)target;
- this.TileRenovacao.Click += new RoutedEventHandler(this.TileRenovacao_OnClick);
- return;
- }
- case 4:
- {
- this.TileAniversariantes = (Button)target;
- this.TileAniversariantes.Click += new RoutedEventHandler(this.TileAniversariantes_OnClick);
- return;
- }
- case 5:
- {
- this.TileTarefas = (Button)target;
- this.TileTarefas.Click += new RoutedEventHandler(this.TileTarefas_OnClick);
- return;
- }
- case 6:
- {
- this.TileSinistro = (Button)target;
- this.TileSinistro.Click += new RoutedEventHandler(this.TileSinistro_OnClick);
- return;
- }
- case 7:
- {
- this.TileProspeccao = (Button)target;
- this.TileProspeccao.Click += new RoutedEventHandler(this.TileProspeccao_OnClick);
- return;
- }
- case 8:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AdicionarNota_OnClick);
- return;
- }
- case 9:
- {
- ((Button)target).Click += new RoutedEventHandler(this.SalvarNota_OnClick);
- return;
- }
- case 10:
- {
- ((Button)target).Click += new RoutedEventHandler(this.Cancelar_OnClick);
- return;
- }
- case 11:
- {
- this.TituloBox = (TextBox)target;
- return;
- }
- case 12:
- {
- this.DescricaoBox = (TextBox)target;
- return;
- }
- case 13:
- case 14:
- case 16:
- case 17:
- case 18:
- case 20:
- case 21:
- case 22:
- case 24:
- case 33:
- case 34:
- {
- this._contentLoaded = true;
- return;
- }
- case 15:
- {
- this.RenovacaoGrid = (Grid)target;
- return;
- }
- case 19:
- {
- this.AniversariantesGrid = (Grid)target;
- return;
- }
- case 23:
- {
- this.TarefasGrid = (Grid)target;
- return;
- }
- case 25:
- {
- this.ProspeccaoGrid = (Grid)target;
- return;
- }
- case 26:
- {
- ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Ramo_OnSelectionChanged);
- return;
- }
- case 27:
- {
- ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Referencia_OnSelectionChanged);
- return;
- }
- case 28:
- {
- this.InicioBox = (DatePicker)target;
- this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- this.InicioBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DatePicker_OnSelectedDateChanged);
- return;
- }
- case 29:
- {
- this.FimBox = (DatePicker)target;
- this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- this.FimBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DatePicker_OnSelectedDateChanged);
- return;
- }
- case 30:
- {
- this.FiltroDocumento = (ComboBox)target;
- this.FiltroDocumento.SelectionChanged += new SelectionChangedEventHandler(this.FiltroCliente_OnSelectionChanged);
- return;
- }
- case 31:
- {
- ((Button)target).Click += new RoutedEventHandler(this.RefreshProspectar_OnClick);
- return;
- }
- case 32:
- {
- ((Button)target).Click += new RoutedEventHandler(this.GerarCsv_OnClick);
- return;
- }
- case 35:
- {
- this.SinistroGrid = (Grid)target;
- return;
- }
- case 36:
- {
- this.InicioBox2 = (DatePicker)target;
- this.InicioBox2.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox2.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- this.InicioBox2.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DatePicker_OnSelectedDateChanged);
- return;
- }
- case 37:
- {
- this.FimBox2 = (DatePicker)target;
- this.FimBox2.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox2.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- this.FimBox2.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DatePicker_OnSelectedDateChanged);
- return;
- }
- case 38:
- {
- ((Button)target).Click += new RoutedEventHandler(this.RefreshSinsitro_OnClick);
- return;
- }
- default:
- {
- this._contentLoaded = true;
- return;
- }
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target)
- {
- if (connectionId > 33)
- {
- if (connectionId == 34)
- {
- ((Button)target).Click += new RoutedEventHandler(this.EnviarPorWhatsApp_OnClick);
- return;
- }
- if (connectionId != 39)
- {
- return;
- }
- ((Button)target).Click += new RoutedEventHandler(this.AbrirSinistro_OnClick);
- }
- else
- {
- switch (connectionId)
- {
- case 13:
- {
- ((Button)target).Click += new RoutedEventHandler(this.ExcluirNota_OnClick);
- return;
- }
- case 14:
- {
- ((Button)target).Click += new RoutedEventHandler(this.NotaConcluida_OnClick);
- return;
- }
- case 15:
- case 19:
- case 23:
- {
- return;
- }
- case 16:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AbrirRenovacao_OnClick);
- return;
- }
- case 17:
- {
- ((PopupBox)target).add_Opened(new RoutedEventHandler(this.PopupBoxRenovacao_OnOpened));
- ((PopupBox)target).add_Closed(new RoutedEventHandler(this.PopupBox_OnClosed));
- return;
- }
- case 18:
- {
- ((Button)target).Click += new RoutedEventHandler(this.EnviarPorWhatsApp_OnClick);
- return;
- }
- case 20:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AbrirAniversariante_OnClick);
- return;
- }
- case 21:
- {
- ((PopupBox)target).add_Opened(new RoutedEventHandler(this.PopupBoxAniversariante_OnOpened));
- ((PopupBox)target).add_Closed(new RoutedEventHandler(this.PopupBox_OnClosed));
- return;
- }
- case 22:
- {
- ((Button)target).Click += new RoutedEventHandler(this.EnviarPorWhatsApp_OnClick);
- return;
- }
- case 24:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AbrirTarefa_OnClick);
- return;
- }
- default:
- {
- if (connectionId == 33)
- {
- break;
- }
- else
- {
- return;
- }
- }
- }
- ((PopupBox)target).add_Opened(new RoutedEventHandler(this.PopupBoxProspeccao_OnOpened));
- ((PopupBox)target).add_Closed(new RoutedEventHandler(this.PopupBox_OnClosed));
- return;
- }
- }
-
- private async void TileAniversariantes_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedTile = 2;
- await this.Carregar();
- }
-
- private async void TileProspeccao_OnClick(object sender, RoutedEventArgs e)
- {
- if (!this.InicioBox.SelectedDate.HasValue)
- {
- this.InicioBox.SelectedDate = new DateTime?(DateTime.Today);
- }
- if (!this.FimBox.SelectedDate.HasValue)
- {
- DatePicker fimBox = this.FimBox;
- fimBox.SelectedDate = new DateTime?(this.InicioBox.SelectedDate.Value);
- }
- this.ViewModel.SelectedTile = 4;
- await this.Carregar();
- }
-
- private async void TileRenovacao_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedTile = 1;
- await this.Carregar();
- }
-
- private async void TileSinistro_OnClick(object sender, RoutedEventArgs e)
- {
- if (!this.InicioBox2.SelectedDate.HasValue)
- {
- this.InicioBox2.SelectedDate = new DateTime?(DateTime.Today);
- }
- if (!this.FimBox2.SelectedDate.HasValue)
- {
- this.FimBox2.SelectedDate = new DateTime?(DateTime.Today);
- }
- this.ViewModel.SelectedTile = 5;
- await this.Carregar();
- }
-
- private async void TileTarefas_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedTile = 3;
- await this.Carregar();
- }
- }
-}
\ No newline at end of file |