summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs448
1 files changed, 448 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs
new file mode 100644
index 0000000..b352d2f
--- /dev/null
+++ b/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs
@@ -0,0 +1,448 @@
+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;
+using Gestor.Application.Drawers;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.ViewModels.Ferramentas;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Views.Ferramentas;
+
+public class EstipulanteView : BaseUserControl, IComponentConnector
+{
+ [Serializable]
+ [CompilerGenerated]
+ private sealed class _003C_003Ec
+ {
+ public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec();
+
+ public static MouseButtonEventHandler _003C_003E9__2_0;
+
+ internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args)
+ {
+ }
+ }
+
+ 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;
+
+ public EstipulanteView()
+ {
+ ((FrameworkElement)this).Tag = "CADASTRO DE ESTIPULANTE";
+ ViewModel = new EstipulanteViewModel();
+ ((FrameworkElement)this).DataContext = ViewModel;
+ InitializeComponent();
+ Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+ if (dispatcher != null)
+ {
+ dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+ }
+ }
+
+ private void ContentLoad()
+ {
+ //IL_0019: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0023: Expected O, but got Unknown
+ //IL_003d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0042: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0048: Expected O, but got Unknown
+ ((Selector)EstipulanteGrid).SelectedIndex = 0;
+ ((Selector)EstipulanteGrid).SelectionChanged += new SelectionChangedEventHandler(EstipulanteGrid_OnSelectionChanged);
+ DataGrid estipulanteGrid = EstipulanteGrid;
+ object obj = _003C_003Ec._003C_003E9__2_0;
+ if (obj == null)
+ {
+ MouseButtonEventHandler val = delegate
+ {
+ };
+ _003C_003Ec._003C_003E9__2_0 = val;
+ obj = (object)val;
+ }
+ ((Control)estipulanteGrid).MouseDoubleClick += (MouseButtonEventHandler)obj;
+ }
+
+ private void Incluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Incluir();
+ ValidarTela();
+ }
+
+ private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.CancelarAlteracao();
+ }
+
+ private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Loading(isLoading: true);
+ List<KeyValuePair<string, string>> list = await ViewModel.Salvar();
+ ((DependencyObject)(object)this).ValidateFields(list);
+ bool num = list == null || list.Count == 0;
+ ViewModel.Loading(isLoading: false);
+ if (!num)
+ {
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ }
+
+ private void Alterar_OnClick(object sender, RoutedEventArgs e)
+ {
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0020: Expected O, but got Unknown
+ ViewModel.CancelEstipulante = (Estipulante)((DomainBase)ViewModel.SelectedEstipulante).Clone();
+ ViewModel.Alterar(alterar: true);
+ ValidarTela();
+ }
+
+ private void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Excluir();
+ }
+
+ private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
+ {
+ string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text);
+ CepBox.Text = text;
+ if (ValidationHelper.ValidatePostCode(text))
+ {
+ EnderecoBase val = await ViewModel.BuscaCep(text);
+ if (val != null)
+ {
+ EnderecoBox.Text = val.Endereco;
+ CidadeBox.Text = val.Cidade;
+ EstadoBox.Text = val.Estado;
+ BairroBox.Text = val.Bairro;
+ }
+ }
+ }
+
+ private void AutoCompleteBoxEstipulante_Populating(object sender, PopulatingEventArgs e)
+ {
+ e.Cancel = true;
+ ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Estipulante>> searchResult)
+ {
+ //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)
+ if (searchResult.Result != null)
+ {
+ AutoCompleteBox val = (AutoCompleteBox)sender;
+ val.ItemsSource = searchResult.Result;
+ val.PopulateComplete();
+ }
+ }, TaskScheduler.FromCurrentSynchronizationContext());
+ }
+
+ private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text))
+ {
+ ViewModel.FiltrarEstipulante("");
+ }
+ }
+
+ private void EstipulanteGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0007: Expected O, but got Unknown
+ //IL_0031: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003b: Expected O, but got Unknown
+ DataGrid val = (DataGrid)sender;
+ if (val == null || ((Selector)val).SelectedIndex >= 0)
+ {
+ ViewModel.SelecionaEstipulante((Estipulante)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null));
+ }
+ }
+
+ private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLog((TipoTela)9, ((DomainBase)ViewModel.SelectedEstipulante).Id);
+ }
+
+ private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ if (!((TextBoxBase)(TextBox)sender).IsReadOnly)
+ {
+ string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text);
+ if (!string.IsNullOrEmpty(text))
+ {
+ DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14)));
+ }
+ }
+ }
+
+ private void ValidarTela()
+ {
+ if (ViewModel.SelectedEstipulante != null)
+ {
+ List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedEstipulante.Validate();
+ ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false);
+ }
+ }
+
+ private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar)
+ {
+ await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)17) + ".");
+ return;
+ }
+ FiltroArquivoDigital filtro = new FiltroArquivoDigital
+ {
+ Id = ((DomainBase)ViewModel.SelectedEstipulante).Id,
+ Tipo = (TipoArquivoDigital)17,
+ Parente = ViewModel.SelectedEstipulante
+ };
+ ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/estipulanteview.xaml", UriKind.Relative);
+ Application.LoadComponent((object)this, uri);
+ }
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ internal Delegate _CreateDelegate(Type delegateType, string handler)
+ {
+ return Delegate.CreateDelegate(delegateType, this, handler);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void IComponentConnector.Connect(int connectionId, object target)
+ {
+ //IL_0072: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0088: Expected O, but got Unknown
+ //IL_0089: 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)
+ //IL_009f: Expected O, but got Unknown
+ //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ac: Expected O, but got Unknown
+ //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c4: Expected O, but got Unknown
+ //IL_00c6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00dc: Expected O, but got Unknown
+ //IL_00de: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ea: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f4: Expected O, but got Unknown
+ //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0102: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010c: Expected O, but got Unknown
+ //IL_010e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_011a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0124: Expected O, but got Unknown
+ //IL_0127: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0131: Expected O, but got Unknown
+ //IL_0133: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0149: Expected O, but got Unknown
+ //IL_014b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0157: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0161: Expected O, but got Unknown
+ //IL_0164: Unknown result type (might be due to invalid IL or missing references)
+ //IL_016e: Expected O, but got Unknown
+ //IL_0171: Unknown result type (might be due to invalid IL or missing references)
+ //IL_017b: Expected O, but got Unknown
+ //IL_017e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0188: Expected O, but got Unknown
+ //IL_0196: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01a0: Expected O, but got Unknown
+ //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01b7: Expected O, but got Unknown
+ //IL_01ba: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01c4: Expected O, but got Unknown
+ //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01d1: Expected O, but got Unknown
+ //IL_01df: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01e9: Expected O, but got Unknown
+ //IL_01ec: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01f6: Expected O, but got Unknown
+ //IL_0204: Unknown result type (might be due to invalid IL or missing references)
+ //IL_020e: Expected O, but got Unknown
+ //IL_021c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0226: Expected O, but got Unknown
+ //IL_0229: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0233: Expected O, but got Unknown
+ //IL_0241: Unknown result type (might be due to invalid IL or missing references)
+ //IL_024b: Expected O, but got Unknown
+ //IL_024e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0258: Expected O, but got Unknown
+ //IL_0266: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0270: Expected O, but got Unknown
+ //IL_027e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0288: Expected O, but got Unknown
+ //IL_028b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0295: Expected O, but got Unknown
+ //IL_0298: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02a2: Expected O, but got Unknown
+ //IL_02af: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02b9: Expected O, but got Unknown
+ //IL_02c7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02d1: Expected O, but got Unknown
+ //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02de: Expected O, but got Unknown
+ //IL_02e1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02eb: Expected O, but got Unknown
+ //IL_02ee: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02f8: Expected O, but got Unknown
+ //IL_02fb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0305: Expected O, but got Unknown
+ //IL_0308: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0312: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 1:
+ ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxEstipulante_Populating);
+ ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+ break;
+ case 2:
+ EstipulanteGrid = (DataGrid)target;
+ break;
+ case 3:
+ ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+ break;
+ case 4:
+ ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+ break;
+ case 5:
+ ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+ break;
+ case 6:
+ ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+ break;
+ case 7:
+ ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+ break;
+ case 8:
+ MaisOpcoesButton = (MenuItem)target;
+ break;
+ case 9:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+ break;
+ case 10:
+ ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick);
+ break;
+ case 11:
+ EmpresaBox = (TextBox)target;
+ break;
+ case 12:
+ NomeBox = (TextBox)target;
+ break;
+ case 13:
+ DocumentoPrincipalBox = (TextBox)target;
+ ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus);
+ break;
+ case 14:
+ AtivoBox = (ToggleButton)target;
+ break;
+ case 15:
+ PrimeiroPrefixo = (TextBox)target;
+ ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 16:
+ PrimeiroTelefone = (TextBox)target;
+ ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 17:
+ SegundoPrefixo = (TextBox)target;
+ ((UIElement)SegundoPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 18:
+ SegundoTelefone = (TextBox)target;
+ ((UIElement)SegundoTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)SegundoTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 19:
+ EmailBox = (TextBox)target;
+ break;
+ case 20:
+ CepBox = (TextBox)target;
+ ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus);
+ ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 21:
+ EnderecoBox = (TextBox)target;
+ break;
+ case 22:
+ NumeroBox = (TextBox)target;
+ break;
+ case 23:
+ BairroBox = (TextBox)target;
+ break;
+ case 24:
+ CidadeBox = (TextBox)target;
+ break;
+ case 25:
+ EstadoBox = (TextBox)target;
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}