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/Seguros/Itens/AeronauticoView.cs | 373 ----------- Gestor.Application/Views/Seguros/Itens/AutoView.cs | 718 --------------------- .../Views/Seguros/Itens/BuscarModeloView.cs | 85 --- .../Views/Seguros/Itens/ConsorcioView.cs | 320 --------- .../Views/Seguros/Itens/GranizoView.cs | 383 ----------- .../Views/Seguros/Itens/PatrimonialView.cs | 466 ------------- .../Views/Seguros/Itens/RiscosDiversosView.cs | 683 -------------------- Gestor.Application/Views/Seguros/Itens/VidaView.cs | 705 -------------------- 8 files changed, 3733 deletions(-) delete mode 100644 Gestor.Application/Views/Seguros/Itens/AeronauticoView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/AutoView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/BuscarModeloView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/ConsorcioView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/GranizoView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/PatrimonialView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/RiscosDiversosView.cs delete mode 100644 Gestor.Application/Views/Seguros/Itens/VidaView.cs (limited to 'Gestor.Application/Views/Seguros/Itens') diff --git a/Gestor.Application/Views/Seguros/Itens/AeronauticoView.cs b/Gestor.Application/Views/Seguros/Itens/AeronauticoView.cs deleted file mode 100644 index d0bef66..0000000 --- a/Gestor.Application/Views/Seguros/Itens/AeronauticoView.cs +++ /dev/null @@ -1,373 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -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.Views.Seguros.Itens -{ - public class AeronauticoView : BaseUserControl, IComponentConnector - { - public AeronauticoViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - private string _lastCategory = ""; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal CustomItemValidation MaisInformacoes; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public AeronauticoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new AeronauticoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name == "MaisInformacoesRadioButton") - { - this.MaisInformacoes.Visibility = System.Windows.Visibility.Visible; - return; - } - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Excluir(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - [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/itens/aeronauticoview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Tipo_OnSelectionChanged); - return; - } - case 12: - { - AeronauticoView aeronauticoView = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(aeronauticoView.SomenteNumeros); - return; - } - case 13: - { - AeronauticoView aeronauticoView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(aeronauticoView1.SomenteNumeros); - return; - } - case 14: - { - AeronauticoView aeronauticoView2 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(aeronauticoView2.SomenteNumeros); - return; - } - case 15: - { - AeronauticoView aeronauticoView3 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(aeronauticoView3.SomenteNumeros); - return; - } - case 16: - { - ((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 17: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 18: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 19: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 20: - { - this.MaisInformacoes = (CustomItemValidation)target; - return; - } - } - this._contentLoaded = true; - } - - private void Tipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (((ComboBox)sender).SelectedItem == null) - { - return; - } - if (ValidationHelper.GetCategory((TipoAeronautico)((ComboBox)sender).SelectedItem) == this._lastCategory) - { - return; - } - this.ViewModel.SelectedItem.get_Aeronautico().set_Tipo((TipoAeronautico)((ComboBox)sender).SelectedItem); - this.ViewModel.UpdateAero(); - this.ValidateFields(this.ViewModel.SelectedItem.Validate(), true); - this._lastCategory = ValidationHelper.GetCategory(this.ViewModel.SelectedItem.get_Aeronautico().get_Tipo()); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/AutoView.cs b/Gestor.Application/Views/Seguros/Itens/AutoView.cs deleted file mode 100644 index 4a9c3be..0000000 --- a/Gestor.Application/Views/Seguros/Itens/AutoView.cs +++ /dev/null @@ -1,718 +0,0 @@ -using Gestor.Application.Actions; -using Gestor.Application.Componentes; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Configuracoes; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.Helper; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -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; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class AutoView : BaseUserControl, IComponentConnector - { - public AutoViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal WrapPanel PainelDadosAuto; - - internal TextBox FipeBox; - - internal AutoCompleteBox AutoCompleteFabricacao; - - internal TextBox ModeloBox; - - internal TextBox AnoModeloBox; - - internal TextBox CepCirculacaoBox; - - internal TextBox CepPernoiteBox; - - internal ComboBox ComboBoxTipoCorrecao; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal CustomItemValidation MaisInformacoes; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public AutoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new AutoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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 ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void AutoCompleteFabricanteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.BuscaFabricante(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void BaixarXls_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.BaixarXls(); - } - - private async void BuscarModelo_OnClick(object sender, RoutedEventArgs e) - { - Fipe fipe = await this.ViewModel.ShowBuscaModeloDialog(this.ModeloBox.Text, this.AnoModeloBox.Text); - Fipe fipe1 = fipe; - if (fipe1 != null) - { - this.FipeBox.Text = fipe1.get_Codigo(); - this.ModeloBox.Text = fipe1.get_Modelo(); - this.AutoCompleteFabricacao.set_Text(fipe1.get_Marca()); - this.ViewModel.SelectedItem.get_Auto().set_Fabricante(this.ViewModel.Fabricantes.FirstOrDefault((Fabricante x) => x.get_Descricao() == fipe1.get_Marca())); - } - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void Cep_OnLostFocus(object sender, RoutedEventArgs e) - { - bool auto; - TextBox textBox = (TextBox)sender; - Item selectedItem = this.ViewModel.SelectedItem; - if (selectedItem != null) - { - auto = selectedItem.get_Auto(); - } - else - { - auto = false; - } - if (!auto) - { - return; - } - if (string.IsNullOrWhiteSpace(textBox.Text)) - { - return; - } - if ((textBox.Name == "CepCirculacaoBox" || textBox.Name == "CepPernoiteBox") && Gestor.Common.Validation.ValidationHelper.ValidaCep(textBox.Text)) - { - return; - } - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoCep(Gestor.Common.Validation.ValidationHelper.FormatPostCode(textBox.Text))) - { - return; - } - textBox.Text = Gestor.Common.Validation.ValidationHelper.FormatPostCode(textBox.Text); - } - - private void Ci_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - textBox.Text = Gestor.Common.Validation.ValidationHelper.FormatCi(textBox.Text); - } - - private void ComboBoxTipoCorrecao_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (this.ComboBoxTipoCorrecao.SelectedItem == null) - { - return; - } - this.ViewModel.Atualiza(this.ComboBoxTipoCorrecao.SelectedItem.ToString().ToUpper()); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name == "MaisInformacoesRadioButton") - { - this.MaisInformacoes.Visibility = System.Windows.Visibility.Visible; - return; - } - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - } - - private async void Fipe_LostFocus(object sender, RoutedEventArgs e) - { - int num; - bool auto; - object obj; - TextBox textBox = (TextBox)sender; - Item selectedItem = this.ViewModel.SelectedItem; - if (selectedItem != null) - { - auto = selectedItem.get_Auto(); - } - else - { - auto = false; - } - if (auto) - { - if (!string.IsNullOrWhiteSpace(textBox.Text)) - { - string str = Gestor.Model.Helper.ValidationHelper.FormataFipe(textBox.Text.Replace("-", "")); - if (Gestor.Model.Helper.ValidationHelper.ValidaFipe(str)) - { - textBox.Text = str; - if (!int.TryParse(Gestor.Model.Helper.ValidationHelper.OnlyNumber(str), out num) || num != 0) - { - Fipe fipe = await this.ViewModel.BuscaModelo(textBox.Text); - if (fipe != null) - { - this.ModeloBox.Text = fipe.get_Modelo(); - AutoCompleteBox autoCompleteFabricacao = this.AutoCompleteFabricacao; - List fabricantes = this.ViewModel.Fabricantes; - if (fabricantes != null) - { - obj = fabricantes.FirstOrDefault((Fabricante x) => x.get_Descricao() == fipe.get_Marca()); - } - else - { - obj = null; - } - autoCompleteFabricacao.set_SelectedItem(obj); - } - else - { - this.ViewModel.ToggleSnackBar(string.Concat("MODELO NÃO ENCONTRADO PARA O CÓDIGO FIPE ", textBox.Text), true); - } - } - } - } - } - textBox = null; - } - - private async void ImportarXls_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - Action enablePesquisarClientes = Gestor.Application.Actions.Actions.EnablePesquisarClientes; - if (enablePesquisarClientes != null) - { - enablePesquisarClientes(false); - } - else - { - } - Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu != null) - { - enableMenu(false); - } - else - { - } - Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu != null) - { - enableMainMenu(false); - } - else - { - } - List> keyValuePairs = await this.ViewModel.ImportarXls(); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - Action action = Gestor.Application.Actions.Actions.EnablePesquisarClientes; - if (action != null) - { - action(true); - } - else - { - } - Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; - if (enableMenu1 != null) - { - enableMenu1(true); - } - else - { - } - Action enableMainMenu1 = Gestor.Application.Actions.Actions.EnableMainMenu; - if (enableMainMenu1 != null) - { - enableMainMenu1(true); - } - else - { - } - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - Item selectedItem = this.ViewModel.SelectedItem; - List configuracoes = Recursos.Configuracoes; - bool flag = configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 18); - List configuracaoSistemas = Recursos.Configuracoes; - List> keyValuePairs = selectedItem.Validate(flag, configuracaoSistemas.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 27)); - this.ValidateFields(keyValuePairs, true); - } - - [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/itens/autoview.xaml", UriKind.Relative)); - } - - private void KeyUpBase_OnKeyUp(object sender, KeyEventArgs e) - { - TextBox textBox = (TextBox)sender; - if (!Regex.IsMatch(textBox.Text.Replace(".", ""), "^[0-9.]{11}$")) - { - textBox.Text = Regex.Replace(textBox.Text, "[^\\d]*", ""); - } - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - private void Placa(object sender, KeyEventArgs e) - { - Gestor.Model.Helper.ValidationHelper.FormataPlaca(((TextBox)sender).Text); - } - - private void Renavam_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - textBox.Text = Gestor.Common.Validation.ValidationHelper.FormatRenavam(textBox.Text); - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - this.FipeBox.Focus(); - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - private void SelecionaUsoVeiculo(object sender, SelectionChangedEventArgs e) - { - if (this.ViewModel.UsoVeiculo.GetValueOrDefault() == 2 || this.ViewModel.UsoVeiculo.GetValueOrDefault() == 3) - { - this.ViewModel.SelectedItem.get_Auto().set_Categoria(new Categoria?(3)); - } - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ImportarXls_OnClick); - return; - } - case 12: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.BaixarXls_OnClick); - return; - } - case 13: - { - this.PainelDadosAuto = (WrapPanel)target; - return; - } - case 14: - { - this.FipeBox = (TextBox)target; - AutoView autoView = this; - this.FipeBox.PreviewTextInput += new TextCompositionEventHandler(autoView.SomenteNumeros); - this.FipeBox.LostFocus += new RoutedEventHandler(this.Fipe_LostFocus); - return; - } - case 15: - { - AutoView autoView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView1.Placa); - ((TextBox)target).PreviewKeyDown += new KeyEventHandler(this.Placa); - return; - } - case 16: - { - this.AutoCompleteFabricacao = (AutoCompleteBox)target; - this.AutoCompleteFabricacao.add_Populating(new PopulatingEventHandler(this, AutoView.AutoCompleteFabricanteBox_Populating)); - return; - } - case 17: - { - this.ModeloBox = (TextBox)target; - return; - } - case 18: - { - ((Button)target).Click += new RoutedEventHandler(this.BuscarModelo_OnClick); - return; - } - case 19: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.SelecionaUsoVeiculo); - return; - } - case 20: - { - AutoView autoView2 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView2.SomenteNumeros); - ((TextBox)target).LostFocus += new RoutedEventHandler(this.Renavam_OnLostFocus); - ((TextBox)target).PreviewKeyUp += new KeyEventHandler(this.KeyUpBase_OnKeyUp); - return; - } - case 21: - { - ((ToggleButton)target).Checked += new RoutedEventHandler(this.ZeroKmToggleButton_Changed); - ((ToggleButton)target).Unchecked += new RoutedEventHandler(this.ZeroKmToggleButton_Changed); - return; - } - case 22: - { - AutoView autoView3 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView3.SomenteNumeros); - return; - } - case 23: - { - this.AnoModeloBox = (TextBox)target; - AutoView autoView4 = this; - this.AnoModeloBox.PreviewTextInput += new TextCompositionEventHandler(autoView4.SomenteNumeros); - return; - } - case 24: - { - AutoView autoView5 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView5.SomenteNumeros); - return; - } - case 25: - { - AutoView autoView6 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView6.SomenteNumeros); - return; - } - case 26: - { - this.CepCirculacaoBox = (TextBox)target; - this.CepCirculacaoBox.LostFocus += new RoutedEventHandler(this.Cep_OnLostFocus); - AutoView autoView7 = this; - this.CepCirculacaoBox.PreviewTextInput += new TextCompositionEventHandler(autoView7.SomenteNumeros); - return; - } - case 27: - { - this.CepPernoiteBox = (TextBox)target; - this.CepPernoiteBox.LostFocus += new RoutedEventHandler(this.Cep_OnLostFocus); - AutoView autoView8 = this; - this.CepPernoiteBox.PreviewTextInput += new TextCompositionEventHandler(autoView8.SomenteNumeros); - return; - } - case 28: - { - this.ComboBoxTipoCorrecao = (ComboBox)target; - this.ComboBoxTipoCorrecao.SelectionChanged += new SelectionChangedEventHandler(this.ComboBoxTipoCorrecao_SelectionChanged); - return; - } - case 29: - { - ((TextBox)target).LostFocus += new RoutedEventHandler(this.Ci_OnLostFocus); - AutoView autoView9 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView9.SomenteNumeros); - return; - } - case 30: - { - AutoView autoView10 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(autoView10.SomenteNumeros); - return; - } - case 31: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 32: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 33: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 34: - { - this.MaisInformacoes = (CustomItemValidation)target; - return; - } - } - this._contentLoaded = true; - } - - private void ZeroKmToggleButton_Changed(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedItem == null) - { - return; - } - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/BuscarModeloView.cs b/Gestor.Application/Views/Seguros/Itens/BuscarModeloView.cs deleted file mode 100644 index 1f89612..0000000 --- a/Gestor.Application/Views/Seguros/Itens/BuscarModeloView.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Markup; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class BuscarModeloView : BaseUserControl, IComponentConnector - { - internal DataGrid BuscaModeloGrid; - - private bool _contentLoaded; - - public BuscarModeloViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public BuscarModeloView(BuscarModeloViewModel viewModel) - { - this.ViewModel = viewModel; - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - [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/itens/buscarmodeloview.xaml", UriKind.Relative)); - } - - private void Pesquisar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Pesquisar(); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - BuscarModeloView buscarModeloView = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(buscarModeloView.SomenteNumeros); - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Pesquisar_OnClick); - return; - } - case 3: - { - this.BuscaModeloGrid = (DataGrid)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/ConsorcioView.cs b/Gestor.Application/Views/Seguros/Itens/ConsorcioView.cs deleted file mode 100644 index 3b14a0c..0000000 --- a/Gestor.Application/Views/Seguros/Itens/ConsorcioView.cs +++ /dev/null @@ -1,320 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -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.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class ConsorcioView : BaseUserControl, IComponentConnector - { - public ConsorcioViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - private bool _salvando; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal CustomItemValidation MaisInformacoes; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ConsorcioView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new ConsorcioViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name == "MaisInformacoesRadioButton") - { - this.MaisInformacoes.Visibility = System.Windows.Visibility.Visible; - return; - } - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Excluir(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - [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/itens/consorcioview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 12: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 13: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 14: - { - this.MaisInformacoes = (CustomItemValidation)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/GranizoView.cs b/Gestor.Application/Views/Seguros/Itens/GranizoView.cs deleted file mode 100644 index 9382fe6..0000000 --- a/Gestor.Application/Views/Seguros/Itens/GranizoView.cs +++ /dev/null @@ -1,383 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -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.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class GranizoView : BaseUserControl, IComponentConnector - { - public GranizoViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal TextBox CepBox; - - internal TextBox EnderecoBox; - - internal TextBox BairroBox; - - internal TextBox CidadeBox; - - internal TextBox EstadoBox; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal CustomItemValidation MaisInformacoes; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public GranizoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new GranizoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name == "MaisInformacoesRadioButton") - { - this.MaisInformacoes.Visibility = System.Windows.Visibility.Visible; - return; - } - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.IncluirItem(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - [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/itens/granizoview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - if (!string.IsNullOrWhiteSpace(textBox.Text)) - { - string str = ValidationHelper.FormatPostCode(textBox.Text); - this.CepBox.Text = str; - if (ValidationHelper.ValidatePostCode(str)) - { - EnderecoBase enderecoBase = await this.ViewModel.BuscaCep(str); - if (enderecoBase != null) - { - this.EnderecoBox.Text = enderecoBase.get_Endereco(); - this.CidadeBox.Text = enderecoBase.get_Cidade(); - this.EstadoBox.Text = enderecoBase.get_Estado(); - this.BairroBox.Text = enderecoBase.get_Bairro(); - } - } - } - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - this.CepBox = (TextBox)target; - this.CepBox.LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus); - return; - } - case 12: - { - this.EnderecoBox = (TextBox)target; - return; - } - case 13: - { - GranizoView granizoView = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(granizoView.SomenteNumeros); - return; - } - case 14: - { - this.BairroBox = (TextBox)target; - return; - } - case 15: - { - this.CidadeBox = (TextBox)target; - return; - } - case 16: - { - this.EstadoBox = (TextBox)target; - return; - } - case 17: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 18: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 19: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 20: - { - this.MaisInformacoes = (CustomItemValidation)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/PatrimonialView.cs b/Gestor.Application/Views/Seguros/Itens/PatrimonialView.cs deleted file mode 100644 index 42e03ce..0000000 --- a/Gestor.Application/Views/Seguros/Itens/PatrimonialView.cs +++ /dev/null @@ -1,466 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -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.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class PatrimonialView : BaseUserControl, IComponentConnector - { - public PatrimonialViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal TextBox CepBox; - - internal TextBox EnderecoBox; - - internal TextBox BairroBox; - - internal TextBox CidadeBox; - - internal TextBox EstadoBox; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal CustomItemValidation MaisInformacoes; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public PatrimonialView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new PatrimonialViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - textBox.Text = ValidationHelper.FormatDocument(textBox.Text); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.MaisInformacoes.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name == "MaisInformacoesRadioButton") - { - this.MaisInformacoes.Visibility = System.Windows.Visibility.Visible; - return; - } - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - [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/itens/patrimonialview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - if (!string.IsNullOrWhiteSpace(textBox.Text)) - { - string str = ValidationHelper.FormatPostCode(textBox.Text); - if (ValidationHelper.ValidatePostCode(str)) - { - this.CepBox.Text = str; - EnderecoBase enderecoBase = await this.ViewModel.BuscaCep(str); - if (enderecoBase != null) - { - this.EnderecoBox.Text = enderecoBase.get_Endereco(); - this.CidadeBox.Text = enderecoBase.get_Cidade(); - this.EstadoBox.Text = enderecoBase.get_Estado(); - this.BairroBox.Text = enderecoBase.get_Bairro(); - } - } - } - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Loading(true); - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - this.CepBox = (TextBox)target; - this.CepBox.LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus); - return; - } - case 12: - { - this.EnderecoBox = (TextBox)target; - return; - } - case 13: - { - PatrimonialView patrimonialView = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView.SomenteNumeros); - return; - } - case 14: - { - this.BairroBox = (TextBox)target; - return; - } - case 15: - { - this.CidadeBox = (TextBox)target; - return; - } - case 16: - { - this.EstadoBox = (TextBox)target; - return; - } - case 17: - { - PatrimonialView patrimonialView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView1.SomenteNumeros); - return; - } - case 18: - { - PatrimonialView patrimonialView2 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView2.SomenteNumeros); - PatrimonialView patrimonialView3 = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(patrimonialView3.FormatarTelefone); - return; - } - case 19: - { - PatrimonialView patrimonialView4 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView4.SomenteNumeros); - ((TextBox)target).LostFocus += new RoutedEventHandler(this.CpfBox_OnLostFocus); - return; - } - case 20: - { - PatrimonialView patrimonialView5 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView5.SomenteNumeros); - return; - } - case 21: - { - PatrimonialView patrimonialView6 = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(patrimonialView6.FormatarTelefone); - PatrimonialView patrimonialView7 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView7.SomenteNumeros); - return; - } - case 22: - { - PatrimonialView patrimonialView8 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView8.SomenteNumeros); - ((TextBox)target).LostFocus += new RoutedEventHandler(this.CpfBox_OnLostFocus); - return; - } - case 23: - { - PatrimonialView patrimonialView9 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView9.SomenteNumeros); - return; - } - case 24: - { - PatrimonialView patrimonialView10 = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(patrimonialView10.FormatarTelefone); - PatrimonialView patrimonialView11 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView11.SomenteNumeros); - return; - } - case 25: - { - PatrimonialView patrimonialView12 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView12.SomenteNumeros); - ((TextBox)target).LostFocus += new RoutedEventHandler(this.CpfBox_OnLostFocus); - return; - } - case 26: - { - PatrimonialView patrimonialView13 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView13.SomenteNumeros); - return; - } - case 27: - { - PatrimonialView patrimonialView14 = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(patrimonialView14.FormatarTelefone); - PatrimonialView patrimonialView15 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(patrimonialView15.SomenteNumeros); - return; - } - case 28: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 29: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 30: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 31: - { - this.MaisInformacoes = (CustomItemValidation)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/RiscosDiversosView.cs b/Gestor.Application/Views/Seguros/Itens/RiscosDiversosView.cs deleted file mode 100644 index 70a30b9..0000000 --- a/Gestor.Application/Views/Seguros/Itens/RiscosDiversosView.cs +++ /dev/null @@ -1,683 +0,0 @@ -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -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.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class RiscosDiversosView : BaseUserControl, IComponentConnector, IStyleConnector - { - public RiscosDiversosViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - private bool _salvando; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal Menu BotoesTitulares; - - internal Separator SeparadorMaisInformacoes; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal DataGrid DataGridTitulares; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public RiscosDiversosView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new RiscosDiversosViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void AlterarTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AlterarTitular(); - } - - private void AplicarTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AplicarTitular(); - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Trim().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.BuscarTitulares(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void BotoesTitulares_OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) - { - bool flag; - if (!((Menu)sender).IsEnabled) - { - this.ViewModel.AlteracaoTitularesVisibility = System.Windows.Visibility.Collapsed; - } - DataGrid dataGridTitulares = this.DataGridTitulares; - if (dataGridTitulares != null) - { - flag = dataGridTitulares.Columns.First(); - } - else - { - flag = false; - } - if (!flag) - { - return; - } - this.DataGridTitulares.Columns.First().Visibility = (((Menu)sender).IsEnabled ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void DataGridTitulares_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) - { - string text; - string str; - string text1; - if (!(e.EditingElement is TextBox)) - { - return; - } - TextBox editingElement = e.EditingElement as TextBox; - string stringFormat = e.Column.ClipboardContentBinding.StringFormat; - if (stringFormat == "d") - { - if (editingElement != null) - { - text = editingElement.Text; - } - else - { - text = null; - } - if (!string.IsNullOrEmpty(text)) - { - editingElement.Text = ValidationHelper.FormatDate(editingElement.Text); - return; - } - if (editingElement != null) - { - editingElement.Text = null; - return; - } - } - else if (stringFormat == "c") - { - if (editingElement != null) - { - str = editingElement.Text; - } - else - { - str = null; - } - if (!string.IsNullOrEmpty(str)) - { - editingElement.Text = ValidationHelper.FormatCurrency(editingElement.Text); - return; - } - if (editingElement != null) - { - editingElement.Text = null; - } - } - else - { - if (editingElement != null) - { - text1 = editingElement.Text; - } - else - { - text1 = null; - } - if (!string.IsNullOrEmpty(text1)) - { - if (e.Column.SortMemberPath == "Cpf") - { - editingElement.Text = ValidationHelper.FormatDocument(editingElement.Text); - return; - } - } - else if (editingElement != null) - { - editingElement.Text = null; - return; - } - } - } - - private void Dependente_CellLoaded(object sender, RoutedEventArgs e) - { - bool valueOrDefault; - if (sender == null) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - TitularesVida dataContext = (TitularesVida)((DataGridCell)sender).DataContext; - if (dataContext != null) - { - valueOrDefault = dataContext.get_Tipo().GetValueOrDefault() == 2; - } - else - { - valueOrDefault = false; - } - dataGridCell.Visibility = (valueOrDefault ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.DataGridTitulares.Visibility = System.Windows.Visibility.Collapsed; - this.SeparadorMaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.BotoesTitulares.Visibility = System.Windows.Visibility.Collapsed; - this.DataGridTitulares.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name != "MaisInformacoesRadioButton") - { - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - return; - } - this.SeparadorMaisInformacoes.Visibility = System.Windows.Visibility.Visible; - this.DataGridTitulares.Visibility = System.Windows.Visibility.Visible; - this.BotoesTitulares.Visibility = System.Windows.Visibility.Visible; - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - } - - private void ExcluirTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.ExcluirTitular(); - } - - private async void ImportarTitulares_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.ImportarTitulares(); - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - private void IncluirTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.IncluirTitular(); - this.UpdateAutocompleteDependente(this.DataGridTitulares.Items.Cast().First()); - } - - [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/itens/riscosdiversosview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this._salvando = true; - this.ViewModel.Loading(true); - this.DataGridTitulares.Focus(); - List> keyValuePairs = await this.ViewModel.Salvar(this.DataGridTitulares.Items.Cast().ToList()); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - this._salvando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 12: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 13: - { - this.BotoesTitulares = (Menu)target; - this.BotoesTitulares.IsEnabledChanged += new DependencyPropertyChangedEventHandler(this.BotoesTitulares_OnIsEnabledChanged); - return; - } - case 14: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTitular_OnClick); - return; - } - case 15: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AlterarTitular_OnClick); - return; - } - case 16: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirTitular_OnClick); - return; - } - case 17: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ImportarTitulares_OnClick); - return; - } - case 18: - { - this.SeparadorMaisInformacoes = (Separator)target; - return; - } - case 19: - { - ((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 20: - { - ((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 21: - { - ((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 22: - { - RiscosDiversosView riscosDiversosView = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(riscosDiversosView.FormatarDocumento); - RiscosDiversosView riscosDiversosView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(riscosDiversosView1.SomenteNumeros); - return; - } - case 23: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AplicarTitular_OnClick); - return; - } - case 24: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 25: - { - this.DataGridTitulares = (DataGrid)target; - this.DataGridTitulares.CellEditEnding += new EventHandler(this.DataGridTitulares_OnCellEditEnding); - 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 26: - { - ((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 27: - { - ((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 28: - { - ((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 29: - { - RiscosDiversosView riscosDiversosView = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(riscosDiversosView.FormatarDocumento); - RiscosDiversosView riscosDiversosView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(riscosDiversosView1.SomenteNumeros); - return; - } - case 30: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.TipoComboBoxSelectionChanged); - return; - } - case 31: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, RiscosDiversosView.AutoCompleteBox_Populating)); - return; - } - case 32: - { - EventSetter eventSetter = new EventSetter() - { - Event = FrameworkElement.LoadedEvent, - Handler = new RoutedEventHandler(this.Dependente_CellLoaded) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - default: - { - return; - } - } - } - - private async void TipoComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) - { - bool dataContext; - ComboBox comboBox = (ComboBox)sender; - if (comboBox != null) - { - dataContext = comboBox.DataContext; - } - else - { - dataContext = false; - } - if (dataContext) - { - TipoTitular? nullable = ((TitularesVida)((ComboBox)sender).DataContext).get_Tipo(); - if (nullable.GetValueOrDefault() == 2 && !this._salvando) - { - ObservableCollection titulares = this.ViewModel.Titulares; - if (!titulares.Any((TitularesVida x) => { - TipoTitular? tipo = x.get_Tipo(); - if (tipo.GetValueOrDefault() == 1) - { - return true; - } - tipo = x.get_Tipo(); - return tipo.GetValueOrDefault() == 0 & tipo.HasValue; - })) - { - ((ComboBox)sender).SelectedIndex = -1; - nullable = null; - ((TitularesVida)((ComboBox)sender).DataContext).set_Tipo(nullable); - await this.ViewModel.ShowMessage("É NECESSÁRIO ADICIONAR PELO MENOS UM TITULAR DO TIPO SÓCIO OU FUNCIONÁRIO\nANTES DE ADICIONAR UM DEPENDENTE.", "OK", "", false); - return; - } - } - this.UpdateAutocompleteDependente((TitularesVida)((ComboBox)sender).DataContext); - } - } - - private void UpdateAutocompleteDependente(TitularesVida item) - { - this.DataGridTitulares.ScrollIntoView(item, this.DataGridTitulares.Columns.First((DataGridColumn x) => (string)x.Header == "TITULAR DEPENDENTE")); - this.DataGridTitulares.UpdateLayout(); - DataGridRow dataGridRow = (DataGridRow)this.DataGridTitulares.ItemContainerGenerator.ContainerFromItem(item); - if (dataGridRow == null) - { - return; - } - ((DataGridCell)DataGridExtensions.GetVisualChild(dataGridRow).ItemContainerGenerator.ContainerFromIndex(12)).Visibility = (item.get_Tipo().GetValueOrDefault() == 2 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.DataGridTitulares.ScrollIntoView(item, this.DataGridTitulares.Columns.First()); - this.DataGridTitulares.UpdateLayout(); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Views/Seguros/Itens/VidaView.cs b/Gestor.Application/Views/Seguros/Itens/VidaView.cs deleted file mode 100644 index afb86b5..0000000 --- a/Gestor.Application/Views/Seguros/Itens/VidaView.cs +++ /dev/null @@ -1,705 +0,0 @@ -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Seguros; -using Gestor.Application.ViewModels.Seguros.Itens; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -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.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Views.Seguros.Itens -{ - public class VidaView : BaseUserControl, IComponentConnector, IStyleConnector - { - public VidaViewModel ViewModel; - - private readonly MenuItemViewModel _menuItemViewModel; - - private bool _salvando; - - internal MenuItem IncluirItemButton; - - internal MenuItem SinistroButton; - - internal TextBox PlanoBox; - - internal RadioButton CoberturasRadioButton; - - internal RadioButton MaisInformacoesRadioButton; - - internal Menu BotoesTitulares; - - internal Separator SeparadorMaisInformacoes; - - internal System.Windows.Controls.ContentControl ContentControl; - - internal DataGrid DataGridTitulares; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public VidaView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) - { - this._menuItemViewModel = menuItemViewModel; - this.ViewModel = new VidaViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); - 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 - { - } - if (!lockInsert) - { - return; - } - this.IncluirItemButton.IsEnabled = false; - this.SinistroButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 4).get_Consultar()) - { - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(this.ViewModel.SelectedItem.get_Id()); - filtroArquivoDigital.set_IdApolice(this.ViewModel.SelectedItem.get_Documento().get_Id()); - filtroArquivoDigital.set_Tipo(4); - filtroArquivoDigital.set_Parente(this.ViewModel.SelectedItem); - 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)4), "."), "OK", "", false); - } - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLogEmail(3, this.ViewModel.SelectedItem.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void AlterarTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AlterarTitular(); - } - - private void AplicarTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AplicarTitular(); - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Trim().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.BuscarTitulares(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void BotoesTitulares_OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) - { - bool flag; - if (!((Menu)sender).IsEnabled) - { - this.ViewModel.AlteracaoTitularesVisibility = System.Windows.Visibility.Collapsed; - } - DataGrid dataGridTitulares = this.DataGridTitulares; - if (dataGridTitulares != null) - { - flag = dataGridTitulares.Columns.First(); - } - else - { - flag = false; - } - if (!flag) - { - return; - } - this.DataGridTitulares.Columns.First().Visibility = (((Menu)sender).IsEnabled ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void ContentLoad() - { - this.CoberturasRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - this.MaisInformacoesRadioButton.Checked += new RoutedEventHandler(this.Documento_OnChecked); - } - - private void CopyCodItem(object sender, MouseButtonEventArgs e) - { - this.ViewModel.CodigoItem.CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", this.ViewModel.CodigoItem), true); - } - - private void DataGridTitulares_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) - { - string text; - string str; - string text1; - if (!(e.EditingElement is TextBox)) - { - return; - } - TextBox editingElement = e.EditingElement as TextBox; - string stringFormat = e.Column.ClipboardContentBinding.StringFormat; - if (stringFormat == "d") - { - if (editingElement != null) - { - text = editingElement.Text; - } - else - { - text = null; - } - if (!string.IsNullOrEmpty(text)) - { - editingElement.Text = ValidationHelper.FormatDate(editingElement.Text); - return; - } - if (editingElement != null) - { - editingElement.Text = null; - return; - } - } - else if (stringFormat == "c") - { - if (editingElement != null) - { - str = editingElement.Text; - } - else - { - str = null; - } - if (!string.IsNullOrEmpty(str)) - { - editingElement.Text = ValidationHelper.FormatCurrency(editingElement.Text); - return; - } - if (editingElement != null) - { - editingElement.Text = null; - } - } - else - { - if (editingElement != null) - { - text1 = editingElement.Text; - } - else - { - text1 = null; - } - if (!string.IsNullOrEmpty(text1)) - { - if (e.Column.SortMemberPath == "Cpf") - { - editingElement.Text = ValidationHelper.FormatDocument(editingElement.Text); - return; - } - } - else if (editingElement != null) - { - editingElement.Text = null; - return; - } - } - } - - private void Dependente_CellLoaded(object sender, RoutedEventArgs e) - { - bool valueOrDefault; - if (sender == null) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - TitularesVida dataContext = (TitularesVida)((DataGridCell)sender).DataContext; - if (dataContext != null) - { - valueOrDefault = dataContext.get_Tipo().GetValueOrDefault() == 2; - } - else - { - valueOrDefault = false; - } - dataGridCell.Visibility = (valueOrDefault ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - } - - private void Documento_OnChecked(object sender, RoutedEventArgs e) - { - RadioButton radioButton = (RadioButton)sender; - if (string.IsNullOrEmpty(radioButton.GroupName)) - { - return; - } - this.ViewModel.Descarregar(); - this.ContentControl.Visibility = System.Windows.Visibility.Collapsed; - this.DataGridTitulares.Visibility = System.Windows.Visibility.Collapsed; - this.SeparadorMaisInformacoes.Visibility = System.Windows.Visibility.Collapsed; - this.BotoesTitulares.Visibility = System.Windows.Visibility.Collapsed; - this.DataGridTitulares.ClearInvalid(); - this.ContentControl.ClearInvalid(); - if (radioButton.Name != "MaisInformacoesRadioButton") - { - this.ContentControl.Visibility = System.Windows.Visibility.Visible; - this.ViewModel.CarregaCobertura(); - return; - } - this.SeparadorMaisInformacoes.Visibility = System.Windows.Visibility.Visible; - this.DataGridTitulares.Visibility = System.Windows.Visibility.Visible; - this.BotoesTitulares.Visibility = System.Windows.Visibility.Visible; - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(null); - } - else - { - } - } - } - - private void ExcluirTitular_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.ExcluirTitular(); - } - - private async void ImportarTitulares_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.ImportarTitulares(); - } - - private async void Incluir_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Incluir(false); - List> keyValuePairs = this.ViewModel.SelectedItem.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - private async void IncluirTitular_OnClick(object sender, RoutedEventArgs e) - { - TitularesVida titularesVida = this.DataGridTitulares.Items.Cast().FirstOrDefault(); - if (titularesVida == null || titularesVida.get_Inicio().HasValue || titularesVida.get_Fim().HasValue || titularesVida.get_Nome() != null || titularesVida.get_Fatura() != null || titularesVida.get_Cpf() != null || titularesVida.get_Tipo().HasValue || titularesVida.get_Observacao() != null) - { - this.ViewModel.IncluirTitular(); - this.UpdateAutocompleteDependente(this.DataGridTitulares.Items.Cast().First(), false); - } - else - { - await this.ViewModel.ShowMessage("JÁ EXISTE UM CAMPO DE CADASTRO DE TITULAR CRIADO", "OK", "", false); - } - } - - [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/itens/vidaview.xaml", UriKind.Relative)); - } - - public void Manter(ManutencaoItem manutencao) - { - this.ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(this.ViewModel.SelectedItem, false), string.Concat("CADASTRO DE SINISTROS - ", this.ViewModel.SelectedItem.get_Descricao()), nullable1, nullable, false)).ShowDialog(); - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel == null) - { - return; - } - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - - public async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this._salvando = true; - this.ViewModel.Loading(true); - this.ViewModel.SelectedItem.get_Vida().set_Plano(this.PlanoBox.Text); - this.DataGridTitulares.Focus(); - List> keyValuePairs = await this.ViewModel.Salvar(this.DataGridTitulares.Items.Cast().ToList()); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Loading(false); - this._salvando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else if (this.ViewModel.SelectedItem.get_Id() > (long)0) - { - MenuItemViewModel menuItemViewModel = this._menuItemViewModel; - if (menuItemViewModel != null) - { - menuItemViewModel.RecarregarItens(this.ViewModel.SelectedItem); - } - else - { - } - } - } - - public async Task Selecionar(Item item) - { - await this.ViewModel.SelecionaItem(item, true); - } - - public void Substituir() - { - this.ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); - } - - [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.IncluirItemButton = (MenuItem)target; - this.IncluirItemButton.Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 2: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 6: - { - ((TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(this.CopyCodItem); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click); - return; - } - case 8: - { - this.SinistroButton = (MenuItem)target; - this.SinistroButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick); - return; - } - case 11: - { - this.PlanoBox = (TextBox)target; - return; - } - case 12: - { - this.CoberturasRadioButton = (RadioButton)target; - return; - } - case 13: - { - this.MaisInformacoesRadioButton = (RadioButton)target; - return; - } - case 14: - { - this.BotoesTitulares = (Menu)target; - this.BotoesTitulares.IsEnabledChanged += new DependencyPropertyChangedEventHandler(this.BotoesTitulares_OnIsEnabledChanged); - return; - } - case 15: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTitular_OnClick); - return; - } - case 16: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AlterarTitular_OnClick); - return; - } - case 17: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirTitular_OnClick); - return; - } - case 18: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ImportarTitulares_OnClick); - return; - } - case 19: - { - this.SeparadorMaisInformacoes = (Separator)target; - return; - } - case 20: - { - ((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 21: - { - ((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 22: - { - ((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 23: - { - VidaView vidaView = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(vidaView.FormatarDocumento); - VidaView vidaView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(vidaView1.SomenteNumeros); - return; - } - case 24: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AplicarTitular_OnClick); - return; - } - case 25: - { - this.ContentControl = (System.Windows.Controls.ContentControl)target; - return; - } - case 26: - { - this.DataGridTitulares = (DataGrid)target; - this.DataGridTitulares.CellEditEnding += new EventHandler(this.DataGridTitulares_OnCellEditEnding); - 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 27: - { - ((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 28: - { - ((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 29: - { - ((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 30: - { - VidaView vidaView = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(vidaView.FormatarDocumento); - VidaView vidaView1 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(vidaView1.SomenteNumeros); - return; - } - case 31: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.TipoComboBoxSelectionChanged); - return; - } - case 32: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, VidaView.AutoCompleteBox_Populating)); - return; - } - case 33: - { - EventSetter eventSetter = new EventSetter() - { - Event = FrameworkElement.LoadedEvent, - Handler = new RoutedEventHandler(this.Dependente_CellLoaded) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - default: - { - return; - } - } - } - - private async void TipoComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) - { - bool dataContext; - ComboBox comboBox = (ComboBox)sender; - if (comboBox != null) - { - dataContext = comboBox.DataContext; - } - else - { - dataContext = false; - } - if (dataContext) - { - TipoTitular? nullable = ((TitularesVida)((ComboBox)sender).DataContext).get_Tipo(); - if (nullable.GetValueOrDefault() == 2 && !this._salvando && this.ViewModel.SelectedItem.get_Documento().get_Controle().get_Ramo().get_Id() != (long)6) - { - ObservableCollection titulares = this.ViewModel.Titulares; - if (!titulares.Any((TitularesVida x) => { - TipoTitular? tipo = x.get_Tipo(); - if (tipo.GetValueOrDefault() == 1) - { - return true; - } - tipo = x.get_Tipo(); - return tipo.GetValueOrDefault() == 0 & tipo.HasValue; - })) - { - ((ComboBox)sender).SelectedIndex = -1; - nullable = null; - ((TitularesVida)((ComboBox)sender).DataContext).set_Tipo(nullable); - await this.ViewModel.ShowMessage("É NECESSÁRIO ADICIONAR PELO MENOS UM TITULAR DO TIPO SÓCIO OU FUNCIONÁRIO\nANTES DE ADICIONAR UM DEPENDENTE.", "OK", "", false); - return; - } - } - this.UpdateAutocompleteDependente((TitularesVida)((ComboBox)sender).DataContext, false); - } - } - - private void UpdateAutocompleteDependente(TitularesVida item, bool scroll = true) - { - if (scroll) - { - this.DataGridTitulares.ScrollIntoView(item, this.DataGridTitulares.Columns.First((DataGridColumn x) => (string)x.Header == "TITULAR DEPENDENTE")); - } - this.DataGridTitulares.UpdateLayout(); - DataGridRow dataGridRow = (DataGridRow)this.DataGridTitulares.ItemContainerGenerator.ContainerFromItem(item); - if (dataGridRow == null) - { - return; - } - ((DataGridCell)DataGridExtensions.GetVisualChild(dataGridRow).ItemContainerGenerator.ContainerFromIndex(12)).Visibility = (item.get_Tipo().GetValueOrDefault() == 2 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - if (scroll) - { - this.DataGridTitulares.ScrollIntoView(item, this.DataGridTitulares.Columns.First()); - } - this.DataGridTitulares.UpdateLayout(); - } - } -} \ No newline at end of file -- cgit v1.2.3