summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs480
1 files changed, 480 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs
new file mode 100644
index 0000000..682228f
--- /dev/null
+++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs
@@ -0,0 +1,480 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+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.Componentes;
+using Gestor.Application.Drawers;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.ViewModels;
+using Gestor.Application.ViewModels.Seguros;
+using Gestor.Application.ViewModels.Seguros.Itens;
+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.Seguros.Itens;
+
+public class PatrimonialView : BaseUserControl, IComponentConnector
+{
+ public PatrimonialViewModel ViewModel;
+
+ private readonly MenuItemViewModel _menuItemViewModel;
+
+ internal MenuItem IncluirItemButton;
+
+ internal MenuItem SinistroButton;
+
+ internal TextBox CepBox;
+
+ internal TextBox EnderecoBox;
+
+ internal TextBox BairroBox;
+
+ internal TextBox CidadeBox;
+
+ internal TextBox EstadoBox;
+
+ internal RadioButton CoberturasRadioButton;
+
+ internal RadioButton MaisInformacoesRadioButton;
+
+ internal ContentControl ContentControl;
+
+ internal CustomItemValidation MaisInformacoes;
+
+ private bool _contentLoaded;
+
+ public PatrimonialView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false)
+ {
+ _menuItemViewModel = menuItemViewModel;
+ ViewModel = new PatrimonialViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao);
+ ((FrameworkElement)this).DataContext = ViewModel;
+ InitializeComponent();
+ Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+ if (dispatcher != null)
+ {
+ dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+ }
+ if (lockInsert)
+ {
+ ((UIElement)IncluirItemButton).IsEnabled = false;
+ ((UIElement)SinistroButton).Visibility = (Visibility)2;
+ }
+ }
+
+ public async Task Selecionar(Item item)
+ {
+ await ViewModel.SelecionaItem(item);
+ }
+
+ public void Manter(ManutencaoItem manutencao)
+ {
+ ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao);
+ }
+
+ public void Substituir()
+ {
+ ViewModel.Substituir(ConsultaViewModel.ItemSelecionado);
+ }
+
+ private void ContentLoad()
+ {
+ //IL_000d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Expected O, but got Unknown
+ //IL_0024: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002e: Expected O, but got Unknown
+ ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked);
+ ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked);
+ }
+
+ private void Documento_OnChecked(object sender, RoutedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0007: Expected O, but got Unknown
+ RadioButton val = (RadioButton)sender;
+ if (!string.IsNullOrEmpty(val.GroupName))
+ {
+ ViewModel.Descarregar();
+ ((UIElement)ContentControl).Visibility = (Visibility)2;
+ ((UIElement)MaisInformacoes).Visibility = (Visibility)2;
+ ((DependencyObject)(object)MaisInformacoes).ClearInvalid();
+ ((DependencyObject)(object)ContentControl).ClearInvalid();
+ if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton"))
+ {
+ ((UIElement)ContentControl).Visibility = (Visibility)0;
+ ViewModel.CarregaCobertura();
+ }
+ else
+ {
+ ((UIElement)MaisInformacoes).Visibility = (Visibility)0;
+ }
+ }
+ }
+
+ private async void Incluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ await ViewModel.Incluir();
+ List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate();
+ ((DependencyObject)(object)this).ValidateFields(errorMessages);
+ }
+
+ private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (await ViewModel.Excluir())
+ {
+ _menuItemViewModel?.RecarregarItens(null);
+ }
+ }
+
+ private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.CancelarAlteracao();
+ }
+
+ public 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)
+ {
+ if (((DomainBase)ViewModel.SelectedItem).Id > 0)
+ {
+ _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem);
+ }
+ }
+ else
+ {
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ }
+
+ private void Alterar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Alterar(alterar: true);
+ }
+
+ private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
+ {
+ if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar)
+ {
+ await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + ".");
+ return;
+ }
+ FiltroArquivoDigital filtro = new FiltroArquivoDigital
+ {
+ Id = ((DomainBase)ViewModel.SelectedItem).Id,
+ IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id,
+ Tipo = (TipoArquivoDigital)4,
+ Parente = ViewModel.SelectedItem
+ };
+ ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
+ }
+
+ private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
+ {
+ TextBox val = (TextBox)sender;
+ if (string.IsNullOrWhiteSpace(val.Text))
+ {
+ return;
+ }
+ string text = ValidationHelper.FormatPostCode(val.Text);
+ if (ValidationHelper.ValidatePostCode(text))
+ {
+ CepBox.Text = text;
+ EnderecoBase val2 = await ViewModel.BuscaCep(text);
+ if (val2 != null)
+ {
+ EnderecoBox.Text = val2.Endereco;
+ CidadeBox.Text = val2.Cidade;
+ EstadoBox.Text = val2.Estado;
+ BairroBox.Text = val2.Bairro;
+ }
+ }
+ }
+
+ private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id);
+ }
+
+ private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ TextBox val = (TextBox)sender;
+ val.Text = ValidationHelper.FormatDocument(val.Text);
+ }
+
+ private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id);
+ }
+
+ private void MenuItem_OnClick(object sender, RoutedEventArgs e)
+ {
+ ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog();
+ _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem);
+ }
+
+ private void CopyCodItem(object sender, MouseButtonEventArgs e)
+ {
+ ViewModel.CodigoItem.CopyToClipboard();
+ ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/patrimonialview.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_008b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0095: 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_0126: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0132: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013c: Expected O, but got Unknown
+ //IL_013f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0149: Expected O, but got Unknown
+ //IL_0156: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0160: Expected O, but got Unknown
+ //IL_0162: Unknown result type (might be due to invalid IL or missing references)
+ //IL_016e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0178: Expected O, but got Unknown
+ //IL_017a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0186: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0190: Expected O, but got Unknown
+ //IL_0193: Unknown result type (might be due to invalid IL or missing references)
+ //IL_019d: Expected O, but got Unknown
+ //IL_01aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01b4: Expected O, but got Unknown
+ //IL_01b7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01c1: Expected O, but got Unknown
+ //IL_01c3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01d0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01da: Expected O, but got Unknown
+ //IL_01dd: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01e7: Expected O, but got Unknown
+ //IL_01ea: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01f4: Expected O, but got Unknown
+ //IL_01f7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0201: Expected O, but got Unknown
+ //IL_0203: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0210: Unknown result type (might be due to invalid IL or missing references)
+ //IL_021a: Expected O, but got Unknown
+ //IL_021c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0229: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0233: Expected O, but got Unknown
+ //IL_0234: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0241: Unknown result type (might be due to invalid IL or missing references)
+ //IL_024b: Expected O, but got Unknown
+ //IL_024d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_025a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0264: Expected O, but got Unknown
+ //IL_0265: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0271: Unknown result type (might be due to invalid IL or missing references)
+ //IL_027b: Expected O, but got Unknown
+ //IL_027d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_028a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0294: Expected O, but got Unknown
+ //IL_0296: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02a3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02ad: Expected O, but got Unknown
+ //IL_02ae: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02bb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02c5: Expected O, but got Unknown
+ //IL_02c7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02de: Expected O, but got Unknown
+ //IL_02df: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02eb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02f5: Expected O, but got Unknown
+ //IL_02f7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0304: Unknown result type (might be due to invalid IL or missing references)
+ //IL_030e: Expected O, but got Unknown
+ //IL_0310: Unknown result type (might be due to invalid IL or missing references)
+ //IL_031d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0327: Expected O, but got Unknown
+ //IL_0328: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0335: Unknown result type (might be due to invalid IL or missing references)
+ //IL_033f: Expected O, but got Unknown
+ //IL_0341: Unknown result type (might be due to invalid IL or missing references)
+ //IL_034e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0358: Expected O, but got Unknown
+ //IL_0359: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0365: Unknown result type (might be due to invalid IL or missing references)
+ //IL_036f: Expected O, but got Unknown
+ //IL_0371: Unknown result type (might be due to invalid IL or missing references)
+ //IL_037e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0388: Expected O, but got Unknown
+ //IL_038a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0397: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03a1: Expected O, but got Unknown
+ //IL_03a2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03af: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03b9: Expected O, but got Unknown
+ //IL_03bc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03c6: Expected O, but got Unknown
+ //IL_03c9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03d3: Expected O, but got Unknown
+ //IL_03d6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_03e0: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 1:
+ IncluirItemButton = (MenuItem)target;
+ IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick);
+ break;
+ case 2:
+ ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+ break;
+ case 3:
+ ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+ break;
+ case 4:
+ ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+ break;
+ case 5:
+ ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+ break;
+ case 6:
+ ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem);
+ break;
+ case 7:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click);
+ break;
+ case 8:
+ SinistroButton = (MenuItem)target;
+ SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick);
+ break;
+ case 9:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+ break;
+ case 10:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick);
+ break;
+ case 11:
+ CepBox = (TextBox)target;
+ ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus);
+ break;
+ case 12:
+ EnderecoBox = (TextBox)target;
+ break;
+ case 13:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 14:
+ BairroBox = (TextBox)target;
+ break;
+ case 15:
+ CidadeBox = (TextBox)target;
+ break;
+ case 16:
+ EstadoBox = (TextBox)target;
+ break;
+ case 17:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 18:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ break;
+ case 19:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus);
+ break;
+ case 20:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 21:
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 22:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus);
+ break;
+ case 23:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 24:
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 25:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus);
+ break;
+ case 26:
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 27:
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 28:
+ CoberturasRadioButton = (RadioButton)target;
+ break;
+ case 29:
+ MaisInformacoesRadioButton = (RadioButton)target;
+ break;
+ case 30:
+ ContentControl = (ContentControl)target;
+ break;
+ case 31:
+ MaisInformacoes = (CustomItemValidation)target;
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}