summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs411
1 files changed, 411 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);
+ }
+ }
+}