summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs')
-rw-r--r--Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs174
1 files changed, 174 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs
new file mode 100644
index 0000000..c0bbe85
--- /dev/null
+++ b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs
@@ -0,0 +1,174 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.Actions;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Componentes;
+
+public class DialogEditarParcelas : UserControl, IComponentConnector
+{
+ internal Snackbar Snackbar;
+
+ internal DataGrid ParcelaGrid;
+
+ internal DataGridTextColumn ParcelaColumn;
+
+ internal Label LabelStatus;
+
+ internal Button SalvarButton;
+
+ internal Button FecharButton;
+
+ private bool _contentLoaded;
+
+ public DialogEditarParcelasViewModel ViewModel { get; set; }
+
+ public DialogEditarParcelas(Documento documento)
+ {
+ ViewModel = new DialogEditarParcelasViewModel(documento);
+ ((FrameworkElement)this).DataContext = ViewModel;
+ Gestor.Application.Actions.Actions.AcionarSnackbar = (Action<string>)Delegate.Remove(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action<string>(AcionarSnackBar));
+ Gestor.Application.Actions.Actions.AcionarSnackbar = (Action<string>)Delegate.Combine(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action<string>(AcionarSnackBar));
+ InitializeComponent();
+ }
+
+ private void AcionarSnackBar(string message)
+ {
+ Snackbar.IsActive = true;
+ ((ContentControl)Snackbar.Message).Content = message;
+ }
+
+ private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+ {
+ Snackbar.IsActive = false;
+ }
+
+ private async void SalvarButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (await ViewModel.SalvarParcelas())
+ {
+ DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton);
+ }
+ }
+
+ private void FecharButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton);
+ }
+
+ private void ParcelaGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
+ {
+ //IL_0019: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001f: Expected O, but got Unknown
+ //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ff: Expected O, but got Unknown
+ if (!(e.EditingElement is TextBox))
+ {
+ return;
+ }
+ Parcela val = (Parcela)((FrameworkElement)e.Row).DataContext;
+ FrameworkElement editingElement = e.EditingElement;
+ TextBox val2 = (TextBox)(object)((editingElement is TextBox) ? editingElement : null);
+ if (val2 == null)
+ {
+ return;
+ }
+ if (e.Column.ClipboardContentBinding.StringFormat == "d")
+ {
+ val2.Text = ValidationHelper.FormatDate(val2.Text);
+ if (e.Column.Header.ToString() == "VENCIMENTO")
+ {
+ val.Vencimento = ((string.IsNullOrWhiteSpace(val2.Text) || !DateTime.TryParse(val2.Text, out var _)) ? DateTime.MinValue : DateTime.Parse(val2.Text));
+ }
+ }
+ string text = e.Column.Header.ToString();
+ if (!(text == "VALOR"))
+ {
+ if (text == "VENCIMENTO")
+ {
+ ViewModel.AlterandoVencimento((Parcela)((FrameworkElement)e.Row).DataContext);
+ }
+ }
+ else
+ {
+ ViewModel.AlterandoValor();
+ }
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/componentes/dialogeditarparcelas.xaml", UriKind.Relative);
+ Application.LoadComponent((object)this, uri);
+ }
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void IComponentConnector.Connect(int connectionId, object target)
+ {
+ //IL_002b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0035: Expected O, but got Unknown
+ //IL_0037: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0043: Unknown result type (might be due to invalid IL or missing references)
+ //IL_004d: Expected O, but got Unknown
+ //IL_0050: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005a: 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_0081: Unknown result type (might be due to invalid IL or missing references)
+ //IL_008b: Expected O, but got Unknown
+ //IL_008e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0098: Expected O, but got Unknown
+ //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00af: Expected O, but got Unknown
+ //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00bc: Expected O, but got Unknown
+ //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d3: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 1:
+ Snackbar = (Snackbar)target;
+ break;
+ case 2:
+ ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+ break;
+ case 3:
+ ParcelaGrid = (DataGrid)target;
+ ParcelaGrid.CellEditEnding += ParcelaGrid_OnCellEditEnding;
+ break;
+ case 4:
+ ParcelaColumn = (DataGridTextColumn)target;
+ break;
+ case 5:
+ LabelStatus = (Label)target;
+ break;
+ case 6:
+ SalvarButton = (Button)target;
+ ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick);
+ break;
+ case 7:
+ FecharButton = (Button)target;
+ ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick);
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}