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.Componentes; using Gestor.Application.Drawers; using Gestor.Application.Drawers.Configuracoes; 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 EmpresaView : BaseUserControl, IComponentConnector { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static MouseButtonEventHandler _003C_003E9__5_0; internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) { } } internal DataGrid EmpresaGrid; internal MenuItem Alterar; internal TextBox DocumentoPrincipalBox; internal TextBox NomeBox; internal TextBox CepBox; internal TextBox EnderecoBox; internal TextBox BairroBox; internal TextBox CidadeBox; internal TextBox EstadoBox; internal CustomPasswordBox SenhaBox; private bool _contentLoaded; public EmpresaViewModel ViewModel { get; set; } public EmpresaView() { ((FrameworkElement)this).Tag = "CADASTRO DE EMPRESA E FILIAIS"; ViewModel = new EmpresaViewModel(); ((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)EmpresaGrid).SelectedIndex = 0; ((Selector)EmpresaGrid).SelectionChanged += new SelectionChangedEventHandler(EmpresaGrid_OnSelectionChanged); DataGrid empresaGrid = EmpresaGrid; object obj = _003C_003Ec._003C_003E9__5_0; if (obj == null) { MouseButtonEventHandler val = delegate { }; _003C_003Ec._003C_003E9__5_0 = val; obj = (object)val; } ((Control)empresaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; if (((DomainBase)Recursos.Usuario).Id == 0L) { ((UIElement)Alterar).IsEnabled = true; } } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { ViewModel.CancelarAlteracao(); if (((DomainBase)Recursos.Usuario).Id == 0L) { ((UIElement)Alterar).IsEnabled = true; } ((TextBoxBase)NomeBox).IsReadOnly = true; ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; ViewModel.PassWordReadOnly = ViewModel.EnableFields; ViewModel.ConfirmacaoSenha = (Visibility)2; } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { ViewModel.Loading(isLoading: true); List> list = await ViewModel.Salvar(); ((DependencyObject)(object)this).ValidateFields(list); bool num = list == null || list.Count == 0; ViewModel.Loading(isLoading: false); ViewModel.PassWordReadOnly = ViewModel.EnableFields; ViewModel.ConfirmacaoSenha = (Visibility)((list == null || list.Count <= 0) ? 2 : 0); if (((DomainBase)Recursos.Usuario).Id == 0L) { ((UIElement)Alterar).IsEnabled = true; ((TextBoxBase)NomeBox).IsReadOnly = true; ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; } 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.CancelEmpresa = (Empresa)((DomainBase)ViewModel.SelectedEmpresa).Clone(); ViewModel.Alterar(alterar: true); PermissaoAuteracao(); ViewModel.PassWordReadOnly = ViewModel.EnableFields; ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0); } public void PermissaoAuteracao() { if (((DomainBase)Recursos.Usuario).Id != 0L) { ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; ((TextBoxBase)NomeBox).IsReadOnly = true; return; } ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0); ViewModel.PassWordReadOnly = true; ((UIElement)Alterar).IsEnabled = false; ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = false; ((TextBoxBase)NomeBox).IsReadOnly = false; } private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) { if (!ViewModel.EnableFields) { return; } 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 AutoCompleteBoxEmpresa_Populating(object sender, PopulatingEventArgs e) { e.Cancel = true; ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> 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.FiltrarEmpresa(""); } } private void EmpresaGrid_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.SelecionaEmpresa((Empresa)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); } } private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) { if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)13).Consultar) { await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)13) + "."); return; } FiltroArquivoDigital filtro = new FiltroArquivoDigital { Id = ((DomainBase)ViewModel.SelectedEmpresa).Id, Tipo = (TipoArquivoDigital)13, Parente = ViewModel.SelectedEmpresa }; ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); } private void AbrirLog_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirLog((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id); } private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirLogEmail((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id); } private async void Configuracoes_OnClick(object sender, RoutedEventArgs e) { if (await ViewModel.VerificarRestricao((TipoRestricao)64)) { ViewModel.ShowDrawer(new ConfiguracoesDrawer(), 0, close: false); } } 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 = DocumentoPrincipalBox.Text.Clear(); 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 async void AnexarLogo_OnClick(object sender, RoutedEventArgs e) { ViewModel.Loading(isLoading: true); await ViewModel.AnexarLogo(); ViewModel.Loading(isLoading: false); } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/empresaview.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_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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Expected O, but got Unknown switch (connectionId) { case 1: ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxEmpresa_Populating); ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); break; case 2: EmpresaGrid = (DataGrid)target; break; case 3: Alterar = (MenuItem)target; Alterar.Click += new RoutedEventHandler(Alterar_OnClick); break; case 4: ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); break; case 5: ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); break; case 6: ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); break; case 7: ((MenuItem)target).Click += new RoutedEventHandler(AnexarLogo_OnClick); break; case 8: ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); break; case 9: ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); break; case 10: ((MenuItem)target).Click += new RoutedEventHandler(Configuracoes_OnClick); break; case 11: DocumentoPrincipalBox = (TextBox)target; ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 12: NomeBox = (TextBox)target; break; case 13: CepBox = (TextBox)target; ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 14: EnderecoBox = (TextBox)target; break; case 15: BairroBox = (TextBox)target; break; case 16: CidadeBox = (TextBox)target; break; case 17: EstadoBox = (TextBox)target; break; case 18: SenhaBox = (CustomPasswordBox)target; break; case 19: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 20: ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 21: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 22: ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 23: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 24: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; default: _contentLoaded = true; break; } } }