summaryrefslogtreecommitdiff
path: root/Gestor.Application/Views/Ferramentas/VendedorView.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/Views/Ferramentas/VendedorView.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Views/Ferramentas/VendedorView.cs')
-rw-r--r--Gestor.Application/Views/Ferramentas/VendedorView.cs927
1 files changed, 0 insertions, 927 deletions
diff --git a/Gestor.Application/Views/Ferramentas/VendedorView.cs b/Gestor.Application/Views/Ferramentas/VendedorView.cs
deleted file mode 100644
index 1c2d4b4..0000000
--- a/Gestor.Application/Views/Ferramentas/VendedorView.cs
+++ /dev/null
@@ -1,927 +0,0 @@
-using CurrencyTextBoxControl;
-using Gestor.Application.Drawers;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.Servicos.Ferramentas;
-using Gestor.Application.ViewModels.Ferramentas;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Helpers;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.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.Input;
-using System.Windows.Markup;
-using Xceed.Wpf.AvalonDock.Controls;
-
-namespace Gestor.Application.Views.Ferramentas
-{
- public class VendedorView : BaseUserControl, IComponentConnector, IStyleConnector
- {
- public VendedorViewModel ViewModel;
-
- internal DataGrid VendedorGrid;
-
- internal MenuItem IncluirButton;
-
- internal MenuItem AlterarButton;
-
- internal MenuItem SalvarButton;
-
- internal MenuItem CancelarButton;
-
- internal MenuItem MaisOpcoesButton;
-
- internal TextBox EmpresaBox;
-
- internal TextBox IdBox;
-
- internal TextBox NomeBox;
-
- internal TextBox DocumentoPrincipalBox;
-
- internal AutoCompleteBox AutoCompleteBanco;
-
- internal TextBox AgenciaBox;
-
- internal ComboBox TipoBox;
-
- internal TextBox ContaBox;
-
- internal TextBox TitularBox;
-
- internal TextBox TitularDocBox;
-
- internal ComboBox TipoIncidenciaDescontoBox;
-
- internal ToggleButton AtivoBox;
-
- internal Grid GridContatos;
-
- private bool _contentLoaded;
-
- public bool UpdatingScroll
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public VendedorView()
- {
- base.Tag = "CADASTRO DE VENDEDOR";
- this.ViewModel = new VendedorViewModel();
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- }
-
- private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 6).get_Consultar())
- {
- FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital();
- filtroArquivoDigital.set_Id(this.ViewModel.SelectedVendedor.get_Id());
- filtroArquivoDigital.set_Tipo(6);
- filtroArquivoDigital.set_Parente(this.ViewModel.SelectedVendedor);
- 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 ", EnumHelper.GetDescription<TipoArquivoDigital>(6), "."), "OK", "", false);
- }
- }
-
- private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLog(15, this.ViewModel.SelectedVendedor.get_Id());
- }
-
- private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLogEmail(15, this.ViewModel.SelectedVendedor.get_Id());
- }
-
- private void AbrirLogRepasse_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = (Button)sender;
- if (button == null || button.DataContext == null)
- {
- return;
- }
- Repasse dataContext = (Repasse)button.DataContext;
- this.ViewModel.AbrirLog(54, dataContext.get_Id());
- }
-
- private async void Adiantamento_Click(object sender, RoutedEventArgs e)
- {
- if (this.ViewModel.SelectedVendedor == null || !this.ViewModel.SelectedVendedor.get_Corretora())
- {
- this.ViewModel.ShowDrawer(new AdiantamentoDrawerView(this.ViewModel.SelectedVendedor), 0, false);
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL ADICIONAR ADIANTAMENTOS PARA O VENDEDOR PRÓPRIA CORRETORA.", "OK", "", false);
- }
- }
-
- private async void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- bool corretora;
- object obj;
- Vendedor selectedVendedor = this.ViewModel.SelectedVendedor;
- if (selectedVendedor != null)
- {
- corretora = selectedVendedor.get_Corretora();
- }
- else
- {
- corretora = false;
- }
- bool flag = corretora;
- if (flag)
- {
- if (Recursos.Usuario.get_Id() == 0)
- {
- this.AlterarPropriaCorretora(true);
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA.", "OK", "", false);
- return;
- }
- }
- this.ViewModel.IsExpanded = false;
- VendedorViewModel viewModel = this.ViewModel;
- Vendedor vendedor = this.ViewModel.SelectedVendedor;
- if (vendedor != null)
- {
- obj = vendedor.Clone();
- }
- else
- {
- obj = null;
- }
- viewModel.CancelVendedor = (Vendedor)obj;
- if (!flag)
- {
- this.ViewModel.Alterar(true);
- }
- this.ValidarTela();
- }
-
- public void AlterarPropriaCorretora(bool habilitar = false)
- {
- if (habilitar)
- {
- this.NomeBox.IsReadOnly = false;
- this.DocumentoPrincipalBox.IsReadOnly = false;
- this.AlterarButton.IsEnabled = false;
- this.SalvarButton.IsEnabled = true;
- this.CancelarButton.IsEnabled = true;
- this.IncluirButton.IsEnabled = false;
- return;
- }
- this.NomeBox.IsReadOnly = true;
- this.DocumentoPrincipalBox.IsReadOnly = true;
- this.AlterarButton.IsEnabled = true;
- this.SalvarButton.IsEnabled = false;
- this.CancelarButton.IsEnabled = false;
- this.IncluirButton.IsEnabled = false;
- }
-
- private async void AtivarInativarRepasse_OnClick(object sender, RoutedEventArgs e)
- {
- if (!this.ViewModel.SelectedVendedor.get_Corretora())
- {
- Repasse dataContext = (Repasse)((Button)sender).DataContext;
- if (dataContext != null)
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.AtivarInativarRepasse(dataContext);
- this.ScrollVendedor();
- this.ViewModel.Loading(false);
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA.", "OK", "", false);
- }
- }
-
- private async void AtivarInativarVendedor_OnClick(object sender, RoutedEventArgs e)
- {
- if (this.ViewModel.SelectedVendedor != null)
- {
- if (this.ViewModel.SelectedVendedor.get_Corretora())
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA.", "OK", "", false);
- }
- else if (!await this.BuscaVinculo(this.ViewModel.SelectedVendedor))
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.AtivarInativarVendedor(this.ViewModel.SelectedVendedor);
- this.ScrollVendedor();
- this.ViewModel.Loading(false);
- }
- }
- }
-
- private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
- {
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- VendedorView.SetValid(autoCompleteBox, (string.IsNullOrWhiteSpace(autoCompleteBox.get_Text()) ? true : this.ViewModel.SelectedVendedor.get_Banco() != null));
- }
-
- private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Banco>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarVendedor("");
- }
-
- private void AutoCompleteBoxVendedor_Populating(object sender, PopulatingEventArgs e)
- {
- e.set_Cancel(true);
- this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Vendedor>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private async Task<bool> BuscaVinculo(Vendedor vendedor)
- {
- bool flag;
- if (await (new VendedorUsuarioServico()).FindVinculo(vendedor))
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL INATIVAR VENDEDOR QUE POSSUI VINCULO DE USUÁRIO.", "OK", "", false);
- this.ViewModel.Loading(false);
- flag = true;
- }
- else
- {
- flag = false;
- }
- return flag;
- }
-
- public async void Button_Click(object sender, RoutedEventArgs e)
- {
- if (this.ViewModel.SelectedVendedor == null || !this.ViewModel.SelectedVendedor.get_Corretora())
- {
- this.ViewModel.Loading(true);
- if (await this.ViewModel.VerificarPermissao(30, false))
- {
- this.ViewModel.ShowDrawer(new MetaVendedorView(this.ViewModel.SelectedVendedor), 0, false);
- this.ViewModel.Loading(false);
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO É POSSÍVEL CRIAR METAS DE VENDEDOR PARA O VENDEDOR PRÓPRIA CORRETORA.", "OK", "", false);
- }
- }
-
- private void Cancelar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelarAlteracao();
- this.ViewModel.IsExpanded = true;
- if (Recursos.Usuario.get_Id() == 0)
- {
- this.AlterarPropriaCorretora(false);
- }
- }
-
- private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e)
- {
- if (((TextBox)sender).IsReadOnly)
- {
- return;
- }
- string str = ValidationHelper.Clear(this.DocumentoPrincipalBox.Text);
- if (string.IsNullOrEmpty(str))
- {
- return;
- }
- this.DocumentoPrincipalBox.Text = (str.Length == 11 ? ValidationHelper.FormatDocument(str.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(str.PadLeft(14, '0').Substring(0, 14)));
- }
-
- private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = sender as Button;
- if (button == null)
- {
- return;
- }
- ListBox listBox = Extentions.FindVisualAncestor<ListBox>(button);
- VendedorTelefone item = (VendedorTelefone)listBox.Items[listBox.Items.IndexOf(button.DataContext)];
- this.ViewModel.ExcluirTelefone(item);
- }
-
- private async void ExcluirVinculo_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = (Button)sender;
- if (button != null && button.DataContext != null)
- {
- VinculoRepasse dataContext = (VinculoRepasse)button.DataContext;
- this.ViewModel.Loading(true);
- await this.ViewModel.ExcluirVinculo(dataContext);
- this.ViewModel.Loading(false);
- }
- }
-
- private void FormaPagtoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- ComboBox comboBox = (ComboBox)sender;
- if (comboBox.SelectedItem == null)
- {
- return;
- }
- Grid grid = ViewHelper.FindAncestor<Grid>(comboBox).FirstOrDefault<Grid>();
- if (grid == null)
- {
- return;
- }
- ComboBox comboBox1 = (ComboBox)FindVisualChild.Find<ComboBox>(grid).FindName("BasePagtoBox");
- FormaRepasse selectedItem = (FormaRepasse)comboBox.SelectedItem;
- if (comboBox1 == null)
- {
- return;
- }
- comboBox1.IsEnabled = true;
- switch (selectedItem)
- {
- case 1:
- {
- comboBox1.SelectedItem = null;
- return;
- }
- case 2:
- {
- comboBox1.SelectedItem = (BaseRepasse)1;
- return;
- }
- case 3:
- {
- comboBox1.SelectedItem = (BaseRepasse)3;
- comboBox1.IsEnabled = false;
- return;
- }
- default:
- {
- return;
- }
- }
- }
-
- private void Incluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Incluir();
- this.AutoCompleteBanco.set_Text("");
- this.ValidarTela();
- }
-
- private void IncluirRepasse_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IncluirRepasse();
- this.ValidarTela();
- }
-
- private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IncluirTelefone();
- this.ValidarTela();
- }
-
- private async void IncluirVinculo_OnClick(object sender, RoutedEventArgs e)
- {
- bool dataContext;
- List<Repasse> repasses;
- Repasse repasse;
- VinculoRepasse vinculoRepasse;
- Button button = (Button)sender;
- Button button1 = button;
- if (button1 != null)
- {
- dataContext = button1.DataContext;
- }
- else
- {
- dataContext = false;
- }
- if (dataContext)
- {
- this.ViewModel.Loading(true);
- repasses = await (new VendedorServico()).BuscaRepasses();
- repasse = (Repasse)button.DataContext;
- VinculoRepasse vinculoRepasse1 = new VinculoRepasse();
- vinculoRepasse1.set_IdRepasse(repasse.get_Id());
- VinculoRepasse vinculoRepasse2 = vinculoRepasse1;
- if (repasse.get_Ativo())
- {
- vinculoRepasse = await this.ViewModel.ShowVinculoDialog(vinculoRepasse2, repasses, repasse);
- if (vinculoRepasse != null)
- {
- List<KeyValuePair<string, string>> keyValuePairs = vinculoRepasse.Validate(repasse.get_Vinculo(), repasse);
- while (keyValuePairs != null && keyValuePairs.Count > 0)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, "OS CAMPOS ABAIXO ESTÃO INVÁLIDOS.", "OK", "");
- vinculoRepasse = await this.ViewModel.ShowVinculoDialog(vinculoRepasse, repasses, repasse);
- if (vinculoRepasse != null)
- {
- keyValuePairs = vinculoRepasse.Validate(repasse.get_Vinculo(), repasse);
- }
- else
- {
- this.ViewModel.Loading(false);
- button = null;
- repasses = null;
- repasse = null;
- vinculoRepasse = null;
- return;
- }
- }
- await this.ViewModel.SalvarVinculo(vinculoRepasse);
- this.ViewModel.Loading(false);
- }
- else
- {
- this.ViewModel.Loading(false);
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("POR FAVOR, ATIVE O REPASSE PARA VINCULÁ-LO", "OK", "", false);
- this.ViewModel.Loading(false);
- }
- }
- button = null;
- repasses = null;
- repasse = null;
- vinculoRepasse = null;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- {
- return;
- }
- this._contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/views/ferramentas/vendedorview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- this.ViewModel.IsExpanded = true;
- if (!this.ViewModel.SelectedVendedor.get_Ativo())
- {
- if (await this.BuscaVinculo(this.ViewModel.SelectedVendedor))
- {
- return;
- }
- }
- List<KeyValuePair<string, string>> 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 (Recursos.Usuario.get_Id() == 0)
- {
- this.AlterarPropriaCorretora(false);
- }
- this.ScrollVendedor();
- }
- }
-
- private void ScrollVendedor()
- {
- if (!this.UpdatingScroll && this.VendedorGrid.SelectedItem != null)
- {
- this.VendedorGrid.ScrollIntoView(this.VendedorGrid.SelectedItem);
- }
- this.UpdatingScroll = false;
- }
-
- private static void SetValid(AutoCompleteBox autocomplete, bool valid)
- {
- ViewHelper.SetInvalid(autocomplete, "BANCO INVÁLIDO", valid);
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, VendedorView.AutoCompleteBoxVendedor_Populating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
- return;
- }
- case 2:
- {
- this.VendedorGrid = (DataGrid)target;
- return;
- }
- case 3:
- {
- this.IncluirButton = (MenuItem)target;
- this.IncluirButton.Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 4:
- {
- this.AlterarButton = (MenuItem)target;
- this.AlterarButton.Click += new RoutedEventHandler(this.Alterar_OnClick);
- return;
- }
- case 5:
- {
- this.SalvarButton = (MenuItem)target;
- this.SalvarButton.Click += new RoutedEventHandler(this.Salvar_OnClick);
- return;
- }
- case 6:
- {
- this.CancelarButton = (MenuItem)target;
- this.CancelarButton.Click += new RoutedEventHandler(this.Cancelar_OnClick);
- return;
- }
- case 7:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Adiantamento_Click);
- return;
- }
- case 8:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Button_Click);
- return;
- }
- case 9:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click);
- return;
- }
- case 10:
- {
- this.MaisOpcoesButton = (MenuItem)target;
- return;
- }
- case 11:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
- return;
- }
- case 12:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick);
- return;
- }
- case 13:
- {
- this.EmpresaBox = (TextBox)target;
- return;
- }
- case 14:
- {
- this.IdBox = (TextBox)target;
- return;
- }
- case 15:
- {
- this.NomeBox = (TextBox)target;
- return;
- }
- case 16:
- {
- this.DocumentoPrincipalBox = (TextBox)target;
- VendedorView vendedorView = this;
- this.DocumentoPrincipalBox.PreviewTextInput += new TextCompositionEventHandler(vendedorView.SomenteNumeros);
- this.DocumentoPrincipalBox.LostFocus += new RoutedEventHandler(this.DocumentoPrincipalBox_LostFocus);
- return;
- }
- case 17:
- {
- this.AutoCompleteBanco = (AutoCompleteBox)target;
- this.AutoCompleteBanco.add_Populating(new PopulatingEventHandler(this, VendedorView.AutoCompleteBancoBox_Populating));
- this.AutoCompleteBanco.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.AutoCompleteBanco_OnLostKeyboardFocus);
- return;
- }
- case 18:
- {
- this.AgenciaBox = (TextBox)target;
- return;
- }
- case 19:
- {
- this.TipoBox = (ComboBox)target;
- return;
- }
- case 20:
- {
- this.ContaBox = (TextBox)target;
- return;
- }
- case 21:
- {
- this.TitularBox = (TextBox)target;
- return;
- }
- case 22:
- {
- this.TitularDocBox = (TextBox)target;
- VendedorView vendedorView1 = this;
- this.TitularDocBox.PreviewTextInput += new TextCompositionEventHandler(vendedorView1.SomenteNumeros);
- return;
- }
- case 23:
- {
- this.TipoIncidenciaDescontoBox = (ComboBox)target;
- return;
- }
- case 24:
- {
- this.AtivoBox = (ToggleButton)target;
- return;
- }
- case 25:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AtivarInativarVendedor_OnClick);
- return;
- }
- case 26:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirRepasse_OnClick);
- return;
- }
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
- case 32:
- {
- this._contentLoaded = true;
- return;
- }
- case 33:
- {
- this.GridContatos = (Grid)target;
- return;
- }
- case 34:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTelefone_OnClick);
- return;
- }
- default:
- {
- this._contentLoaded = true;
- return;
- }
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 27:
- {
- ((Button)target).Click += new RoutedEventHandler(this.IncluirVinculo_OnClick);
- return;
- }
- case 28:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AbrirLogRepasse_OnClick);
- return;
- }
- case 29:
- {
- ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.TipoBox_OnSelectionChanged);
- return;
- }
- case 30:
- {
- ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.FormaPagtoBox_OnSelectionChanged);
- return;
- }
- case 31:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AtivarInativarRepasse_OnClick);
- return;
- }
- case 32:
- {
- ((Button)target).Click += new RoutedEventHandler(this.ExcluirVinculo_OnClick);
- return;
- }
- case 33:
- case 34:
- {
- return;
- }
- case 35:
- {
- ((Button)target).Click += new RoutedEventHandler(this.ExcluirTelefone_OnClick);
- return;
- }
- case 36:
- {
- VendedorView vendedorView = this;
- ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(vendedorView.SomenteNumeros);
- return;
- }
- case 37:
- {
- VendedorView vendedorView1 = this;
- ((TextBox)target).LostFocus += new RoutedEventHandler(vendedorView1.FormatarTelefone);
- VendedorView vendedorView2 = this;
- ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(vendedorView2.SomenteNumeros);
- return;
- }
- default:
- {
- return;
- }
- }
- }
-
- private void TipoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- ComboBox comboBox = (ComboBox)sender;
- if (comboBox.SelectedItem == null)
- {
- return;
- }
- ListBoxItem listBoxItem = ViewHelper.FindAncestor<ListBoxItem>(comboBox).FirstOrDefault<ListBoxItem>();
- if (listBoxItem == null)
- {
- return;
- }
- ComboBox comboBox1 = (ComboBox)FindVisualChild.Find<ComboBox>(listBoxItem).FindName("FormaPagtoBox");
- if (comboBox1 == null)
- {
- return;
- }
- CurrencyTextBox currencyTextBox = (CurrencyTextBox)FindVisualChild.Find<CurrencyTextBox>(listBoxItem).FindName("ValorBox");
- CurrencyTextBox currencyTextBox1 = (CurrencyTextBox)FindVisualChild.Find<CurrencyTextBox>(listBoxItem).FindName("RenovacoesBox");
- TipoRepasse selectedItem = (TipoRepasse)comboBox.SelectedItem;
- comboBox1.SelectedItem = (FormaRepasse)1;
- if (selectedItem == 1)
- {
- if (currencyTextBox != null)
- {
- currencyTextBox.set_MaximumValue(new decimal(10000));
- }
- if (currencyTextBox1 != null)
- {
- currencyTextBox1.set_MaximumValue(new decimal(10000));
- }
- }
- else if (selectedItem == 2)
- {
- if (currencyTextBox != null)
- {
- currencyTextBox.set_MaximumValue(new decimal(100));
- }
- if (currencyTextBox1 != null)
- {
- currencyTextBox1.set_MaximumValue(new decimal(100));
- return;
- }
- }
- }
-
- private void ValidarTela()
- {
- object keyValuePairs;
- object obj;
- if (this.ViewModel.SelectedVendedor == null)
- {
- return;
- }
- List<KeyValuePair<string, string>> keyValuePairs1 = this.ViewModel.SelectedVendedor.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- List<VendedorTelefone> telefones = this.ViewModel.SelectedVendedor.get_Telefones();
- if (telefones != null)
- {
- VendedorTelefone vendedorTelefone = telefones.FirstOrDefault<VendedorTelefone>();
- if (vendedorTelefone != null)
- {
- keyValuePairs = vendedorTelefone.Validate();
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = null;
- }
- if (keyValuePairs == null)
- {
- keyValuePairs = new List<KeyValuePair<string, string>>();
- }
- keyValuePairs2.AddRange((IEnumerable<!0>)keyValuePairs);
- List<KeyValuePair<string, string>> keyValuePairs3 = keyValuePairs1;
- ObservableCollection<Repasse> repasses = this.ViewModel.Repasses;
- if (repasses != null)
- {
- Repasse repasse = repasses.FirstOrDefault<Repasse>();
- if (repasse != null)
- {
- obj = repasse.Validate();
- }
- else
- {
- obj = null;
- }
- }
- else
- {
- obj = null;
- }
- if (obj == null)
- {
- obj = new List<KeyValuePair<string, string>>();
- }
- keyValuePairs3.AddRange((IEnumerable<!0>)obj);
- this.ValidateFields(keyValuePairs1, false);
- }
-
- private void VendedorView_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- if (e.NewSize.Width > 1260)
- {
- this.ViewModel.GridHeight2 = new GridLength(0);
- Grid.SetRow(this.GridContatos, 0);
- Grid.SetColumn(this.GridContatos, 1);
- return;
- }
- this.ViewModel.GridHeight2 = new GridLength(1, GridUnitType.Star);
- Grid.SetRow(this.GridContatos, 1);
- Grid.SetColumn(this.GridContatos, 0);
- }
- }
-} \ No newline at end of file