summaryrefslogtreecommitdiff
path: root/Gestor.Application/Componentes/DialogExtratoComissao.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
commit674ca83ba9243a9e95a7568c797668dab6aee26a (patch)
tree4a905b3fb1d827665a34d63f67bc5559f8e7235b /Gestor.Application/Componentes/DialogExtratoComissao.cs
downloadgestor-674ca83ba9243a9e95a7568c797668dab6aee26a.tar.gz
gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.zip
feat: upload files
Diffstat (limited to 'Gestor.Application/Componentes/DialogExtratoComissao.cs')
-rw-r--r--Gestor.Application/Componentes/DialogExtratoComissao.cs207
1 files changed, 207 insertions, 0 deletions
diff --git a/Gestor.Application/Componentes/DialogExtratoComissao.cs b/Gestor.Application/Componentes/DialogExtratoComissao.cs
new file mode 100644
index 0000000..f408d36
--- /dev/null
+++ b/Gestor.Application/Componentes/DialogExtratoComissao.cs
@@ -0,0 +1,207 @@
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+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;
+
+namespace Gestor.Application.Componentes
+{
+ public class DialogExtratoComissao : BaseUserControl, IComponentConnector, IStyleConnector
+ {
+ public ExtratoComissaoViewModel ViewModel;
+
+ internal ComboBox SeguradoraBox;
+
+ internal ComboBox SeguradoraSocialBox;
+
+ internal DatePicker InicioBox;
+
+ internal DatePicker FimBox;
+
+ internal System.Windows.Controls.ProgressBar ProgressBar;
+
+ internal DataGrid ExtratoGrid;
+
+ internal Button ImportarButton;
+
+ internal Button FecharButton;
+
+ private bool _contentLoaded;
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ internal Delegate _CreateDelegate(Type delegateType, string handler)
+ {
+ return Delegate.CreateDelegate(delegateType, this, handler);
+ }
+
+ public DialogExtratoComissao(List<Seguradora> seguradoras)
+ {
+ this.InitializeComponent();
+ this.ViewModel = new ExtratoComissaoViewModel(seguradoras);
+ base.DataContext = this.ViewModel;
+ this.InitializeComponent();
+ System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher;
+ if (dispatcher == null)
+ {
+ return;
+ }
+ dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad));
+ }
+
+ private async void CarregarExtratos()
+ {
+ if (this.SeguradoraBox.SelectedItem != null && this.InicioBox.SelectedDate.HasValue && this.FimBox.SelectedDate.HasValue)
+ {
+ this.ViewModel.IsEnabled = false;
+ this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
+ ExtratoComissaoViewModel viewModel = this.ViewModel;
+ Seguradora selectedItem = (Seguradora)this.SeguradoraBox.SelectedItem;
+ DateTime value = this.InicioBox.SelectedDate.Value;
+ DateTime? selectedDate = this.FimBox.SelectedDate;
+ await viewModel.CarregarExtratos(selectedItem, value, selectedDate.Value);
+ this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
+ this.ViewModel.IsEnabled = true;
+ }
+ }
+
+ private void CheckBox_Checked(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.SelecionarTudo();
+ }
+
+ private void ContentLoad()
+ {
+ this.InicioBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DataBox_SelectedDateChanged);
+ this.FimBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.DataBox_SelectedDateChanged);
+ this.SeguradoraBox.SelectionChanged += new SelectionChangedEventHandler(this.SeguradoraBox_SelectionChanged);
+ this.SeguradoraSocialBox.SelectionChanged += new SelectionChangedEventHandler(this.SeguradoraSicialBox_SelectionChanged);
+ }
+
+ private void DataBox_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.CarregarExtratos();
+ }
+
+ private void Fechar_OnClick(object sender, RoutedEventArgs e)
+ {
+ DialogHost.CloseDialogCommand.Execute(null, this.FecharButton);
+ }
+
+ private void Importar_OnClick(object sender, RoutedEventArgs e)
+ {
+ DialogHost.CloseDialogCommand.Execute(this.ViewModel.Selecionar(), this.ImportarButton);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (this._contentLoaded)
+ {
+ return;
+ }
+ this._contentLoaded = true;
+ System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/componentes/dialogextratocomissao.xaml", UriKind.Relative));
+ }
+
+ private void SeguradoraBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.CarregarExtratos();
+ }
+
+ private void SeguradoraSicialBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.SeguradoraBox.SelectedItem = this.SeguradoraSocialBox.SelectedItem;
+ this.CarregarExtratos();
+ }
+
+ [DebuggerNonUserCode]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
+ {
+ switch (connectionId)
+ {
+ case 1:
+ {
+ this.SeguradoraBox = (ComboBox)target;
+ return;
+ }
+ case 2:
+ {
+ this.SeguradoraSocialBox = (ComboBox)target;
+ return;
+ }
+ case 3:
+ {
+ this.InicioBox = (DatePicker)target;
+ this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ return;
+ }
+ case 4:
+ {
+ this.FimBox = (DatePicker)target;
+ this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ return;
+ }
+ case 5:
+ {
+ this.ProgressBar = (System.Windows.Controls.ProgressBar)target;
+ return;
+ }
+ case 6:
+ {
+ this.ExtratoGrid = (DataGrid)target;
+ return;
+ }
+ case 7:
+ {
+ this._contentLoaded = true;
+ return;
+ }
+ case 8:
+ {
+ this.ImportarButton = (Button)target;
+ this.ImportarButton.Click += new RoutedEventHandler(this.Importar_OnClick);
+ return;
+ }
+ case 9:
+ {
+ this.FecharButton = (Button)target;
+ this.FecharButton.Click += new RoutedEventHandler(this.Fechar_OnClick);
+ return;
+ }
+ default:
+ {
+ this._contentLoaded = true;
+ return;
+ }
+ }
+ }
+
+ [DebuggerNonUserCode]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target)
+ {
+ if (connectionId == 7)
+ {
+ ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
+ ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
+ }
+ }
+ }
+} \ No newline at end of file