From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Views/Ferramentas/ManutencaoPagamentosView.cs | 252 +++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 Codemerx/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs (limited to 'Codemerx/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs') diff --git a/Codemerx/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs b/Codemerx/Gestor.Application/Views/Ferramentas/ManutencaoPagamentosView.cs new file mode 100644 index 0000000..f57ac7c --- /dev/null +++ b/Codemerx/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 pagamentos = this.ViewModel.Pagamentos; + if (!pagamentos.All((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(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 -- cgit v1.2.3