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/PerfilEmpresaView.cs | 267 +++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 Codemerx/Gestor.Application/Views/Seguros/PerfilEmpresaView.cs (limited to 'Codemerx/Gestor.Application/Views/Seguros/PerfilEmpresaView.cs') diff --git a/Codemerx/Gestor.Application/Views/Seguros/PerfilEmpresaView.cs b/Codemerx/Gestor.Application/Views/Seguros/PerfilEmpresaView.cs new file mode 100644 index 0000000..3d80f8c --- /dev/null +++ b/Codemerx/Gestor.Application/Views/Seguros/PerfilEmpresaView.cs @@ -0,0 +1,267 @@ +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +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 Xceed.Wpf.Toolkit; + +namespace Gestor.Application.Views.Seguros +{ + public class PerfilEmpresaView : BaseUserControl, IComponentConnector + { + public PerfilEmpresaViewModel ViewModel; + + private Controle _controle; + + internal MenuItem CancelarApoliceButton; + + internal TextBox TextAtividade; + + internal CustomIsReadOnlyControl ComboSegurancaControl; + + internal CheckComboBox ComboSeguranca; + + internal CustomIsReadOnlyControl ComboIncendioControl; + + internal CheckComboBox ComboIncendio; + + internal CheckBox ExclusivoDeposito; + + internal CheckBox DivisaTerrenoBaldio; + + internal CheckBox PatrimonioHistorio; + + internal CheckBox PossuiTelhado; + + internal CheckBox CaixasEletronicos; + + internal CheckBox Isopainel; + + internal CheckBox ConstrucaoReforma; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public PerfilEmpresaView(Controle controle) + { + this._controle = controle; + base.Tag = "CADASTRO DE PERFIL"; + this.ViewModel = new PerfilEmpresaViewModel(controle); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + this.LoadData(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Alterar(true); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + bool id; + this.ViewModel.CancelarAlteracao(); + PerfilEmpresa selectedPerfilEmpresa = this.ViewModel.SelectedPerfilEmpresa; + if (selectedPerfilEmpresa != null) + { + id = selectedPerfilEmpresa.get_Id() == (long)0; + } + else + { + id = false; + } + if (id || this.ViewModel.SelectedPerfilEmpresa == null) + { + this.ViewModel.EnableIncluirPerfil = true; + } + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await this.ViewModel.Excluir(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.EnableIncluirPerfil = false; + this.ViewModel.Incluir(); + } + + [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/perfilempresaview.xaml", UriKind.Relative)); + } + + private void LoadData() + { + this.ComboSeguranca.BindData(false, true, "", false); + this.ComboIncendio.BindData(false, true, "", false); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Loading(true); + List> keyValuePairs = await this.ViewModel.Salvar(); + this.ViewModel.Loading(false); + if (keyValuePairs != null) + { + await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); + } + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 1: + { + ((MenuItem)target).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: + { + this.CancelarApoliceButton = (MenuItem)target; + this.CancelarApoliceButton.Click += new RoutedEventHandler(this.Cancelar_OnClick); + return; + } + case 5: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); + return; + } + case 6: + { + PerfilEmpresaView perfilEmpresaView = this; + ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(perfilEmpresaView.SomenteNumeros); + return; + } + case 7: + { + ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.VerificaOnSelected); + return; + } + case 8: + { + this.TextAtividade = (TextBox)target; + return; + } + case 9: + { + this.ComboSegurancaControl = (CustomIsReadOnlyControl)target; + return; + } + case 10: + { + this.ComboSeguranca = (CheckComboBox)target; + return; + } + case 11: + { + this.ComboIncendioControl = (CustomIsReadOnlyControl)target; + return; + } + case 12: + { + this.ComboIncendio = (CheckComboBox)target; + return; + } + case 13: + { + this.ExclusivoDeposito = (CheckBox)target; + return; + } + case 14: + { + this.DivisaTerrenoBaldio = (CheckBox)target; + return; + } + case 15: + { + this.PatrimonioHistorio = (CheckBox)target; + return; + } + case 16: + { + this.PossuiTelhado = (CheckBox)target; + return; + } + case 17: + { + this.CaixasEletronicos = (CheckBox)target; + return; + } + case 18: + { + this.Isopainel = (CheckBox)target; + return; + } + case 19: + { + this.ConstrucaoReforma = (CheckBox)target; + return; + } + } + this._contentLoaded = true; + } + + private void VerificaOnSelected(object sender, SelectionChangedEventArgs e) + { + ComboBox comboBox = (ComboBox)sender; + if (comboBox.SelectedItem == null) + { + return; + } + if (EnumHelper.GetDescription(comboBox.SelectedItem) == EnumHelper.GetDescription(0)) + { + this.ViewModel.AtivaCampos = System.Windows.Visibility.Visible; + return; + } + if (this.ViewModel.AtivaCampos == System.Windows.Visibility.Visible) + { + this.TextAtividade.Text = ""; + this.ViewModel.AtivaCampos = System.Windows.Visibility.Collapsed; + } + } + } +} \ No newline at end of file -- cgit v1.2.3