summaryrefslogtreecommitdiff
path: root/Gestor.Application/Views/Ferramentas/EstipulanteView.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/Views/Ferramentas/EstipulanteView.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Views/Ferramentas/EstipulanteView.cs')
-rw-r--r--Gestor.Application/Views/Ferramentas/EstipulanteView.cs395
1 files changed, 0 insertions, 395 deletions
diff --git a/Gestor.Application/Views/Ferramentas/EstipulanteView.cs b/Gestor.Application/Views/Ferramentas/EstipulanteView.cs
deleted file mode 100644
index b546879..0000000
--- a/Gestor.Application/Views/Ferramentas/EstipulanteView.cs
+++ /dev/null
@@ -1,395 +0,0 @@
-using Gestor.Application.Drawers;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.ViewModels.Ferramentas;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-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.Ferramentas
-{
- public class EstipulanteView : BaseUserControl, IComponentConnector
- {
- public EstipulanteViewModel ViewModel;
-
- internal DataGrid EstipulanteGrid;
-
- internal MenuItem MaisOpcoesButton;
-
- internal TextBox EmpresaBox;
-
- internal TextBox NomeBox;
-
- internal TextBox DocumentoPrincipalBox;
-
- internal ToggleButton AtivoBox;
-
- internal TextBox PrimeiroPrefixo;
-
- internal TextBox PrimeiroTelefone;
-
- internal TextBox SegundoPrefixo;
-
- internal TextBox SegundoTelefone;
-
- internal TextBox EmailBox;
-
- internal TextBox CepBox;
-
- internal TextBox EnderecoBox;
-
- internal TextBox NumeroBox;
-
- internal TextBox BairroBox;
-
- internal TextBox CidadeBox;
-
- internal TextBox EstadoBox;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public EstipulanteView()
- {
- base.Tag = "CADASTRO DE ESTIPULANTE";
- this.ViewModel = new EstipulanteViewModel();
- 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 void AbrirLog_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLog(9, this.ViewModel.SelectedEstipulante.get_Id());
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelEstipulante = (Estipulante)this.ViewModel.SelectedEstipulante.Clone();
- this.ViewModel.Alterar(true);
- this.ValidarTela();
- }
-
- private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e)
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 5).get_Consultar())
- {
- FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital();
- filtroArquivoDigital.set_Id(this.ViewModel.SelectedEstipulante.get_Id());
- filtroArquivoDigital.set_Tipo(17);
- filtroArquivoDigital.set_Parente(this.ViewModel.SelectedEstipulante);
- this.ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false);
- }
- else
- {
- await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)17), "."), "OK", "", false);
- }
- }
-
- private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarEstipulante("");
- }
-
- private void AutoCompleteBoxEstipulante_Populating(object sender, PopulatingEventArgs e)
- {
- e.set_Cancel(true);
- this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Estipulante>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void Cancelar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelarAlteracao();
- }
-
- private void ContentLoad()
- {
- this.EstipulanteGrid.SelectedIndex = 0;
- this.EstipulanteGrid.SelectionChanged += new SelectionChangedEventHandler(this.EstipulanteGrid_OnSelectionChanged);
- this.EstipulanteGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => {
- });
- }
-
- private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e)
- {
- if (((TextBox)sender).IsReadOnly)
- {
- return;
- }
- string str = ValidationHelper.Clear(this.DocumentoPrincipalBox.Text);
- if (string.IsNullOrEmpty(str))
- {
- return;
- }
- this.DocumentoPrincipalBox.Text = (str.Length == 11 ? ValidationHelper.FormatDocument(str.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(str.PadLeft(14, '0').Substring(0, 14)));
- }
-
- private void EstipulanteGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- DataGrid dataGrid = (DataGrid)sender;
- if (dataGrid != null && dataGrid.SelectedIndex < 0)
- {
- return;
- }
- this.ViewModel.SelecionaEstipulante((Estipulante)((dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null)));
- }
-
- private void Excluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Excluir();
- }
-
- private void Incluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Incluir();
- this.ValidarTela();
- }
-
- [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/ferramentas/estipulanteview.xaml", UriKind.Relative));
- }
-
- private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
- {
- string str = ValidationHelper.FormatPostCode(((TextBox)sender).Text);
- this.CepBox.Text = str;
- if (ValidationHelper.ValidatePostCode(str))
- {
- EnderecoBase enderecoBase = await this.ViewModel.BuscaCep(str);
- if (enderecoBase != null)
- {
- this.EnderecoBox.Text = enderecoBase.get_Endereco();
- this.CidadeBox.Text = enderecoBase.get_Cidade();
- this.EstadoBox.Text = enderecoBase.get_Estado();
- this.BairroBox.Text = enderecoBase.get_Bairro();
- }
- }
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, EstipulanteView.AutoCompleteBoxEstipulante_Populating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
- return;
- }
- case 2:
- {
- this.EstipulanteGrid = (DataGrid)target;
- return;
- }
- case 3:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 4:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick);
- return;
- }
- case 5:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
- return;
- }
- case 6:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick);
- return;
- }
- case 7:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick);
- return;
- }
- case 8:
- {
- this.MaisOpcoesButton = (MenuItem)target;
- return;
- }
- case 9:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
- return;
- }
- case 10:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ArquivoDigital_OnClick);
- return;
- }
- case 11:
- {
- this.EmpresaBox = (TextBox)target;
- return;
- }
- case 12:
- {
- this.NomeBox = (TextBox)target;
- return;
- }
- case 13:
- {
- this.DocumentoPrincipalBox = (TextBox)target;
- EstipulanteView estipulanteView = this;
- this.DocumentoPrincipalBox.PreviewTextInput += new TextCompositionEventHandler(estipulanteView.SomenteNumeros);
- this.DocumentoPrincipalBox.LostFocus += new RoutedEventHandler(this.DocumentoPrincipalBox_LostFocus);
- return;
- }
- case 14:
- {
- this.AtivoBox = (ToggleButton)target;
- return;
- }
- case 15:
- {
- this.PrimeiroPrefixo = (TextBox)target;
- EstipulanteView estipulanteView1 = this;
- this.PrimeiroPrefixo.PreviewTextInput += new TextCompositionEventHandler(estipulanteView1.SomenteNumeros);
- return;
- }
- case 16:
- {
- this.PrimeiroTelefone = (TextBox)target;
- EstipulanteView estipulanteView2 = this;
- this.PrimeiroTelefone.LostFocus += new RoutedEventHandler(estipulanteView2.FormatarTelefone);
- EstipulanteView estipulanteView3 = this;
- this.PrimeiroTelefone.PreviewTextInput += new TextCompositionEventHandler(estipulanteView3.SomenteNumeros);
- return;
- }
- case 17:
- {
- this.SegundoPrefixo = (TextBox)target;
- EstipulanteView estipulanteView4 = this;
- this.SegundoPrefixo.PreviewTextInput += new TextCompositionEventHandler(estipulanteView4.SomenteNumeros);
- return;
- }
- case 18:
- {
- this.SegundoTelefone = (TextBox)target;
- EstipulanteView estipulanteView5 = this;
- this.SegundoTelefone.LostFocus += new RoutedEventHandler(estipulanteView5.FormatarTelefone);
- EstipulanteView estipulanteView6 = this;
- this.SegundoTelefone.PreviewTextInput += new TextCompositionEventHandler(estipulanteView6.SomenteNumeros);
- return;
- }
- case 19:
- {
- this.EmailBox = (TextBox)target;
- return;
- }
- case 20:
- {
- this.CepBox = (TextBox)target;
- this.CepBox.LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus);
- EstipulanteView estipulanteView7 = this;
- this.CepBox.PreviewTextInput += new TextCompositionEventHandler(estipulanteView7.SomenteNumeros);
- return;
- }
- case 21:
- {
- this.EnderecoBox = (TextBox)target;
- return;
- }
- case 22:
- {
- this.NumeroBox = (TextBox)target;
- return;
- }
- case 23:
- {
- this.BairroBox = (TextBox)target;
- return;
- }
- case 24:
- {
- this.CidadeBox = (TextBox)target;
- return;
- }
- case 25:
- {
- this.EstadoBox = (TextBox)target;
- return;
- }
- }
- this._contentLoaded = true;
- }
-
- private void ValidarTela()
- {
- if (this.ViewModel.SelectedEstipulante == null)
- {
- return;
- }
- List<KeyValuePair<string, string>> keyValuePairs = this.ViewModel.SelectedEstipulante.Validate();
- this.ValidateFields(keyValuePairs, false);
- }
- }
-} \ No newline at end of file