diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:35:25 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:35:25 +0000 |
| commit | 674ca83ba9243a9e95a7568c797668dab6aee26a (patch) | |
| tree | 4a905b3fb1d827665a34d63f67bc5559f8e7235b /Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs | |
| download | gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.tar.gz gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.zip | |
feat: upload files
Diffstat (limited to 'Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs')
| -rw-r--r-- | Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs | 252 |
1 files changed, 252 insertions, 0 deletions
diff --git a/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs b/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs new file mode 100644 index 0000000..f57ac7c --- /dev/null +++ b/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs @@ -0,0 +1,252 @@ +using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Ferramentas;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Application.Views.Generic;
+using Gestor.Application.Views.Seguros;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Relatorios;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+using System;
+using System.CodeDom.Compiler;
+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.Input;
+using System.Windows.Markup;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Views.Ferramentas
+{
+ public class ManutencaoPagamentosView : BaseUserControl, IComponentConnector, IStyleConnector
+ {
+ private bool _contentLoaded;
+
+ public ManutencaoPagamentosViewModel ViewModel
+ {
+ get;
+ set;
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ internal Delegate _CreateDelegate(Type delegateType, string handler)
+ {
+ return Delegate.CreateDelegate(delegateType, this, handler);
+ }
+
+ public ManutencaoPagamentosView()
+ {
+ base.Tag = "MANUTENÇÃO DE PAGAMENTOS";
+ this.ViewModel = new ManutencaoPagamentosViewModel();
+ base.DataContext = this.ViewModel;
+ this.InitializeComponent();
+ }
+
+ private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.AdcionarFiltroPersonalizado();
+ }
+
+ private async void Apolice_OnClick(object sender, RoutedEventArgs e)
+ {
+ ManutencaoPagamentos dataContext = (ManutencaoPagamentos)((Button)sender).DataContext;
+ if (dataContext != null)
+ {
+ this.ViewModel.Loading(true);
+ long idDocumento = dataContext.get_IdDocumento();
+ Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(idDocumento, false, false);
+ if (documento != null)
+ {
+ double? nullable = null;
+ double? nullable1 = nullable;
+ nullable = null;
+ (new HosterWindow(new ApoliceView(documento, true, false, 1, dataContext.get_IdParcela(), false), string.Concat("CADASTRO DE APÓLICES - ", documento.get_Controle().get_Cliente().get_Nome()), nullable1, nullable, false)).Show();
+ this.ViewModel.Loading(false);
+ }
+ else
+ {
+ this.ViewModel.Loading(false);
+ }
+ }
+ dataContext = null;
+ }
+
+ private async void Buscar_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.Loading(true);
+ await this.ViewModel.Buscar();
+ this.ViewModel.Loading(false);
+ }
+
+ private void CheckBox_Checked(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.Selecionar(true);
+ }
+
+ private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (this.ViewModel.Pagamentos != null)
+ {
+ ObservableCollection<ManutencaoPagamentos> pagamentos = this.ViewModel.Pagamentos;
+ if (!pagamentos.All<ManutencaoPagamentos>((ManutencaoPagamentos x) => !x.get_Selecionado()))
+ {
+ bool? nullable = await this.ViewModel.ShowSenha("DESEJA REALMENTE EXCLUIR OS PAGAMENTOS SELECIONADOS?\nESSE PROCEDIMENTO É IRREVERSÍVEL.");
+ if (!nullable.HasValue)
+ {
+ return;
+ }
+ else if (!nullable.GetValueOrDefault())
+ {
+ await this.ViewModel.ShowMessage("SENHA INVÁLIDA", "OK", "", false);
+ return;
+ }
+ else
+ {
+ this.ViewModel.Loading(true);
+ await this.ViewModel.Excluir();
+ this.ViewModel.Loading(false);
+ return;
+ }
+ }
+ }
+ await this.ViewModel.ShowMessage("NECESSÁRIO SELECIONAR OS PAGAMENTOS QUE DESEJA EXCLUIR ANTES DE PROSSEGUIR", "OK", "", false);
+ }
+
+ private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e)
+ {
+ Chip chip = sender as Chip;
+ if (chip == null)
+ {
+ return;
+ }
+ ListBox listBox = Extentions.FindVisualAncestor<ListBox>(chip);
+ FiltroPersonalizado item = (FiltroPersonalizado)listBox.Items[listBox.Items.IndexOf(chip.DataContext)];
+ if (item == null)
+ {
+ return;
+ }
+ this.ViewModel.FiltroPersonalizadoSelecionado.Remove(item);
+ this.ViewModel.PesquisaPersonalizada();
+ }
+
+ private void FecharFiltro_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.VisibilityFiltroPersonalizado = (this.ViewModel.VisibilityFiltroPersonalizado == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
+ }
+
+ [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/views/ferramentas/manutencaopagamentosview.xaml", UriKind.Relative));
+ }
+
+ [DebuggerNonUserCode]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
+ {
+ switch (connectionId)
+ {
+ case 1:
+ {
+ ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
+ ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
+ return;
+ }
+ case 2:
+ {
+ ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
+ ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
+ return;
+ }
+ case 3:
+ {
+ ((Button)target).Click += new RoutedEventHandler(this.Buscar_OnClick);
+ return;
+ }
+ case 4:
+ {
+ ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick);
+ return;
+ }
+ case 5:
+ {
+ ((MenuItem)target).Click += new RoutedEventHandler(this.FecharFiltro_OnClick);
+ return;
+ }
+ case 6:
+ {
+ ((Button)target).Click += new RoutedEventHandler(this.FecharFiltro_OnClick);
+ return;
+ }
+ case 7:
+ {
+ ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
+ return;
+ }
+ case 8:
+ {
+ ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
+ ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
+ return;
+ }
+ case 9:
+ {
+ ((Button)target).Click += new RoutedEventHandler(this.AdicionarFiltro_OnClick);
+ return;
+ }
+ }
+ this._contentLoaded = true;
+ }
+
+ [DebuggerNonUserCode]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target)
+ {
+ switch (connectionId)
+ {
+ case 10:
+ {
+ ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirFiltro_OnClick));
+ return;
+ }
+ case 11:
+ {
+ ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
+ ((CheckBox)target).Unchecked += new RoutedEventHandler(this.UnCheckBox_Checked);
+ return;
+ }
+ case 12:
+ {
+ ((Button)target).Click += new RoutedEventHandler(this.Apolice_OnClick);
+ return;
+ }
+ default:
+ {
+ return;
+ }
+ }
+ }
+
+ private void UnCheckBox_Checked(object sender, RoutedEventArgs e)
+ {
+ this.ViewModel.Selecionar(false);
+ }
+ }
+}
\ No newline at end of file |