diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Financeiro')
8 files changed, 3780 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs b/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs new file mode 100644 index 0000000..04f388a --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs @@ -0,0 +1,411 @@ +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 CurrencyTextBoxControl; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class BancosContasView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [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 BancosContasGrid; + + internal AutoCompleteBox AutoCompleteBanco; + + internal CurrencyTextBox ValorSaldoBox; + + private bool _contentLoaded; + + public BancosContasViewModel ViewModel { get; set; } + + public BancosContasView() + { + ((FrameworkElement)this).Tag = "BANCOS E CONTAS"; + ViewModel = new BancosContasViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.Alterar(alterar: false); + 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)BancosContasGrid).SelectedIndex = 0; + ((Selector)BancosContasGrid).SelectionChanged += new SelectionChangedEventHandler(BancosContasGrid_OnSelectionChanged); + DataGrid bancosContasGrid = BancosContasGrid; + 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)bancosContasGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + AutoCompleteBanco.Text = ""; + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedBancosContas.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + 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 Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + 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.CancelBancosContas = (BancosContas)((DomainBase)ViewModel.SelectedBancosContas).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedBancosContas).Initialize(); + } + + private void InfoExtrato_OnClick(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 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ((Window)new HosterWindow((ContentControl)(object)new InfoExtratoView((Saldo)((FrameworkElement)val).DataContext, telaBancos: true), "INFORMAÇÕES DO EXTRATO", 800.0, 450.0)).ShowDialog(); + ViewModel.Loading(isLoading: true); + ViewModel.CarregarSaldos(ViewModel.SelectedBancosContas); + ViewModel.Loading(isLoading: false); + } + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> 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 AutoCompleteBancosContasBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<BancosContas>> 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.FiltrarBancosContas(""); + } + } + + private void BancosContasGrid_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.SelectedBancosContas = (BancosContas)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void ExcluirSaldo_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Expected O, but got Unknown + ((MenuItem)sender).Click -= new RoutedEventHandler(ExcluirSaldo_OnClick); + ViewModel.ExcluirSaldo(); + ((MenuItem)sender).Click += new RoutedEventHandler(ExcluirSaldo_OnClick); + } + + private async void FecharSaldo_OnClick(object sender, RoutedEventArgs e) + { + if (!ViewModel.SelectedSaldo.DataFinal.HasValue) + { + await ViewModel.ShowMessage("NECESSÁRIO PREENCHER A DATA DE FECHAMENTO."); + return; + } + if (ViewModel.SelectedSaldo.DataInicio >= ViewModel.SelectedSaldo.DataFinal.Value) + { + await ViewModel.ShowMessage("A DATA DE FECHAMENTO DEVE SER MAIOR QUE A DATA DE ABERTURA DO SALDO."); + return; + } + DateTime value = ViewModel.SelectedSaldo.DataFinal.Value; + DateTime? dataInicio = ViewModel.SelectedSaldo.DataInicio; + TimeSpan? timeSpan = value - dataInicio; + bool flag = timeSpan.HasValue && (timeSpan.Value.TotalDays < 28.0 || timeSpan.Value.TotalDays > 31.0); + if (flag) + { + flag = !(await ViewModel.ShowMessage("O INTERVALO DE FECHAMENTO É RECOMENDADO 1 MÊS. DESEJA CONTINUAR?", "SIM", "NÃO")); + } + if (!flag) + { + ViewModel.Loading(isLoading: true); + await ViewModel.FecharSaldo(); + ViewModel.Loading(isLoading: false); + } + } + + private async void FechamentoBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + if (DateTime.TryParse(val.Text, out var _)) + { + CurrencyTextBox valorSaldoBox = ValorSaldoBox; + valorSaldoBox.Number = await ViewModel.CalcularValor(); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)26, ((DomainBase)ViewModel.SelectedBancosContas).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/bancoscontasview.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_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Expected O, but got Unknown + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBancosContasBox_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + BancosContasGrid = (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: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + break; + case 10: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 11: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FechamentoBox_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 12: + ValorSaldoBox = (CurrencyTextBox)target; + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(FecharSaldo_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirSaldo_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + if (connectionId == 15) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(InfoExtrato_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs new file mode 100644 index 0000000..8b21f29 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs @@ -0,0 +1,237 @@ +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.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class CentroDeCustoView : UserControl, 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) + { + } + } + + private bool _seleciona = true; + + internal DataGrid CentroDeCustoGrid; + + private bool _contentLoaded; + + private CentroDeCustoViewmodel ViewModel { get; } + + public CentroDeCustoView() + { + ((FrameworkElement)this).Tag = "CENTRO DE CUSTO"; + ViewModel = new CentroDeCustoViewmodel(); + ((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)CentroDeCustoGrid).SelectedIndex = 0; + ((Selector)CentroDeCustoGrid).SelectionChanged += new SelectionChangedEventHandler(CentroDeCustoGrid_OnSelectionChanged); + DataGrid centroDeCustoGrid = CentroDeCustoGrid; + 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)centroDeCustoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void CentroDeCustoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + if (_seleciona) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaCentroDeCusto((Centro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + } + + 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.CancelCentro = (Centro)((DomainBase)ViewModel.SelectedCentro).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedCentro).Initialize(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedCentro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + 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.FiltrarCentro(""); + } + } + + private void AutoCompleteBoxCentro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Centro>> searchResult) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (searchResult != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)29, ((DomainBase)ViewModel.SelectedCentro).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/centrodecustoview.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_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //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 + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxCentro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + CentroDeCustoGrid = (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(AbrirLog_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs b/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs new file mode 100644 index 0000000..15ac4d9 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs @@ -0,0 +1,562 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Financeiro; + +public class ExtratoWindow : Window, IComponentConnector +{ + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1u, + MonitorDefaulttonearest + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + X = x; + Y = y; + } + } + + private struct Minmaxinfo + { + private readonly MainWindow.Point ptReserved; + + public Point ptMaxSize; + + public Point ptMaxPosition; + + private readonly MainWindow.Point ptMinTrackSize; + + private readonly MainWindow.Point ptMaxTrackSize; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private class Monitorinfo + { + private readonly int cbSize = Marshal.SizeOf(typeof(Monitorinfo)); + + public readonly Rect rcMonitor; + + public readonly Rect rcWork; + + private readonly int dwFlags; + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + + private bool _buttonClickable; + + public ExtratoContaViewModel ViewModel; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + internal ProgressBar ProgressRing; + + internal ComboBox ContaBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal DataGrid LancamentoGrid; + + internal TextBlock NaoHaDados; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).MaxHeight = Screen.FromHandle(new WindowInteropHelper((Window)(object)this).Handle).WorkingArea.Height; + GetCursorPos(out var lpPoint); + IntPtr hMonitor = MonitorFromPoint(new MainWindow.Point(0, 0), MonitorOptions.MonitorDefaulttoprimary); + Monitorinfo monitorinfo = new Monitorinfo(); + if (GetMonitorInfo(hMonitor, monitorinfo)) + { + IntPtr intPtr = MonitorFromPoint(lpPoint, MonitorOptions.MonitorDefaulttonearest); + Minmaxinfo structure = (Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(Minmaxinfo)); + if (hMonitor.Equals((object?)(nint)intPtr)) + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetCursorPos(out MainWindow.Point lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr MonitorFromPoint(MainWindow.Point pt, MonitorOptions dwFlags); + + [DllImport("user32.dll")] + private static extern bool GetMonitorInfo(IntPtr hMonitor, Monitorinfo lpmi); + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void MaximizeButton_Click() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((Window)this).WindowState = (WindowState)(((int)((Window)this).WindowState == 0) ? 2 : 0); + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + protected sealed override void OnStateChanged(EventArgs e) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Invalid comparison between Unknown and I4 + ((Control)this).BorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 1 : 0)); + WindowChrome.ResizeBorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 4 : 0)); + WindowChrome.CaptionHeight = (((int)((Window)this).WindowState == 2) ? 33 : 30); + ViewModel.MaximizeRestore = (((int)((Window)this).WindowState == 2) ? Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]) : Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"])); + ((Window)this).OnStateChanged(e); + } + + public ExtratoWindow(long id = 0L) + { + ViewModel = new ExtratoContaViewModel(id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + string text = ApplicationHelper.Versao.ToString(); + ViewModel.Head = Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", VOCÊ ESTÁ EM RELATÓRIOS DE CONTA CORRENTE | VERSÃO GESTOR " + text; + } + + 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 + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + } + + private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparRelatorio(); + } + + private void Window_OnInitialized(object sender, EventArgs 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) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + WindowInteropHelper val = new WindowInteropHelper((Window)(object)this); + val.EnsureHandle(); + HwndSource obj = HwndSource.FromHwnd(val.Handle); + if (obj != null) + { + obj.AddHook(new HwndSourceHook(WindowProc)); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs 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) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + private async void GerarResultados_OnClick(object sender, RoutedEventArgs e) + { + if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(InicioBox.Text))) + { + InicioBox.SelectedDate = DateTime.Parse(ValidationHelper.FormatDate(InicioBox.Text)); + } + if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(FimBox.Text))) + { + FimBox.SelectedDate = DateTime.Parse(ValidationHelper.FormatDate(FimBox.Text)); + } + if (!InicioBox.SelectedDate.HasValue || !FimBox.SelectedDate.HasValue) + { + await ViewModel.ShowMessage("NECESSÁRIO PREENCHER O PERIODO INICIAL E FINAL PARA O FILTRO."); + return; + } + if (InicioBox.SelectedDate > FimBox.SelectedDate) + { + await ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO."); + return; + } + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ViewModel.IsEnabled = false; + await ViewModel.GerarRelatorio(); + ViewModel.IsEnabled = true; + ((UIElement)ProgressRing).Visibility = (Visibility)2; + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Print(); + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.GerarExcel(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/extratowindow.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_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //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_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //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_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Expected O, but got Unknown + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Expected O, but got Unknown + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Expected O, but got Unknown + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e2: Expected O, but got Unknown + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Expected O, but got Unknown + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_0221: Expected O, but got Unknown + //IL_0223: Unknown result type (might be due to invalid IL or missing references) + //IL_022f: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(ExtratoWindow)target).Initialized += Window_OnInitialized; + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 4: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 5: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 6: + ProgressRing = (ProgressBar)target; + break; + case 7: + ContaBox = (ComboBox)target; + break; + case 8: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 9: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(GerarResultados_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 13: + LancamentoGrid = (DataGrid)target; + break; + case 14: + NaoHaDados = (TextBlock)target; + break; + case 15: + Snackbar = (Snackbar)target; + break; + case 16: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs b/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs new file mode 100644 index 0000000..e2499cf --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs @@ -0,0 +1,1548 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Financeiro; + +public class FinanceiroView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private bool _selecionando; + + private List<ListSortDirection?> _sortDirections; + + private List<SortDescription> _sortDescriptions; + + internal AutoCompleteBox AutoCompleteFornecedor; + + internal MenuItem MenuFiltros; + + internal Grid GridFiltros; + + internal DataGrid LancamentoGrid; + + internal AutoCompleteBox AutoCompleteFornecedorInclusao; + + private bool _contentLoaded; + + public FinanceiroViewModel ViewModel { get; set; } + + private string OriginalValue { get; set; } + + private TipoPagamento? tipoPagamento { get; set; } + + public FinanceiroView() + { + ((FrameworkElement)this).Tag = "CONSULTA DE FINANÇAS"; + ViewModel = new FinanceiroViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Gestor.Application.Actions.Actions.SortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SortLancamentos, new Action(SortLancamentos)); + Gestor.Application.Actions.Actions.SaveSortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SaveSortLancamentos, new Action(SaveSortLancamentos)); + } + + private async void Buscar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.Buscar(); + ViewModel.Loading(isLoading: false); + } + + private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarFornecedor(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> 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 AutoCompleteFornecedorAtivo_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarFornecedorAtivo(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> 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 AutoCompleteLancamento_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.FiltrarLancamento(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Lancamento>> 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 AutoCompleteLancamento_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.Filtrar(""); + } + } + + private void TipoFiltrosBox_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_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Expected I4, but got Unknown + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ViewModel.IsvisibleStatus = (Visibility)0; + ViewModel.IsVisibleData = (Visibility)2; + ViewModel.IsVisibleFornecedor = (Visibility)2; + ViewModel.IsVisiblePersonalizado = (Visibility)2; + ViewModel.IsVisibleFiltros = (Visibility)0; + ViewModel.LimparFiltros(); + ViewModel.SelectedFornecedor = null; + if (AutoCompleteFornecedor != null) + { + AutoCompleteFornecedor.Text = string.Empty; + } + ViewModel.DropDownHeight = 0.0; + FiltroLancamento val2 = (FiltroLancamento)((Selector)val).SelectedItem; + switch (val2 - 1) + { + default: + ViewModel.IsVisibleData = (Visibility)0; + break; + case 0: + case 1: + ViewModel.IsvisibleStatus = (Visibility)2; + ViewModel.IsVisibleData = (Visibility)0; + break; + case 2: + ViewModel.IsVisibleFornecedor = (Visibility)0; + break; + case 4: + ViewModel.IsVisiblePersonalizado = (Visibility)0; + ViewModel.IsVisibleFiltros = (Visibility)2; + ((UIElement)GridFiltros).Visibility = (Visibility)2; + ((HeaderedItemsControl)MenuFiltros).Header = "MOSTRAR FILTROS"; + ViewModel.IsVisibleData = (Visibility)0; + ViewModel.DropDownHeight = 200.0; + break; + } + } + } + + private async void DataGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + if (!(e.EditingElement is TextBox)) + { + return; + } + FrameworkElement editingElement = e.EditingElement; + TextBox box = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + bool atualizar = true; + string stringFormat = e.Column.ClipboardContentBinding.StringFormat; + if (!(stringFormat == "d")) + { + if (!(stringFormat == "c")) + { + if (string.IsNullOrEmpty((box != null) ? box.Text : null)) + { + return; + } + switch (e.Column.SortMemberPath) + { + case "Documento": + if (box.Text.Length <= 50) + { + if (OriginalValue == box.Text) + { + break; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item.Documento = box.Text; + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + else + { + box.Text = string.Empty; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 50"); + } + break; + case "Competencia": + if (box.Text.Length <= 7) + { + box.Text = ValidationHelper.FormatCompetencia(box.Text); + break; + } + box.Text = ""; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 7"); + break; + case "Complemento": + if (box.Text.Length > 15) + { + box.Text = ""; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 15"); + } + break; + } + } + else if (box != null) + { + box.Text = ValidationHelper.FormatCurrency(box.Text); + } + } + else + { + if (box == null) + { + return; + } + box.Text = (string.IsNullOrEmpty(box.Text) ? null : ValidationHelper.FormatDate(box.Text)); + if (e.Column.SortMemberPath == "Vencimento" && string.IsNullOrWhiteSpace(box.Text)) + { + box.Text = ViewModel.SelectedLancamento.Vencimento.ToShortDateString(); + await ViewModel.ShowMessage("VENCIMENTO NÃO PODE SER EM BRANCO"); + return; + } + if (!string.IsNullOrWhiteSpace(box.Text) && !ValidationHelper.ValidateDate(box.Text)) + { + box.Text = ((e.Column.SortMemberPath == "Vencimento") ? ViewModel.SelectedLancamento.Vencimento.ToShortDateString() : null); + await ViewModel.ShowMessage("DATA INVÁLIDA"); + return; + } + string sortMemberPath = e.Column.SortMemberPath; + if (!(sortMemberPath == "Baixa")) + { + if (!(sortMemberPath == "Pagamento") || OriginalValue == box.Text) + { + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item2 in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item2).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item2.Pagamento = (string.IsNullOrEmpty(box.Text) ? null : new DateTime?(DateTime.Parse(box.Text))); + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + else + { + if (OriginalValue == box.Text) + { + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item3 in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item3).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item3.Baixa = (string.IsNullOrEmpty(box.Text) ? null : new DateTime?(DateTime.Parse(box.Text))); + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + if (!_selecionando) + { + _selecionando = true; + ((ToggleButton)(CheckBox)sender).IsChecked = false; + ViewModel.SelecionarTodos(); + _selecionando = false; + } + } + + private void CheckBoxFiltros_Checked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + switch (((FrameworkElement)(CheckBox)sender).Name) + { + case "GridPlanos": + ViewModel.PlanosFiltro.ForEach(delegate(Planos x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.PlanosFiltro = new List<Planos>(ViewModel.PlanosFiltro); + break; + case "GridCentro": + ViewModel.CentroFiltro.ForEach(delegate(Centro x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.CentroFiltro = new List<Centro>(ViewModel.CentroFiltro); + break; + case "GridConta": + ViewModel.ContaFiltro.ForEach(delegate(BancosContas x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.ContaFiltro = new List<BancosContas>(ViewModel.ContaFiltro); + break; + } + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + List<Lancamento> relatorio = ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList(); + if (await ViewModel.ShowMessage("DESEJA CONTINUAR COM A IMPRESSÃO?", "SIM", "NÃO")) + { + bool posicao = await ViewModel.ShowMessage("EM QUAL POSIÇÂO DESEJA IMPRIMIR?", "PAISAGEM (horizontal)", "RETRATO (vertical)"); + await ViewModel.Print(relatorio, posicao); + } + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + List<Lancamento> relatorioGrid = ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList(); + await ViewModel.GerarExcel(relatorioGrid); + } + + private async void AbrirLancamento(Lancamento lancamento) + { + if (ViewModel.SelectedLancamento == null) + { + await ViewModel.ShowMessage("SELECIONE UM LANCAMENTO ANTES DE PROSSEGUIR"); + } + else if (((DomainBase)lancamento).Id <= 0 || lancamento.Controle.Plano != null) + { + ViewModel.SelectedLancamento = lancamento; + ViewModel.VencimentoAlterado = false; + ViewModel.VencimentoAnt = ViewModel.SelectedLancamento.Vencimento; + if (((DomainBase)lancamento).Id > 0) + { + ViewModel.FiltrarLancamento(((DomainBase)lancamento).Id); + } + else + { + ViewModel.FiltrarLancamento(lancamento); + } + ViewModel.Alterando = (Visibility)0; + ViewModel.BuscaHabilitada = false; + ValidarLancamento(); + } + } + + private void ValidarLancamento() + { + if (ViewModel.SelectedLancamento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedLancamento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirLancamento(); + ViewModel.IdLancamento = 0L; + ValidarLancamento(); + } + + private async void SalvarLancamento_OnClick(object sender, RoutedEventArgs e) + { + await Salvar(fechar: true); + } + + private async Task Salvar(bool fechar) + { + IInputElement focusedElement = Keyboard.FocusedElement; + DatePickerTextBox val = (DatePickerTextBox)(object)((focusedElement is DatePickerTextBox) ? focusedElement : null); + if (val != null) + { + ((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate = ValidationHelper.ToDateTime(ValidationHelper.FormatDate(((TextBox)val).Text)); + if (((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate.ToString() == "01/01/0001 00:00:00") + { + ((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate = null; + } + } + bool flag = ViewModel.Importando && ViewModel.Parcelas > 1; + if (flag) + { + flag = !(await ViewModel.ShowMessage($"SERÁ CRIADO COM {ViewModel.Parcelas} PARCELAS, INICIADO POR ESSE LANÇAMENTO, DESEJA PROSSEGUIR?", "SIM", "NÃO")); + } + if (flag) + { + return; + } + ViewModel.Loading(isLoading: true); + if (ViewModel.Importando) + { + ViewModel.BindImportando(); + List<KeyValuePair<string, string>> list = ViewModel.SelectedLancamento.Validate() ?? new List<KeyValuePair<string, string>>(); + if (list.Count > 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + ViewModel.LancamentosFiltrados = ViewModel.Lancamentos; + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.Loading(isLoading: false); + return; + } + ViewModel.Bind(); + List<KeyValuePair<string, string>> list2 = await ViewModel.Salvar(); + bool num = list2 == null || list2.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (fechar) + { + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + await ViewModel.Buscar(); + return; + } + Fornecedor fornecedorInclusao = ViewModel.FornecedorInclusao; + string historico = ViewModel.Historico; + string documento = ViewModel.Documento; + string competencia = ViewModel.Competencia; + string complemento = ViewModel.Complemento; + Planos plano = ViewModel.Plano; + Centro centro = ViewModel.Centro; + BancosContas conta = ViewModel.Conta; + Sinal sinal = ViewModel.Sinal; + int parcelas = ViewModel.Parcelas; + int parcela = ViewModel.Parcela; + DateTime vencimento = ViewModel.Vencimento; + decimal valor = ViewModel.Valor; + DateTime? baixa = ViewModel.Baixa; + decimal? valorPago = ViewModel.ValorPago; + DateTime? pagamento = ViewModel.Pagamento; + TipoPagamento val2 = ViewModel.TipoPagamento; + string observacao = ViewModel.Observacao; + ViewModel.FornecedorInclusao = fornecedorInclusao; + ViewModel.Historico = historico; + ViewModel.Documento = documento; + ViewModel.Competencia = competencia; + ViewModel.Complemento = complemento; + ViewModel.Plano = plano; + ViewModel.Centro = centro; + ViewModel.Conta = conta; + ViewModel.Sinal = sinal; + ViewModel.Parcelas = parcelas; + ViewModel.Parcela = parcela; + ViewModel.Vencimento = vencimento; + ViewModel.Valor = valor; + ViewModel.Baixa = baixa; + ViewModel.ValorPago = valorPago; + ViewModel.Pagamento = pagamento; + ViewModel.TipoPagamento = val2; + ViewModel.Observacao = observacao; + ViewModel.EnableIncluirNovo = true; + } + else + { + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void CancelarAlteracao_OnClick(object sender, RoutedEventArgs e) + { + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.CancelarAlteracao(); + ViewModel.EnableIncluirNovo = false; + } + + private void AutoCompleteBoxDetalhe_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.FiltroPersonalizadoTask(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<FiltroPersonalizado>> 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 FiltroDetalhes_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_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + if (val != null && val.SelectedItem != null && val.IsDropDownOpen) + { + ViewModel.AdicionarFiltro((FiltroPersonalizado)val.SelectedItem); + val.Text = string.Empty; + } + } + + private void ExcluirFiltro_onDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.ExcluirFiltro(val3); + } + } + } + + private void LimparFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.LimparFiltros(); + ViewModel.FiltrarPersonalizado(); + } + + private void EsconderFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.VisibleFiltros = (Visibility)2; + ViewModel.VisibleOlho = (Visibility)0; + } + + private void MostrarFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.VisibleFiltros = (Visibility)0; + ViewModel.VisibleOlho = (Visibility)2; + } + + private async void ExcluirRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirRange(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.CancelarAlteracao(); + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)9).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)9) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedLancamento).Id, + Tipo = (TipoArquivoDigital)9, + Parente = ViewModel.SelectedLancamento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Saldos_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Invalid comparison between Unknown and I4 + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + if (ViewModel.SelectedSaldo != null) + { + string text = "INFORMAÇÕES DO EXTRATO - " + ViewModel.SelectedSaldo.Conta.Descricao; + Window val = Funcoes.IsHosterOpen(text); + if (val != null) + { + val.WindowState = (WindowState)(((int)val.WindowState == 1) ? 2 : ((int)val.WindowState)); + val.Activate(); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new InfoExtratoView(ViewModel.SelectedSaldo), text, 800.0, 450.0, canMaximize: true)).Show(); + } + } + } + + private void IncluirParcela_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirParcela(); + ValidarLancamento(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + Lancamento lancamento = (Lancamento)((FrameworkElement)(Button)sender).DataContext; + ViewModel.VisibilityFornecedor = (Visibility)((!ViewModel.Importando) ? 2 : 0); + ViewModel.BotaoSalvarVisibility = (Visibility)(ViewModel.Importando ? 2 : 0); + AbrirLancamento(lancamento); + ViewModel.Loading(isLoading: false); + } + + private async void ExcluirBaixaRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirBaixaRange(); + } + + private async void ExcluirBaixa_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirBaixa(); + } + + private async void SalvarRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Atualizar(((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList()); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + + private void TrocarFornecedor_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + AbrirLancamento(ViewModel.SelectedLancamento); + ViewModel.VisibilityFornecedor = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + + private void Sintetizar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Sintetizar(); + } + + private void ExtratoConta_OnClick(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 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ((Window)new ExtratoWindow(((DomainBase)((Saldo)((FrameworkElement)val).DataContext).Conta).Id)).Show(); + } + } + + private async void SalvarInclusao_Click(object sender, RoutedEventArgs e) + { + await Salvar(fechar: false); + } + + private async void Transferir_OnClick(object sender, RoutedEventArgs e) + { + Transferencia transferencia = new Transferencia + { + Data = Funcoes.GetNetworkTime().Date + }; + while (true) + { + transferencia = await ViewModel.ShowTransferencia(transferencia); + if (transferencia == null) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(transferencia); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("TRANSFERÊNCIA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)25, ((DomainBase)ViewModel.SelectedLancamento).Id); + } + + private void Unchecked_OnHandler(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 + DataGridCell val = (DataGridCell)sender; + if (((Selector)LancamentoGrid).SelectedItem != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Lancamento val2 = (Lancamento)((dataContext is Lancamento) ? dataContext : null); + if (val2 != null && val2.Selecionado) + { + ViewModel.DeSelecionarLancamento(val2); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + } + } + + private void OnChecked_OnHandler(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 + DataGridCell val = (DataGridCell)sender; + if (((Selector)LancamentoGrid).SelectedItem != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Lancamento val2 = (Lancamento)((dataContext is Lancamento) ? dataContext : null); + if (val2 != null && !val2.Selecionado) + { + ViewModel.SelecionarLancamento(val2); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + } + } + + public void SaveSortLancamentos() + { + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: 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) + _sortDirections = new List<ListSortDirection?>(); + _sortDescriptions = new List<SortDescription>(); + foreach (DataGridColumn column in LancamentoGrid.Columns) + { + _sortDirections.Add(column.SortDirection); + } + foreach (SortDescription item in (Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions) + { + _sortDescriptions.Add(item); + } + } + + public void SortLancamentos() + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + if (_sortDirections == null || _sortDirections.Count != LancamentoGrid.Columns.Count) + { + return; + } + foreach (DataGridColumn column in LancamentoGrid.Columns) + { + column.SortDirection = _sortDirections[LancamentoGrid.Columns.IndexOf(column)]; + } + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions).Clear(); + foreach (SortDescription sortDescription in _sortDescriptions) + { + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions).Add(sortDescription); + } + } + + private void LancamentoGrid_OnPreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e) + { + if (((object)e.Column).GetType().Name != "DataGridTextColumn") + { + LancamentoGrid.CancelEdit(); + LancamentoGrid.CancelEdit(); + } + FrameworkElement editingElement = e.EditingElement; + TextBox val = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + if (val != null) + { + OriginalValue = val.Text; + } + } + + private async void TipoPagamento_OnDropDownClosed(object sender, EventArgs e) + { + if (tipoPagamento == (TipoPagamento?)(TipoPagamento)((Selector)(ComboBox)sender).SelectedItem) + { + tipoPagamento = null; + } + else + { + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + return; + } + tipoPagamento = null; + foreach (Lancamento item in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + item.TipoPagamento = (TipoPagamento)((Selector)(ComboBox)sender).SelectedItem; + } + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + } + + private void TipoPagamento_DropDownOpened(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + if (((Selector)(ComboBox)sender).SelectedItem != null) + { + tipoPagamento = (TipoPagamento)((Selector)(ComboBox)sender).SelectedItem; + } + else + { + tipoPagamento = null; + } + } + + private async void ImportarOfx_Click(object sender, RoutedEventArgs e) + { + await ImportarOfx(); + } + + private async Task ImportarOfx() + { + if (ViewModel.ContasFiltradas == null || ViewModel.ContasFiltradas.Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ CONTAS CADASTRADAS PARA REALIZAR A IMPORTAÇÃO."); + return; + } + BancosContas val = ((ViewModel.ContasFiltradas.Count <= 1) ? ViewModel.ContasFiltradas.First() : (await ViewModel.ShowContas(ViewModel.ContasFiltradas.ToList()))); + BancosContas val2 = val; + if (val2 != null) + { + ViewModel.Loading(isLoading: true); + await ViewModel.ParseOfx(val2); + ViewModel.Loading(isLoading: false); + } + } + + private async void SalvarImportacao_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("DESEJA PROSSEGUIR COM A IMPORTAÇÃO?" + Environment.NewLine + Environment.NewLine + "SOMENTE OS LANÇAMENTOS VÁLIDOS SERÃO ALTERADOS OU INCLUÍDOS", "SIM", "NÃO")) + { + ViewModel.Loading(isLoading: true); + List<Lancamento> list = ViewModel.Lancamentos.Where((Lancamento x) => x.Validate().Count == 0).ToList(); + if (await ViewModel.SalvarImportacao(list)) + { + ViewModel.Importando = false; + } + ViewModel.Loading(isLoading: false); + } + } + + private async void CancelarImportacao_Click(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Importando = false; + await ViewModel.Buscar(); + ViewModel.Loading(isLoading: false); + } + + private async void BuscarLancamentos_Click(object sender, RoutedEventArgs e) + { + if (ViewModel.FornecedorInclusao == null || ViewModel.FornecedorInclusao.Id == 0L) + { + await ViewModel.ShowMessage("É NECESSÁRIO PESQUISAR O FORNECEDOR AO LADO PARA VINCULAR UM LANÇAMENTO A ESSA MOVIMENTAÇÃO."); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.BuscarLancamentosVinculo(); + ViewModel.Loading(isLoading: false); + await AbrirVinculo(); + } + + private async Task AbrirVinculo() + { + if (ViewModel.LancamentosVinculo.Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ LANÇAMENTOS CRIADOS PARA O FORNECEDOR SELECIONADO."); + return; + } + Lancamento lancamento = await ViewModel.ShowVinculo(ViewModel); + if (lancamento != null) + { + if (!(await ViewModel.ShowMessage($"DESEJA VINCULAR O LANÇAMENTO {((DomainBase)ViewModel.LancamentoVinculo).Id} A MOVIMENTAÇÃO SELECIONADA?", "SIM", "NÃO"))) + { + await AbrirVinculo(); + } + ViewModel.FeedImportando(lancamento); + ViewModel.BindImportando(); + } + } + + private void Pendentes_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)0; + ViewModel.FiltroImportacao(); + } + + private void Baixados_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)1; + ViewModel.FiltroImportacao(); + } + + private void Todos_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)2; + ViewModel.FiltroImportacao(); + } + + private void Filtrar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void AdicionarFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.LimparFiltros(); + ViewModel.AdicionarFiltros(); + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)25, ((DomainBase)ViewModel.SelectedLancamento).Id); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltroPersonalizado(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.PersonalizadoSelecionado.Remove(val3); + ViewModel.PesquisaPersonalizada(); + } + } + } + + private void MostrarFiltros_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Invalid comparison between Unknown and I4 + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + MenuItem val = (MenuItem)sender; + ((UIElement)GridFiltros).Visibility = (Visibility)(((int)((UIElement)GridFiltros).Visibility != 2) ? 2 : 0); + ((HeaderedItemsControl)val).Header = (((int)((UIElement)GridFiltros).Visibility == 2) ? "MOSTRAR FILTROS" : "ESCONDER FILTROS"); + } + + private new void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + public new void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs 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) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/financeiroview.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_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Expected O, but got Unknown + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Expected O, but got Unknown + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Expected O, but got Unknown + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Expected O, but got Unknown + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Expected O, but got Unknown + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01d6: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Expected O, but got Unknown + //IL_01e1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ed: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Expected O, but got Unknown + //IL_0212: Unknown result type (might be due to invalid IL or missing references) + //IL_021c: 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_0235: 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_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_0263: 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_0289: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Expected O, but got Unknown + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Unknown result type (might be due to invalid IL or missing references) + //IL_02c3: Expected O, but got Unknown + //IL_02c5: Unknown result type (might be due to invalid IL or missing references) + //IL_02d1: Unknown result type (might be due to invalid IL or missing references) + //IL_02db: Expected O, but got Unknown + //IL_02dd: Unknown result type (might be due to invalid IL or missing references) + //IL_02e9: Unknown result type (might be due to invalid IL or missing references) + //IL_02f3: Expected O, but got Unknown + //IL_02f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030b: Expected O, but got Unknown + //IL_030d: Unknown result type (might be due to invalid IL or missing references) + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Expected O, but got Unknown + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_033b: Expected O, but got Unknown + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0349: Unknown result type (might be due to invalid IL or missing references) + //IL_0353: Expected O, but got Unknown + //IL_0355: Unknown result type (might be due to invalid IL or missing references) + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Expected O, but got Unknown + //IL_036d: Unknown result type (might be due to invalid IL or missing references) + //IL_0379: Unknown result type (might be due to invalid IL or missing references) + //IL_0383: Expected O, but got Unknown + //IL_0385: Unknown result type (might be due to invalid IL or missing references) + //IL_0391: Unknown result type (might be due to invalid IL or missing references) + //IL_039b: Expected O, but got Unknown + //IL_039d: Unknown result type (might be due to invalid IL or missing references) + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03c1: Unknown result type (might be due to invalid IL or missing references) + //IL_03cb: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d9: Unknown result type (might be due to invalid IL or missing references) + //IL_03e3: Expected O, but got Unknown + //IL_03e5: Unknown result type (might be due to invalid IL or missing references) + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_03fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0409: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Expected O, but got Unknown + //IL_0416: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Expected O, but got Unknown + //IL_0422: Unknown result type (might be due to invalid IL or missing references) + //IL_042e: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Expected O, but got Unknown + //IL_0439: Unknown result type (might be due to invalid IL or missing references) + //IL_0445: Unknown result type (might be due to invalid IL or missing references) + //IL_044f: Expected O, but got Unknown + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045c: Unknown result type (might be due to invalid IL or missing references) + //IL_0466: Expected O, but got Unknown + //IL_0468: Unknown result type (might be due to invalid IL or missing references) + //IL_0474: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Expected O, but got Unknown + //IL_047f: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Expected O, but got Unknown + //IL_0496: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Unknown result type (might be due to invalid IL or missing references) + //IL_04ac: Expected O, but got Unknown + //IL_04ae: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Unknown result type (might be due to invalid IL or missing references) + //IL_04c4: Expected O, but got Unknown + //IL_04c6: Unknown result type (might be due to invalid IL or missing references) + //IL_04d2: Unknown result type (might be due to invalid IL or missing references) + //IL_04dc: Expected O, but got Unknown + //IL_04de: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Unknown result type (might be due to invalid IL or missing references) + //IL_04f4: Expected O, but got Unknown + //IL_04f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0501: Expected O, but got Unknown + //IL_0531: Unknown result type (might be due to invalid IL or missing references) + //IL_053d: Unknown result type (might be due to invalid IL or missing references) + //IL_0547: Expected O, but got Unknown + //IL_0549: Unknown result type (might be due to invalid IL or missing references) + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_055f: Expected O, but got Unknown + //IL_0561: Unknown result type (might be due to invalid IL or missing references) + //IL_056d: Unknown result type (might be due to invalid IL or missing references) + //IL_0577: Expected O, but got Unknown + //IL_0579: Unknown result type (might be due to invalid IL or missing references) + //IL_0585: Unknown result type (might be due to invalid IL or missing references) + //IL_058f: Expected O, but got Unknown + //IL_0591: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Unknown result type (might be due to invalid IL or missing references) + //IL_05a7: Expected O, but got Unknown + //IL_05a9: Unknown result type (might be due to invalid IL or missing references) + //IL_05b5: Unknown result type (might be due to invalid IL or missing references) + //IL_05bf: Expected O, but got Unknown + //IL_05c1: Unknown result type (might be due to invalid IL or missing references) + //IL_05cd: Unknown result type (might be due to invalid IL or missing references) + //IL_05d7: Expected O, but got Unknown + //IL_05d9: Unknown result type (might be due to invalid IL or missing references) + //IL_05e5: Unknown result type (might be due to invalid IL or missing references) + //IL_05ef: Expected O, but got Unknown + //IL_05f1: Unknown result type (might be due to invalid IL or missing references) + //IL_05fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0607: Expected O, but got Unknown + //IL_060a: Unknown result type (might be due to invalid IL or missing references) + //IL_0614: Expected O, but got Unknown + //IL_0621: Unknown result type (might be due to invalid IL or missing references) + //IL_062b: Expected O, but got Unknown + //IL_062d: Unknown result type (might be due to invalid IL or missing references) + //IL_0639: Unknown result type (might be due to invalid IL or missing references) + //IL_0643: Expected O, but got Unknown + //IL_0645: Unknown result type (might be due to invalid IL or missing references) + //IL_0651: Unknown result type (might be due to invalid IL or missing references) + //IL_065b: Expected O, but got Unknown + //IL_065c: Unknown result type (might be due to invalid IL or missing references) + //IL_0668: Unknown result type (might be due to invalid IL or missing references) + //IL_0672: Expected O, but got Unknown + //IL_0673: Unknown result type (might be due to invalid IL or missing references) + //IL_067f: Unknown result type (might be due to invalid IL or missing references) + //IL_0689: Expected O, but got Unknown + //IL_068b: Unknown result type (might be due to invalid IL or missing references) + //IL_0697: Unknown result type (might be due to invalid IL or missing references) + //IL_06a1: Expected O, but got Unknown + //IL_06a2: Unknown result type (might be due to invalid IL or missing references) + //IL_06ae: Unknown result type (might be due to invalid IL or missing references) + //IL_06b8: Expected O, but got Unknown + //IL_06b9: Unknown result type (might be due to invalid IL or missing references) + //IL_06c5: Unknown result type (might be due to invalid IL or missing references) + //IL_06cf: Expected O, but got Unknown + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06dd: Unknown result type (might be due to invalid IL or missing references) + //IL_06e7: Expected O, but got Unknown + //IL_06e8: Unknown result type (might be due to invalid IL or missing references) + //IL_06f4: Unknown result type (might be due to invalid IL or missing references) + //IL_06fe: Expected O, but got Unknown + //IL_06ff: Unknown result type (might be due to invalid IL or missing references) + //IL_070b: Unknown result type (might be due to invalid IL or missing references) + //IL_0715: Expected O, but got Unknown + //IL_0717: Unknown result type (might be due to invalid IL or missing references) + //IL_0723: Unknown result type (might be due to invalid IL or missing references) + //IL_072d: Expected O, but got Unknown + //IL_072f: Unknown result type (might be due to invalid IL or missing references) + switch (connectionId) + { + case 1: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoFiltrosBox_OnSelectionChanged); + break; + case 2: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + AutoCompleteFornecedor = (AutoCompleteBox)target; + AutoCompleteFornecedor.Populating += new PopulatingEventHandler(AutoCompleteFornecedor_OnPopulating); + break; + case 5: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxDetalhe_Populating); + ((AutoCompleteBox)target).SelectionChanged += new SelectionChangedEventHandler(FiltroDetalhes_OnSelectionChanged); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MostrarFiltros_OnClick); + break; + case 7: + MenuFiltros = (MenuItem)target; + MenuFiltros.Click += new RoutedEventHandler(MostrarFiltros_Click); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Pendentes_Click); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Baixados_Click); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Todos_Click); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarImportacao_Click); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarImportacao_Click); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Buscar_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Sintetizar_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(TrocarFornecedor_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarRange_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirParcela_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirBaixaRange_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirRange_OnClick); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(Transferir_OnClick); + break; + case 24: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 25: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(ImportarOfx_Click); + break; + case 27: + ((MenuItem)target).Click += new RoutedEventHandler(Filtrar_OnClick); + break; + case 28: + GridFiltros = (Grid)target; + break; + case 29: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 30: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 34: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(LimparFiltros_OnClick); + break; + case 35: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EsconderFiltros_OnClick); + break; + case 36: + LancamentoGrid = (DataGrid)target; + LancamentoGrid.CellEditEnding += DataGrid_OnCellEditEnding; + LancamentoGrid.PreparingCellForEdit += LancamentoGrid_OnPreparingCellForEdit; + break; + case 42: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltros_OnClick); + break; + case 43: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 47: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 48: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarInclusao_Click); + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarLancamento_OnClick); + break; + case 50: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarAlteracao_OnClick); + break; + case 51: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirBaixa_OnClick); + break; + case 52: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 53: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 54: + AutoCompleteFornecedorInclusao = (AutoCompleteBox)target; + AutoCompleteFornecedorInclusao.Populating += new PopulatingEventHandler(AutoCompleteFornecedorAtivo_OnPopulating); + break; + case 55: + ((MenuItem)target).Click += new RoutedEventHandler(BuscarLancamentos_Click); + break; + case 56: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 57: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 58: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 59: + ((Control)(DataGrid)target).MouseDoubleClick += new MouseButtonEventHandler(Saldos_OnMouseDoubleClick); + break; + case 61: + ((DataGrid)target).CellEditEnding += DataGrid_OnCellEditEnding; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Expected O, but got Unknown + //IL_0105: 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_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Expected O, but got Unknown + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + //IL_01a5: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Expected O, but got Unknown + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Expected O, but got Unknown + //IL_01d4: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected O, but got Unknown + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //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_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + switch (connectionId) + { + case 32: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 33: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onDeleteClick); + break; + case 37: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 38: + { + EventSetter val = new EventSetter(); + val.Event = ToggleButton.CheckedEvent; + val.Handler = (Delegate)new RoutedEventHandler(OnChecked_OnHandler); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + val = new EventSetter(); + val.Event = ToggleButton.UncheckedEvent; + val.Handler = (Delegate)new RoutedEventHandler(Unchecked_OnHandler); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + case 39: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 41: + ((ComboBox)target).DropDownOpened += TipoPagamento_DropDownOpened; + ((ComboBox)target).DropDownClosed += TipoPagamento_OnDropDownClosed; + break; + case 44: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 45: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 46: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 60: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExtratoConta_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs new file mode 100644 index 0000000..bd3728d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs @@ -0,0 +1,432 @@ +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 Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Financeiro; + +public class FornecedorView : BaseUserControl, IComponentConnector +{ + internal DataGrid FornecedorGrid; + + internal TextBox NomeBox; + + internal TextBox DocumentoPrincipalBox; + + internal ToggleButton AtivoBox; + + internal TextBox CepBox; + + internal ProgressBar ProgressCep; + + internal TextBox EnderecoBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + internal ComboBox PlanoBox; + + internal ComboBox CentroBox; + + internal ComboBox ContaBox; + + internal ComboBox TipoPagamentoBox; + + private bool _contentLoaded; + + public FornecedorViewModel ViewModel { get; set; } + + public FornecedorView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE FORNECEDORES"; + ViewModel = new FornecedorViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> 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.FiltrarFornecedor(""); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void ScrollToItem() + { + if (((Selector)FornecedorGrid).SelectedItem != null) + { + ((UIElement)FornecedorGrid).UpdateLayout(); + FornecedorGrid.ScrollIntoView(((Selector)FornecedorGrid).SelectedItem); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedFornecedor).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) + { + ScrollToItem(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_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.CancelProduto = (Fornecedor)((DomainBase)ViewModel.SelectedFornecedor).Clone(); + ViewModel.CancelarAlteracao(); + ScrollToItem(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Delete(); + ScrollToItem(); + } + + private void DocumentoPrincipalBox_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 async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)10).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)10) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ViewModel.SelectedFornecedor.Id, + Tipo = (TipoArquivoDigital)10, + Parente = ViewModel.SelectedFornecedor + }; + 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)24, ViewModel.SelectedFornecedor.Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)24, ViewModel.SelectedFornecedor.Id); + } + + private async void CopiarDados_OnClick(object sender, RoutedEventArgs e) + { + Cliente cliente = await ViewModel.ShowCopiarCliente(); + if (cliente != null) + { + ViewModel.Incluir(); + Cliente val = cliente; + val.Enderecos = await new ClienteServico().BuscarEnderecosAsync(((DomainBase)cliente).Id); + val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)cliente).Id); + ViewModel.Copiar(cliente); + } + } + + private void Excel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excel(); + } + + private void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Imprimir(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/fornecedorview.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_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //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_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Expected O, but got Unknown + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + //IL_01ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0209: Expected O, but got Unknown + //IL_020c: Unknown result type (might be due to invalid IL or missing references) + //IL_0216: Expected O, but got Unknown + //IL_0219: Unknown result type (might be due to invalid IL or missing references) + //IL_0223: Expected O, but got Unknown + //IL_0230: Unknown result type (might be due to invalid IL or missing references) + //IL_023a: Expected O, but got Unknown + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Expected O, but got Unknown + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_026c: Expected O, but got Unknown + //IL_026f: Unknown result type (might be due to invalid IL or missing references) + //IL_0279: Expected O, but got Unknown + //IL_027c: Unknown result type (might be due to invalid IL or missing references) + //IL_0286: Expected O, but got Unknown + //IL_0289: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ac: 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_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02d2: Expected O, but got Unknown + //IL_02d5: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Expected O, but got Unknown + //IL_02e2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ec: Expected O, but got Unknown + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteFornecedor_OnPopulating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Excel_OnClick); + break; + case 4: + FornecedorGrid = (DataGrid)target; + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(CopiarDados_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 14: + NomeBox = (TextBox)target; + break; + case 15: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_OnLostFocus); + break; + case 16: + AtivoBox = (ToggleButton)target; + break; + case 17: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 18: + ProgressCep = (ProgressBar)target; + break; + case 19: + EnderecoBox = (TextBox)target; + break; + case 20: + BairroBox = (TextBox)target; + break; + case 21: + CidadeBox = (TextBox)target; + break; + case 22: + EstadoBox = (TextBox)target; + break; + case 23: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 24: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 25: + PlanoBox = (ComboBox)target; + break; + case 26: + CentroBox = (ComboBox)target; + break; + case 27: + ContaBox = (ComboBox)target; + break; + case 28: + TipoPagamentoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs new file mode 100644 index 0000000..387a9f0 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs @@ -0,0 +1,148 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Views.Financeiro; + +public class InfoExtratoView : BaseUserControl, IComponentConnector +{ + private bool _buttonClickable; + + private bool _contentLoaded; + + public InfoExtratoViewModel ViewModel { get; set; } + + public InfoExtratoView(Saldo saldo, bool telaBancos = false) + { + ViewModel = new InfoExtratoViewModel(telaBancos); + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.SelectedSaldo = saldo; + InitializeComponent(); + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/infoextratoview.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_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs new file mode 100644 index 0000000..eaf4fca --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs @@ -0,0 +1,116 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class PlanoView : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public PlanoViewModel ViewModel { get; set; } + + public PlanoView(Plano plano) + { + ViewModel = new PlanoViewModel(plano); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + 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.Cancel = (Plano)((DomainBase)ViewModel.SelectedPlano).Clone(); + ViewModel.Alterar(alterar: true); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Cancelar(); + } + + 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"); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/planoview.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_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected O, but got Unknown + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).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; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs b/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs new file mode 100644 index 0000000..42abf6d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs @@ -0,0 +1,326 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +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.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class PlanosView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__3_0; + + public static Func<Plano, bool> _003C_003E9__3_1; + + public static Func<Plano, string> _003C_003E9__3_2; + + public static Func<Plano, bool> _003C_003E9__11_6; + + public static Func<Plano, string> _003C_003E9__11_7; + + public static Func<Planos, bool> _003C_003E9__11_0; + + public static Func<Planos, string> _003C_003E9__11_1; + + public static Func<Planos, string> _003C_003E9__11_2; + + public static Func<Planos, long> _003C_003E9__11_3; + + internal void _003CContentLoad_003Eb__3_0(object sender, MouseButtonEventArgs args) + { + } + + internal bool _003CContentLoad_003Eb__3_1(Plano x) + { + return x.Ativo; + } + + internal string _003CContentLoad_003Eb__3_2(Plano x) + { + return x.Descricao; + } + + internal bool _003CPlanoButton_OnClick_003Eb__11_6(Plano x) + { + return x.Ativo; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_7(Plano x) + { + return x.Descricao; + } + + internal bool _003CPlanoButton_OnClick_003Eb__11_0(Planos x) + { + return x.Ativo; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_1(Planos x) + { + Plano plano = x.Plano; + if (plano == null) + { + return null; + } + return plano.Descricao; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_2(Planos x) + { + return x.Descricao; + } + + internal long _003CPlanoButton_OnClick_003Eb__11_3(Planos p) + { + return ((DomainBase)p).Id; + } + } + + private bool _seleciona = true; + + public PlanosViewModel ViewModel; + + internal DataGrid PlanosGrid; + + private bool _contentLoaded; + + public PlanosView() + { + ((FrameworkElement)this).Tag = "PLANO DE CONTAS"; + ViewModel = new PlanosViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((Selector)PlanosGrid).SelectedIndex = 0; + ((Selector)PlanosGrid).SelectionChanged += new SelectionChangedEventHandler(PlanosGrid_OnSelectionChanged); + DataGrid planosGrid = PlanosGrid; + object obj = _003C_003Ec._003C_003E9__3_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__3_0 = val; + obj = (object)val; + } + ((Control)planosGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + PlanosViewModel viewModel = ViewModel; + viewModel.Plano = new ObservableCollection<Plano>((from x in await new BaseServico().BuscarPlanoAsync() + orderby x.Ativo descending, x.Descricao + select x).ToList()); + } + + private async void PlanosGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (_seleciona) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaPlanos((Planos)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + } + + private void CancelarPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void SalvarPlanos_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 AlterarPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedPlanos).Initialize(); + } + + private void IncluirPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void AutoCompleteBoxPlanos_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.FiltrarPlanos(""); + } + } + + private void AutoCompleteBoxPlanos_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<ObservableCollection<Planos>> searchResult) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (searchResult != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void PlanoButton_OnClick(object sender, RoutedEventArgs e) + { + PlanoView planoView = new PlanoView(ViewModel.SelectedPlanos.Plano); + ((Window)new HosterWindow((ContentControl)(object)planoView, "PLANO", 500.0, 200.0)).ShowDialog(); + ViewModel.Loading(isLoading: true); + if (((DomainBase)planoView.ViewModel.SelectedPlano).Id != 0L) + { + PlanosViewModel viewModel = ViewModel; + viewModel.Plano = new ObservableCollection<Plano>((from x in await new BaseServico().BuscarPlanoAsync() + orderby x.Ativo descending, x.Descricao + select x).ToList()); + List<Planos> source = await new BaseServico().BuscarPlanosAsync(); + ViewModel.Planos = source.OrderByDescending((Planos x) => x.Ativo).ThenBy(delegate(Planos x) + { + Plano plano = x.Plano; + return (plano == null) ? null : plano.Descricao; + }).ThenBy((Planos x) => x.Descricao) + .ToList(); + List<long> ids = ViewModel.PlanosFiltrados.Select((Planos p) => ((DomainBase)p).Id).ToList(); + ViewModel.PlanosFiltrados = new ObservableCollection<Planos>(ViewModel.Planos.Where((Planos x) => ids.Contains(((DomainBase)x).Id))); + _seleciona = false; + ((Selector)PlanosGrid).SelectedItem = ViewModel.SelectedPlanos; + ViewModel.SelectedPlano = ViewModel.Plano.First((Plano x) => ((DomainBase)x).Id == ((DomainBase)planoView.ViewModel.SelectedPlano).Id); + _seleciona = true; + } + ViewModel.Loading(isLoading: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)28, ((DomainBase)ViewModel.SelectedPlanos).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/planosview.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_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxPlanos_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxPlanos_OnTextChanged); + break; + case 2: + PlanosGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirPlanos_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarPlanos_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarPlanos_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarPlanos_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(PlanoButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |