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 --- Gestor.Application/Views/Seguros/ComissaoView.cs | 1336 ---------------------- 1 file changed, 1336 deletions(-) delete mode 100644 Gestor.Application/Views/Seguros/ComissaoView.cs (limited to 'Gestor.Application/Views/Seguros/ComissaoView.cs') diff --git a/Gestor.Application/Views/Seguros/ComissaoView.cs b/Gestor.Application/Views/Seguros/ComissaoView.cs deleted file mode 100644 index 7bbf613..0000000 --- a/Gestor.Application/Views/Seguros/ComissaoView.cs +++ /dev/null @@ -1,1336 +0,0 @@ -using Gestor.Application.Actions; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels.Comissao; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.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.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -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 Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Views.Seguros -{ - public class ComissaoView : BaseUserControl, IComponentConnector, IStyleConnector - { - internal ComboBox UsuarioBox; - - internal ComboBox StatusBox; - - internal ComboBox SeguradoraBox; - - internal ComboBox Seguradora2Box; - - internal DatePicker InicioBox; - - internal DatePicker FimBox; - - internal DataGrid ExtratoGrid; - - internal Card ProgressBar2; - - internal Card ProgressBar; - - internal MenuItem DesfazerExtratoButton; - - internal DatePicker DataBaixaBox; - - internal TextBox FiltroDetalhes; - - internal DataGrid DetalhesGrid; - - internal Grid PainelCritica; - - internal AutoCompleteBox AutoCompleteCliente; - - internal TextBox TipoDocumentoPrincipalBox; - - internal TextBox DocumentoPrincipalBox; - - internal TextBox FiltroApoliceBox; - - internal DataGrid ApoliceGrid; - - internal DataGrid ParcelaGrid; - - internal DataGridTextColumn ParcelaColumn; - - internal DataGrid FaturaGrid; - - private bool _contentLoaded; - - public SubTipo _previousSubTipo { get; set; } = 2; - - public ComissaoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ComissaoView() - { - base.Tag = "COMISSÃO AUTOMÁTICA"; - this.ViewModel = new ComissaoViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher != null) - { - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - else - { - } - this.ExtratoGrid.DataContext = base.DataContext; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if (!(new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 7).get_Consultar()) - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)7), "."), "OK", "", false); - } - else if (this.ViewModel.SelectedExtrato != null) - { - List indiceArquivoDigitals = await (new ArquivoDigitalServico()).BuscarPorTipo(7, this.ViewModel.SelectedExtrato.get_Id()); - if (indiceArquivoDigitals.Count != 1) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedExtrato.get_Id()); - filtroArquivoDigital.set_Tipo(7); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedExtrato); - this.ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false); - } - else - { - this.ViewModel.Download(indiceArquivoDigitals.First(), true); - } - } - else - { - await this.ViewModel.ShowMessage("SELECIONE ALGUM EXTRATO PARA VISUALIZAR O ARQUIVO DIGITAL", "OK", "", false); - } - } - - private async Task AbrirCritica(DetalheExtrato detalhe) - { - List statusParcelas = new List() - { - 1, - 10, - 12, - 13 - }; - if (!detalhe.get_Status().HasValue || !statusParcelas.Contains(detalhe.get_Status().Value)) - { - this.ViewModel.FiltrarDetalheExtrato(detalhe.get_Id()); - await this.ViewModel.BuscarCriticado(detalhe); - if (!detalhe.get_Parcela().HasValue && !detalhe.get_Documento().HasValue) - { - this.AutoCompleteCliente.set_Text(detalhe.get_Cliente().Trim()); - } - this.ViewModel.Criticando = true; - this.PainelCritica.Visibility = System.Windows.Visibility.Visible; - this.FiltroDetalhes.Visibility = System.Windows.Visibility.Collapsed; - this.DetalhesGrid.Visibility = System.Windows.Visibility.Collapsed; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.FiltroApolice = string.Empty; - } - else - { - await this.ViewModel.ShowMessage("NÃO É POSSÍVEL CRITICAR UMA PARCELA JÁ BAIXADA", "OK", "", false); - } - } - - private async void AbrirCritica_OnClick(object sender, RoutedEventArgs e) - { - object item; - if (this.DetalhesGrid.SelectedIndex >= 0) - { - DataGrid detalhesGrid = this.DetalhesGrid; - if (detalhesGrid != null) - { - item = detalhesGrid.Items[this.DetalhesGrid.SelectedIndex]; - } - else - { - item = null; - } - DetalheExtrato detalheExtrato = (DetalheExtrato)item; - if (detalheExtrato != null) - { - this.ViewModel.Loading(true); - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - await this.AbrirCritica(detalheExtrato); - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.Loading(false); - } - } - else - { - await this.ViewModel.ShowMessage("PARA CRITICAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA", "OK", "", false); - } - } - - private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) - { - long? parcela; - Documento documento; - Documento documento1; - bool flag; - bool flag1; - Button button = (Button)sender; - if (button.DataContext != null && button.DataContext.GetType().Name.Equals("DetalheExtrato")) - { - DetalheExtrato dataContext = (DetalheExtrato)button.DataContext; - flag = (dataContext != null ? !dataContext.get_Documento().HasValue : true); - if (flag) - { - flag1 = (dataContext != null ? !dataContext.get_Parcela().HasValue : true); - if (flag1) - { - return; - } - } - if (!dataContext.get_Documento().HasValue) - { - if (!dataContext.get_Parcela().HasValue) - { - documento1 = null; - } - else - { - ComissaoViewModel viewModel = this.ViewModel; - parcela = dataContext.get_Parcela(); - documento1 = await viewModel.CarregaApoliceParcela(parcela.Value); - } - documento = documento1; - } - else - { - ComissaoViewModel comissaoViewModel = this.ViewModel; - parcela = dataContext.get_Documento(); - documento = await comissaoViewModel.CarregaApolice(parcela.Value); - } - Documento documento2 = documento; - if (documento2 != null) - { - if (!documento2.get_Excluido()) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new ApoliceView(documento2, true, false, 0, (long)0, true), string.Concat("CADASTRO DE APÓLICE - ", documento2.get_Controle().get_Cliente().get_Nome(), " - ", documento2.get_Apolice()), nullable1, nullable, false)).Show(); - } - else - { - await this.ViewModel.ShowMessage("NÃO É POSSIVE VISUALIZAR UM DOCUMENTO EXCLUIDO.", "OK", "", false); - } - } - } - } - - private async void AcessarApoliceCritica_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new ApoliceView(await this.ViewModel.CarregaApolice(this.ViewModel.SelectedDocumento.get_Id()), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICE - ", this.ViewModel.SelectedCliente.get_Nome(), " - ", this.ViewModel.SelectedDocumento.get_Apolice()), nullable1, nullable, false)).Show(); - } - - private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AdcionarFiltro(); - } - - private async void ApoliceGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - object obj; - DataGrid dataGrid = (DataGrid)sender; - if (dataGrid == null || dataGrid.SelectedIndex >= 0) - { - ComissaoViewModel viewModel = this.ViewModel; - obj = (dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null); - await viewModel.SelecionaDocumento((Documento)obj); - } - } - - private async void ArquivoDigitalButton_OnClick(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar()) - { - this.ViewModel.SelectedDocumento.get_Controle().set_Cliente(this.ViewModel.SelectedCliente); - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedDocumento.get_Id()); - filtroArquivoDigital.set_Tipo(2); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedDocumento); - this.ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false); - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)2), "."), "OK", "", false); - } - } - - private void Atualizar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.SelecionaSeguradora(this.ViewModel.SelectedSeguradora, this.ViewModel.SelectedStatusExtrato, this.ViewModel.SelectedExtrato); - } - - private async void AtualizarExtrato_OnClick(object sender, RoutedEventArgs e) - { - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.EnableButtons = false; - await this.ViewModel.AtualizarExtrato(); - await this.ViewModel.SelecionaExtrato(this.ViewModel.SelectedExtrato); - this.ViewModel.EnableButtons = true; - Action action = Gestor.Application.Actions.Actions.EnableMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMainMenu1 = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu1 != null) - { - enableMainMenu1(true); - } - else - { - } - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim()), null, 2).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private async void AutoCompleteBoxDetalhe_OnTextChanged(object sender, RoutedEventArgs e) - { - object text; - TextBox textBox = (TextBox)sender; - ComissaoViewModel viewModel = this.ViewModel; - if (textBox != null) - { - text = textBox.Text; - } - else - { - text = null; - } - if (text == null) - { - text = ""; - } - await viewModel.FiltrarDetalhe((string)text); - } - - private async void AutoCompleteBoxDocumento_OnTextChanged(object sender, RoutedEventArgs e) - { - object text; - TextBox textBox = (TextBox)sender; - ComissaoViewModel viewModel = this.ViewModel; - if (textBox != null) - { - text = textBox.Text; - } - else - { - text = null; - } - if (text == null) - { - text = ""; - } - await viewModel.FiltrarApolices((string)text); - } - - private async void BaixarParcelasSelecionadas_OnClick(object sender, RoutedEventArgs e) - { - ((MenuItem)sender).Click -= new RoutedEventHandler(this.BaixarParcelasSelecionadas_OnClick); - if (this.ViewModel.SelectedExtrato == null) - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarParcelasSelecionadas_OnClick); - } - else if (await this.ViewModel.ShowMessage(string.Concat("DESEJA BAIXAR TODAS AS PARCELAS SELECIONADAS DO EXTRATO ", this.ViewModel.SelectedExtrato.get_Numero(), "?"), "SIM", "NÃO", false)) - { - this.ViewModel.IsVisible = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.EnableButtons = false; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.EnableButtons = false; - await this.ViewModel.BaixarExtrato(true); - this.ViewModel.EnableButtons = true; - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ViewModel.EnableButtons = true; - this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.IsVisible = System.Windows.Visibility.Visible; - this.ViewModel.WorkOnSelectedStatus(); - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarParcelasSelecionadas_OnClick); - } - else - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarParcelasSelecionadas_OnClick); - } - } - - private async void BaixarSelecionado_OnClick(object sender, RoutedEventArgs e) - { - ((MenuItem)sender).Click -= new RoutedEventHandler(this.BaixarSelecionado_OnClick); - if (this.ViewModel.SelectedExtrato == null) - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarSelecionado_OnClick); - } - else if (await this.ViewModel.ShowMessage(string.Concat("DESEJA BAIXAR TODAS AS PARCELAS PENDENTES DO EXTRATO ", this.ViewModel.SelectedExtrato.get_Numero(), "?"), "SIM", "NÃO", false)) - { - this.ViewModel.IsVisible = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.EnableButtons = false; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.EnableButtons = false; - await this.ViewModel.BaixarExtrato(false); - this.ViewModel.EnableButtons = true; - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ViewModel.EnableButtons = true; - this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.IsVisible = System.Windows.Visibility.Visible; - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarSelecionado_OnClick); - } - else - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.BaixarSelecionado_OnClick); - } - } - - private void CancelarCritica_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedDetalhe != null) - { - this.ViewModel.SelectedDetalhe.set_Corrigir(false); - } - this.LimparFiltros(); - } - - private void ContentLoad() - { - this.DataBaixaBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.DataBaixaBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.InicioBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.InicioBox.SelectedDateChanged += new EventHandler(this.FiltroDataBox_OnSelectedDateChanged); - this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.FimBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.FimBox.SelectedDateChanged += new EventHandler(this.FiltroDataBox_OnSelectedDateChanged); - this.ExtratoGrid.SelectionChanged += new SelectionChangedEventHandler(this.Grid_OnSelectionChanged); - this.ExtratoGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => { - }); - this.DetalhesGrid.MouseDoubleClick += new MouseButtonEventHandler(this.DetalhesGrid_OnMouseDoubleClick); - this.ApoliceGrid.SelectionChanged += new SelectionChangedEventHandler(this.ApoliceGrid_OnSelectionChanged); - } - - private async void CriticarDocumento_OnClick(object sender, RoutedEventArgs e) - { - DetalheExtrato selectedDetalhe; - int? nullable; - object item; - if (this.DetalhesGrid.SelectedIndex >= 0) - { - SubTipo? subTipo = this.ViewModel.SelectedDetalhe.get_SubTipo(); - if (subTipo.HasValue && subTipo.GetValueOrDefault() == 1) - { - if (this.ViewModel.SelectedParcela == null || this.ViewModel.SelectedParcela.get_Id() == 0) - { - await this.ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA", "OK", "", false); - return; - } - } - else if (this.ViewModel.SelectedDocumento == null || this.ViewModel.SelectedDocumento.get_Id() == 0) - { - await this.ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UM DOCUMENTO", "OK", "", false); - return; - } - if (this.DetalhesGrid.SelectedIndex < 0) - { - DataGrid detalhesGrid = this.DetalhesGrid; - if (detalhesGrid != null) - { - nullable = new int?(detalhesGrid.Items.Count); - } - else - { - nullable = null; - } - int? nullable1 = nullable; - int selectedIndex = this.DetalhesGrid.SelectedIndex; - if (nullable1.GetValueOrDefault() < selectedIndex | !nullable1.HasValue) - { - goto Label2; - } - DataGrid dataGrid = this.DetalhesGrid; - if (dataGrid != null) - { - item = dataGrid.Items[this.DetalhesGrid.SelectedIndex]; - } - else - { - item = null; - } - selectedDetalhe = (DetalheExtrato)item; - goto Label1; - } - Label2: - selectedDetalhe = this.ViewModel.SelectedDetalhe; - Label1: - DetalheExtrato detalheExtrato = selectedDetalhe; - if (detalheExtrato != null) - { - await this.ViewModel.Criticar(detalheExtrato, true); - this.LimparFiltros(); - } - } - else - { - await this.ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA PARCELA PARA CRITICAR.", "OK", "", false); - } - } - - private async void Desconsiderar_OnClick(object sender, RoutedEventArgs e) - { - object item; - if (this.DetalhesGrid.SelectedIndex >= 0) - { - DataGrid detalhesGrid = this.DetalhesGrid; - if (detalhesGrid != null) - { - item = detalhesGrid.Items[this.DetalhesGrid.SelectedIndex]; - } - else - { - item = null; - } - DetalheExtrato detalheExtrato = (DetalheExtrato)item; - if (detalheExtrato != null) - { - await this.ViewModel.Criticar(detalheExtrato, false); - this.LimparFiltros(); - } - } - else - { - await this.ViewModel.ShowMessage("PARA DESCONSIDERAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA", "OK", "", false); - } - } - - private async void DesconsiderarSelacionadas_Click(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.ShowMessage(string.Concat("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS QUE FORAM SELECIONADAS, COLOCANDO STATUS DE DESCONSIDERADA PELO USUÁRIO", Environment.NewLine, "DESEJA CONTINUAR?"), "SIM", "NÃO", false)) - { - await this.ViewModel.DesconsiderarSelecionadas(); - } - } - - private async void DesconsiderarTodas_Click(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.ShowMessage(string.Concat("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS COM O STATUS DE DOCUMENTO NÃO ENCONTRADO OU PARCELA NÃO ENCONTRADA DO EXTRATO.", Environment.NewLine, "DESEJA CONTINUAR?"), "SIM", "NÃO", false)) - { - await this.ViewModel.CriticarTodos(this.ViewModel.SelectedExtrato.get_Id()); - this.LimparFiltros(); - } - } - - private async void DesfazerExtrato_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedExtrato != null) - { - if (await this.ViewModel.ShowMessage(string.Concat("DESEJA DESFAZER A BAIXA DO EXTRATO ", this.ViewModel.SelectedExtrato.get_Numero(), "?"), "SIM", "NÃO", false)) - { - this.ViewModel.IsVisible = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.EnableButtons = false; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - await this.ViewModel.DesfazerExtrato(); - this.ViewModel.EnableButtons = true; - this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.IsVisible = System.Windows.Visibility.Visible; - } - } - } - - private async void DesfazerParcela_OnClick(object sender, RoutedEventArgs e) - { - object item; - DataGrid detalhesGrid = this.DetalhesGrid; - if (detalhesGrid != null) - { - item = detalhesGrid.Items[this.DetalhesGrid.SelectedIndex]; - } - else - { - item = null; - } - DetalheExtrato detalheExtrato = (DetalheExtrato)item; - if (detalheExtrato != null) - { - if (await this.ViewModel.ShowMessage(string.Concat("DESEJA DESFAZER A BAIXA DA PARCELA DO CLIENTE ", detalheExtrato.get_Cliente(), "?"), "SIM", "NÃO", false)) - { - this.ViewModel.Loading(true); - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.EnableButtons = false; - bool flag = await this.ViewModel.DesfazerParcela(detalheExtrato); - await this.ViewModel.CarregaDetalhes(this.ViewModel.SelectedExtrato); - ComissaoViewModel viewModel = this.ViewModel; - viewModel.ToggleSnackBar((flag ? "PARCELA DESFEITA COM SUCESSO" : "NÃO FOI POSSÍVEL DESFAZER A BAIXA DA PARCELA"), true); - if (flag && detalheExtrato.get_Parcela().HasValue) - { - ComissaoViewModel comissaoViewModel = this.ViewModel; - string str = string.Format("DESFEZ PARCELA DE ID \"{0}\"", detalheExtrato.get_Parcela()); - long? parcela = detalheExtrato.get_Parcela(); - comissaoViewModel.RegistrarAcao(str, parcela.Value, new TipoTela?(35), null); - } - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ViewModel.EnableButtons = true; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.Loading(false); - } - } - detalheExtrato = null; - } - - private async void DetalhesGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) - { - object obj; - DataGrid dataGrid = (DataGrid)sender; - if (dataGrid == null || dataGrid.SelectedIndex >= 0) - { - this.ViewModel.Loading(true); - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - obj = (dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null); - DetalheExtrato detalheExtrato = (DetalheExtrato)obj; - if (detalheExtrato != null) - { - await this.AbrirCritica(detalheExtrato); - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.Loading(false); - } - } - } - - private async void ExcluirExtrato_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedExtrato != null) - { - if (await this.ViewModel.ShowMessage(string.Concat("DESEJA EXCLUIR O EXTRATO ", this.ViewModel.SelectedExtrato.get_Numero(), "?"), "SIM", "NÃO", false)) - { - this.ViewModel.IsVisible = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.EnableButtons = false; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - await this.ViewModel.ExcluirExtrato(); - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ViewModel.EnableButtons = true; - this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.IsVisible = System.Windows.Visibility.Visible; - } - } - } - - private void ExcluirFiltro_onClick(object sender, RoutedEventArgs e) - { - Chip chip = sender as Chip; - if (chip == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(chip); - string item = (string)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; - if (item == null) - { - return; - } - this.ViewModel.ExcluirFiltro(item); - } - - private void FiltroDataBox_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) - { - bool hasValue; - DatePicker datePicker = (DatePicker)sender; - if (datePicker != null) - { - hasValue = !datePicker.SelectedDate.HasValue; - } - else - { - hasValue = true; - } - if (hasValue) - { - return; - } - this.ViewModel.SelecionaSeguradora(this.ViewModel.SelectedSeguradora, this.ViewModel.SelectedStatusExtrato, null); - } - - private async void FinalizarSelecionado_OnClick(object sender, RoutedEventArgs e) - { - ((MenuItem)sender).Click -= new RoutedEventHandler(this.FinalizarSelecionado_OnClick); - if (this.ViewModel.SelectedExtrato != null) - { - ComissaoViewModel viewModel = this.ViewModel; - string[] numero = new string[] { "DESEJA FINALIZAR O EXTRATO ", this.ViewModel.SelectedExtrato.get_Numero(), "?", Environment.NewLine, "O EXTRATO SERÁ MARCADO COMO BAIXADO." }; - if (await viewModel.ShowMessage(string.Concat(numero), "SIM", "NÃO", false)) - { - this.ViewModel.IsVisible = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Collapsed; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - this.ViewModel.EnableButtons = false; - await this.ViewModel.FinalizarExtrato(); - this.ViewModel.EnableButtons = true; - Action action = Gestor.Application.Actions.Actions.EnableMainMenu; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - this.ViewModel.IsVisibleDetalhes = System.Windows.Visibility.Visible; - this.ViewModel.IsVisible = System.Windows.Visibility.Visible; - ((MenuItem)sender).Click += new RoutedEventHandler(this.FinalizarSelecionado_OnClick); - } - else - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.FinalizarSelecionado_OnClick); - } - } - else - { - ((MenuItem)sender).Click += new RoutedEventHandler(this.FinalizarSelecionado_OnClick); - } - } - - private async void Grid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - DataGrid dataGrid = (DataGrid)sender; - if (dataGrid != null) - { - if (dataGrid.SelectedIndex >= 0) - { - await this.ViewModel.SelecionaExtrato((Extrato)dataGrid.Items[dataGrid.SelectedIndex]); - } - } - } - - private async void Imprimir_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedExtrato != null) - { - string str = await this.ViewModel.GerarHtml(); - if (!string.IsNullOrEmpty(str)) - { - string tempPath = Path.GetTempPath(); - string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (new Regex(string.Concat("[", Regex.Escape(string.Concat(new string(Path.GetInvalidFileNameChars()), new string(Path.GetInvalidPathChars()))), "]"))).Replace("EXTRATO COMISSÃO", ""), Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8); - streamWriter.Write(str); - streamWriter.Close(); - Process.Start(str1); - this.ViewModel.RegistrarAcao(string.Format("IMPRIMIU EXTRATO DE ID \"{0}\"", this.ViewModel.SelectedExtrato.get_Id()), this.ViewModel.SelectedExtrato.get_Id(), new TipoTela?(35), null); - } - } - } - - [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/seguros/comissaoview.xaml", UriKind.Relative)); - } - - private void LimparFiltros() - { - this.ViewModel.Criticando = false; - this.ViewModel.FiltrarDetalheExtrato(""); - this.PainelCritica.Visibility = System.Windows.Visibility.Collapsed; - this.FiltroDetalhes.Visibility = System.Windows.Visibility.Visible; - this.AutoCompleteCliente.set_Text(string.Empty); - this.DetalhesGrid.Visibility = System.Windows.Visibility.Visible; - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(true); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu == null) - { - return; - } - enableMenu(true); - } - - private void Subtipo_OnDropDownOpened(object sender, EventArgs e) - { - this._previousSubTipo = (SubTipo)((ComboBox)sender).SelectedItem; - } - - private void Subtipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (!this.ViewModel.IsEnabled) - { - return; - } - ComboBox comboBox = (ComboBox)sender; - if ((SubTipo)comboBox.SelectedItem != 1) - { - return; - } - DetalheExtrato dataContext = (DetalheExtrato)comboBox.DataContext; - if ((SubTipo)comboBox.SelectedItem == 1 && dataContext.get_NumeroParcela() == "999" || !dataContext.IsNormal && dataContext.get_SubTipo().GetValueOrDefault() == 1) - { - comboBox.SelectedItem = this._previousSubTipo; - } - } - - [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.UsuarioBox = (ComboBox)target; - return; - } - case 2: - { - this.StatusBox = (ComboBox)target; - return; - } - case 3: - { - this.SeguradoraBox = (ComboBox)target; - return; - } - case 4: - { - this.Seguradora2Box = (ComboBox)target; - return; - } - case 5: - { - this.InicioBox = (DatePicker)target; - this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - return; - } - case 6: - { - this.FimBox = (DatePicker)target; - this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - return; - } - case 7: - { - ((Button)target).Click += new RoutedEventHandler(this.Atualizar_OnClick); - return; - } - case 8: - { - ((Button)target).Click += new RoutedEventHandler(this.AdicionarFiltro_OnClick); - return; - } - case 9: - case 29: - case 30: - case 31: - case 32: - case 33: - case 40: - case 41: - { - this._contentLoaded = true; - return; - } - case 10: - { - this.ExtratoGrid = (DataGrid)target; - return; - } - case 11: - { - this.ProgressBar2 = (Card)target; - return; - } - case 12: - { - this.ProgressBar = (Card)target; - return; - } - case 13: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AtualizarExtrato_OnClick); - return; - } - case 14: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.FinalizarSelecionado_OnClick); - return; - } - case 15: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.BaixarParcelasSelecionadas_OnClick); - return; - } - case 16: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.BaixarSelecionado_OnClick); - return; - } - case 17: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.DesconsiderarTodas_Click); - return; - } - case 18: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.DesconsiderarSelacionadas_Click); - return; - } - case 19: - { - this.DesfazerExtratoButton = (MenuItem)target; - this.DesfazerExtratoButton.Click += new RoutedEventHandler(this.DesfazerExtrato_OnClick); - return; - } - case 20: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirExtrato_OnClick); - return; - } - case 21: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.CriticarDocumento_OnClick); - return; - } - case 22: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Desconsiderar_OnClick); - return; - } - case 23: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.CancelarCritica_OnClick); - return; - } - case 24: - { - this.DataBaixaBox = (DatePicker)target; - this.DataBaixaBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - return; - } - case 25: - { - this.FiltroDetalhes = (TextBox)target; - this.FiltroDetalhes.TextChanged += new TextChangedEventHandler(this.AutoCompleteBoxDetalhe_OnTextChanged); - return; - } - case 26: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Imprimir_OnClick); - return; - } - case 27: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 28: - { - this.DetalhesGrid = (DataGrid)target; - return; - } - case 34: - { - this.PainelCritica = (Grid)target; - return; - } - case 35: - { - this.AutoCompleteCliente = (AutoCompleteBox)target; - this.AutoCompleteCliente.add_Populating(new PopulatingEventHandler(this, ComissaoView.AutoCompleteBox_Populating)); - return; - } - case 36: - { - this.TipoDocumentoPrincipalBox = (TextBox)target; - return; - } - case 37: - { - this.DocumentoPrincipalBox = (TextBox)target; - return; - } - case 38: - { - this.FiltroApoliceBox = (TextBox)target; - this.FiltroApoliceBox.TextChanged += new TextChangedEventHandler(this.AutoCompleteBoxDocumento_OnTextChanged); - return; - } - case 39: - { - this.ApoliceGrid = (DataGrid)target; - return; - } - case 42: - { - this.ParcelaGrid = (DataGrid)target; - return; - } - case 43: - { - this.ParcelaColumn = (DataGridTextColumn)target; - return; - } - case 44: - { - this.FaturaGrid = (DataGrid)target; - 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 == 9) - { - ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirFiltro_onClick)); - return; - } - switch (connectionId) - { - case 29: - { - ((Button)target).Click += new RoutedEventHandler(this.AcessarApolice_OnClick); - return; - } - case 30: - { - ((ComboBox)target).DropDownOpened += new EventHandler(this.Subtipo_OnDropDownOpened); - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Subtipo_OnSelectionChanged); - return; - } - case 31: - { - ((Button)target).Click += new RoutedEventHandler(this.AbrirCritica_OnClick); - return; - } - case 32: - { - ((Button)target).Click += new RoutedEventHandler(this.Desconsiderar_OnClick); - return; - } - case 33: - { - ((Button)target).Click += new RoutedEventHandler(this.DesfazerParcela_OnClick); - return; - } - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - { - return; - } - case 40: - { - ((Button)target).Click += new RoutedEventHandler(this.AcessarApoliceCritica_OnClick); - return; - } - case 41: - { - ((Button)target).Click += new RoutedEventHandler(this.ArquivoDigitalButton_OnClick); - return; - } - default: - { - return; - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3