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