summaryrefslogtreecommitdiff
path: root/Gestor.Application/Componentes/ProspeccaoDialog.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/Componentes/ProspeccaoDialog.cs')
-rw-r--r--Gestor.Application/Componentes/ProspeccaoDialog.cs398
1 files changed, 0 insertions, 398 deletions
diff --git a/Gestor.Application/Componentes/ProspeccaoDialog.cs b/Gestor.Application/Componentes/ProspeccaoDialog.cs
deleted file mode 100644
index 151bc2a..0000000
--- a/Gestor.Application/Componentes/ProspeccaoDialog.cs
+++ /dev/null
@@ -1,398 +0,0 @@
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using MaterialDesignThemes.Wpf;
-using System;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Markup;
-using Xceed.Wpf.AvalonDock.Controls;
-
-namespace Gestor.Application.Componentes
-{
- public class ProspeccaoDialog : BaseUserControl, IComponentConnector, IStyleConnector
- {
- public DialogProspeccaoViewModel ViewModel;
-
- internal TextBox DocumentoBox;
-
- internal DatePicker NascimentoBox;
-
- internal TextBox Prefixo1Box;
-
- internal TextBox Telefone1Box;
-
- internal TextBox Prefixo2Box;
-
- internal TextBox Telefone2Box;
-
- internal TextBox EmailBox;
-
- internal MenuItem SalvarButton;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public ProspeccaoDialog(Prospeccao prospeccao)
- {
- this.ViewModel = new DialogProspeccaoViewModel(prospeccao);
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- }
-
- private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Anexar();
- }
-
- private async void AutoCompleteBox_LostFocus(object sender, RoutedEventArgs e)
- {
- bool count;
- ClienteTelefone item;
- bool flag;
- ClienteTelefone clienteTelefone;
- bool email;
- string str;
- string numero;
- string prefixo;
- string numero1;
- string prefixo1;
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- if (autoCompleteBox.get_SelectedItem() != null)
- {
- Cliente cliente = await this.ViewModel.BuscarInfoCliente((Cliente)autoCompleteBox.get_SelectedItem());
- this.DocumentoBox.Text = cliente.get_Documento();
- this.NascimentoBox.SelectedDate = cliente.get_Nascimento();
- ObservableCollection<ClienteTelefone> telefones = cliente.get_Telefones();
- if (telefones != null)
- {
- count = telefones.Count > 0;
- }
- else
- {
- count = false;
- }
- if (count)
- {
- item = cliente.get_Telefones()[0];
- }
- else
- {
- item = null;
- }
- ClienteTelefone clienteTelefone1 = item;
- if (clienteTelefone1 != null && clienteTelefone1.get_Prefixo() != null)
- {
- TextBox prefixo1Box = this.Prefixo1Box;
- if (clienteTelefone1 != null)
- {
- prefixo1 = clienteTelefone1.get_Prefixo();
- }
- else
- {
- prefixo1 = null;
- }
- prefixo1Box.Text = prefixo1;
- }
- if (clienteTelefone1 != null && clienteTelefone1.get_Numero() != null)
- {
- TextBox telefone1Box = this.Telefone1Box;
- if (clienteTelefone1 != null)
- {
- numero1 = clienteTelefone1.get_Numero();
- }
- else
- {
- numero1 = null;
- }
- telefone1Box.Text = numero1;
- }
- ObservableCollection<ClienteTelefone> observableCollection = cliente.get_Telefones();
- if (observableCollection != null)
- {
- flag = observableCollection.Count > 1;
- }
- else
- {
- flag = false;
- }
- if (flag)
- {
- clienteTelefone = cliente.get_Telefones()[1];
- }
- else
- {
- clienteTelefone = null;
- }
- ClienteTelefone clienteTelefone2 = clienteTelefone;
- if (clienteTelefone2 != null && clienteTelefone2.get_Prefixo() != null)
- {
- TextBox prefixo2Box = this.Prefixo2Box;
- if (clienteTelefone2 != null)
- {
- prefixo = clienteTelefone2.get_Prefixo();
- }
- else
- {
- prefixo = null;
- }
- prefixo2Box.Text = prefixo;
- }
- if (clienteTelefone2 != null && clienteTelefone2.get_Numero() != null)
- {
- TextBox telefone2Box = this.Telefone2Box;
- if (clienteTelefone2 != null)
- {
- numero = clienteTelefone2.get_Numero();
- }
- else
- {
- numero = null;
- }
- telefone2Box.Text = numero;
- }
- ObservableCollection<ClienteEmail> emails = cliente.get_Emails();
- if (emails != null)
- {
- ClienteEmail clienteEmail = emails.FirstOrDefault<ClienteEmail>();
- if (clienteEmail != null)
- {
- email = clienteEmail.get_Email();
- }
- else
- {
- email = false;
- }
- }
- else
- {
- email = false;
- }
- if (email)
- {
- TextBox emailBox = this.EmailBox;
- ObservableCollection<ClienteEmail> emails1 = cliente.get_Emails();
- if (emails1 != null)
- {
- ClienteEmail clienteEmail1 = emails1.FirstOrDefault<ClienteEmail>();
- if (clienteEmail1 != null)
- {
- str = clienteEmail1.get_Email();
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- emailBox.Text = str;
- }
- }
- }
-
- private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Trim().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim()), null, 2).ContinueWith((Task<List<Cliente>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e)
- {
- Chip chip = sender as Chip;
- if (chip == null)
- {
- return;
- }
- ListBox listBox = Extentions.FindVisualAncestor<ListBox>(chip);
- ArquivoDigital item = (ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)];
- if (item == null)
- {
- return;
- }
- this.ViewModel.Delete(item);
- }
-
- private void DocumentoBox_OnLostFocus(object sender, RoutedEventArgs e)
- {
- TextBox textBox = (TextBox)sender;
- textBox.Text = ValidationHelper.FormatDocument(textBox.Text);
- }
-
- [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/componentes/prospeccaodialog.xaml", UriKind.Relative));
- }
-
- private void SalvarButton_OnClick(object sender, RoutedEventArgs e)
- {
- List<ArquivoDigital> list;
- Prospeccao selectedProspeccao = this.ViewModel.SelectedProspeccao;
- ObservableCollection<ArquivoDigital> arquivosAnexados = this.ViewModel.ArquivosAnexados;
- if (arquivosAnexados != null)
- {
- list = arquivosAnexados.ToList<ArquivoDigital>();
- }
- else
- {
- list = null;
- }
- selectedProspeccao.set_Anexos(list);
- DialogHost.CloseDialogCommand.Execute(this.ViewModel.SelectedProspeccao, this.SalvarButton);
- }
-
- [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, ProspeccaoDialog.AutoCompleteBox_Populating));
- ((AutoCompleteBox)target).LostFocus += new RoutedEventHandler(this.AutoCompleteBox_LostFocus);
- return;
- }
- case 2:
- {
- this.DocumentoBox = (TextBox)target;
- ProspeccaoDialog prospeccaoDialog = this;
- this.DocumentoBox.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog.SomenteNumeros);
- this.DocumentoBox.LostFocus += new RoutedEventHandler(this.DocumentoBox_OnLostFocus);
- return;
- }
- case 3:
- {
- this.NascimentoBox = (DatePicker)target;
- this.NascimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.NascimentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- this.NascimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- return;
- }
- case 4:
- {
- this.Prefixo1Box = (TextBox)target;
- ProspeccaoDialog prospeccaoDialog1 = this;
- this.Prefixo1Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog1.SomenteNumeros);
- return;
- }
- case 5:
- {
- this.Telefone1Box = (TextBox)target;
- ProspeccaoDialog prospeccaoDialog2 = this;
- this.Telefone1Box.LostFocus += new RoutedEventHandler(prospeccaoDialog2.FormatarTelefone);
- ProspeccaoDialog prospeccaoDialog3 = this;
- this.Telefone1Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog3.SomenteNumeros);
- return;
- }
- case 6:
- {
- this.Prefixo2Box = (TextBox)target;
- ProspeccaoDialog prospeccaoDialog4 = this;
- this.Prefixo2Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog4.SomenteNumeros);
- return;
- }
- case 7:
- {
- this.Telefone2Box = (TextBox)target;
- ProspeccaoDialog prospeccaoDialog5 = this;
- this.Telefone2Box.LostFocus += new RoutedEventHandler(prospeccaoDialog5.FormatarTelefone);
- ProspeccaoDialog prospeccaoDialog6 = this;
- this.Telefone2Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog6.SomenteNumeros);
- return;
- }
- case 8:
- {
- this.EmailBox = (TextBox)target;
- return;
- }
- case 9:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- return;
- }
- case 10:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- return;
- }
- case 11:
- {
- this._contentLoaded = true;
- return;
- }
- case 12:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick);
- return;
- }
- case 13:
- {
- this.SalvarButton = (MenuItem)target;
- this.SalvarButton.Click += new RoutedEventHandler(this.SalvarButton_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)
- {
- if (connectionId == 11)
- {
- ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick));
- }
- }
- }
-} \ No newline at end of file