summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs277
1 files changed, 277 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs
new file mode 100644
index 0000000..065adb8
--- /dev/null
+++ b/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs
@@ -0,0 +1,277 @@
+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.Input;
+using System.Windows.Markup;
+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.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Application.Views.Ferramentas;
+
+public class SocioView : BaseUserControl, IComponentConnector
+{
+ internal ComboBox EmpresaFilialBox;
+
+ internal DataGrid SocioGrid;
+
+ internal MenuItem MaisOpcoesButton;
+
+ internal TextBox NomeBox;
+
+ internal TextBox PrimeiroPrefixo;
+
+ internal TextBox PrimeiroTelefone;
+
+ internal TextBox EmailBox;
+
+ private bool _contentLoaded;
+
+ public SocioViewModel ViewModel { get; set; }
+
+ public SocioView()
+ {
+ ((FrameworkElement)this).Tag = "CADASTRO DE SÓCIOS";
+ ViewModel = new SocioViewModel();
+ ((FrameworkElement)this).DataContext = ViewModel;
+ InitializeComponent();
+ }
+
+ private void AutoCompleteBoxSocio_Populating(object sender, PopulatingEventArgs e)
+ {
+ e.Cancel = true;
+ ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Socio>> 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.FiltrarSocio("");
+ }
+ }
+
+ 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.CancelSocio = (Socio)((DomainBase)ViewModel.SelectedSocio).Clone();
+ ViewModel.Alterar(alterar: true);
+ ValidarTela();
+ ((DomainBase)ViewModel.SelectedSocio).Initialize();
+ }
+
+ 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 Cancelar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.CancelarAlteracao();
+ }
+
+ private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
+ {
+ if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)14).Consultar)
+ {
+ await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)14) + ".");
+ return;
+ }
+ if (ViewModel.SelectedSocio == null)
+ {
+ await ViewModel.ShowMessage("É NECESSÁRIO SELECIONAR UM SÓCIO PARA ABRIR SEU ARQUIVO DIGITAL");
+ return;
+ }
+ FiltroArquivoDigital filtro = new FiltroArquivoDigital
+ {
+ Id = ((DomainBase)ViewModel.SelectedSocio).Id,
+ Tipo = (TipoArquivoDigital)14,
+ Parente = ViewModel.SelectedSocio
+ };
+ ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
+ }
+
+ private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLog((TipoTela)19, ((DomainBase)ViewModel.SelectedSocio).Id);
+ }
+
+ private void Incluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Incluir();
+ ValidarTela();
+ }
+
+ private void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Excluir();
+ }
+
+ private void ValidarTela()
+ {
+ if (ViewModel.SelectedSocio != null)
+ {
+ List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSocio.Validate();
+ ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false);
+ }
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/socioview.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_004b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0055: Expected O, but got Unknown
+ //IL_0057: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0063: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006d: Expected O, but got Unknown
+ //IL_006e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0084: Expected O, but got Unknown
+ //IL_0087: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0091: Expected O, but got Unknown
+ //IL_0093: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a9: Expected O, but got Unknown
+ //IL_00ab: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c1: Expected O, but got Unknown
+ //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d9: Expected O, but got Unknown
+ //IL_00db: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f1: Expected O, but got Unknown
+ //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0109: Expected O, but got Unknown
+ //IL_010b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0117: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0121: Expected O, but got Unknown
+ //IL_0124: Unknown result type (might be due to invalid IL or missing references)
+ //IL_012e: Expected O, but got Unknown
+ //IL_0130: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0146: Expected O, but got Unknown
+ //IL_0149: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0153: 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_016e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0178: Expected O, but got Unknown
+ //IL_017b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0185: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01b5: Expected O, but got Unknown
+ //IL_01b8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01c2: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 1:
+ EmpresaFilialBox = (ComboBox)target;
+ break;
+ case 2:
+ ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSocio_Populating);
+ ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+ break;
+ case 3:
+ SocioGrid = (DataGrid)target;
+ break;
+ case 4:
+ ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+ break;
+ case 5:
+ ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+ break;
+ case 6:
+ ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+ break;
+ case 7:
+ ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+ break;
+ case 8:
+ ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+ break;
+ case 9:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click);
+ break;
+ case 10:
+ MaisOpcoesButton = (MenuItem)target;
+ break;
+ case 11:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+ break;
+ case 12:
+ NomeBox = (TextBox)target;
+ break;
+ case 13:
+ PrimeiroPrefixo = (TextBox)target;
+ ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 14:
+ PrimeiroTelefone = (TextBox)target;
+ ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 15:
+ EmailBox = (TextBox)target;
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}