summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Application/Views/Ferramentas/SeguradoraView.cs
blob: 68421cd091151f81325f5852b725012687713a47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
using CurrencyTextBoxControl;
using Gestor.Application.Drawers;
using Gestor.Application.Helpers;
using Gestor.Application.Servicos;
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.Configuracoes;
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.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 System.Windows.Threading;
using Xceed.Wpf.AvalonDock.Controls;

namespace Gestor.Application.Views.Ferramentas
{
	public class SeguradoraView : BaseUserControl, IComponentConnector, IStyleConnector
	{
		public SeguradoraViewModel ViewModel;

		internal DataGrid SeguradoraGrid;

		internal DataGridTextColumn NomeField;

		internal DataGridTextColumn ApelidoField;

		internal MenuItem MaisOpcoesButton;

		internal ToggleButton AtivoBox;

		internal TextBox DocumentoPrincipalBox;

		internal TextBox AssistenciaBox;

		internal TextBox SusepBox;

		internal TextBox CodigoCiaBox;

		internal TextBox LinkAppAndroidBox;

		internal TextBox LinkAppIosBox;

		internal CurrencyTextBox ToleranciaComissaoBox;

		internal CurrencyTextBox ToleranciaPremioBox;

		internal TextBox ObservacaoBox;

		internal ListBox ContatosListBox;

		internal ListBox EnderecoSeguradoraBox;

		private bool _contentLoaded;

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		internal Delegate _CreateDelegate(Type delegateType, string handler)
		{
			return Delegate.CreateDelegate(delegateType, this, handler);
		}

		public SeguradoraView()
		{
			base.Tag = "CADASTRO DE SEGURADORA";
			this.Tela = 13;
			this.ViewModel = new SeguradoraViewModel();
			base.DataContext = this.ViewModel;
			this.InitializeComponent();
			System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher;
			if (dispatcher == null)
			{
				return;
			}
			dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad));
		}

		private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
		{
			if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 8).get_Consultar())
			{
				FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital();
				filtroArquivoDigital.set_Id(this.ViewModel.SelectedSeguradora.get_Id());
				filtroArquivoDigital.set_Tipo(8);
				filtroArquivoDigital.set_Parente(this.ViewModel.SelectedSeguradora);
				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>(8), "."), "OK", "", false);
			}
		}

		private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.AbrirLog(13, this.ViewModel.SelectedSeguradora.get_Id());
		}

		private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.AbrirLogEmail(13, this.ViewModel.SelectedSeguradora.get_Id());
		}

		private void Alterar_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.Clonar();
			this.ViewModel.Alterar(true);
			this.ValidarTela();
		}

		private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
		{
			if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
			{
				return;
			}
			this.ViewModel.FiltrarSeguradora("");
		}

		private void AutoCompleteBoxDescricao_OnTextChanged(object sender, RoutedEventArgs e)
		{
			if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
			{
				return;
			}
			this.ViewModel.FiltrarDescricao("");
		}

		private void AutoCompleteBoxDescricao_Populating(object sender, PopulatingEventArgs e)
		{
			e.set_Cancel(true);
			this.ViewModel.FiltrarConfig(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<ConfigExtratoImport>> searchResult) => {
				if (searchResult.Result == null)
				{
					return;
				}
				AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
				autoCompleteBox.set_ItemsSource(searchResult.Result);
				autoCompleteBox.PopulateComplete();
			}, TaskScheduler.FromCurrentSynchronizationContext());
		}

		private void AutoCompleteBoxSeguradora_Populating(object sender, PopulatingEventArgs e)
		{
			e.set_Cancel(true);
			this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Seguradora>> searchResult) => {
				if (searchResult.Result == null)
				{
					return;
				}
				AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
				autoCompleteBox.set_ItemsSource(searchResult.Result);
				autoCompleteBox.PopulateComplete();
			}, TaskScheduler.FromCurrentSynchronizationContext());
		}

		private void Cancelar_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.CancelarAlteracao();
		}

		private void ContentLoad()
		{
			this.SeguradoraGrid.SelectedIndex = 0;
			this.SeguradoraGrid.SelectionChanged += new SelectionChangedEventHandler(this.SeguradoraGrid_OnSelectionChanged);
			this.SeguradoraGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => {
			});
			this.NomeField.Visibility = (this.ViewModel.Apelido ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible);
			this.ApelidoField.Visibility = (!this.ViewModel.Apelido ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible);
		}

		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 ExcluirEndereco_OnClick(object sender, RoutedEventArgs e)
		{
			Button button = sender as Button;
			if (button == null)
			{
				return;
			}
			ListBox listBox = Extentions.FindVisualAncestor<ListBox>(button);
			SeguradoraEndereco item = (SeguradoraEndereco)listBox.Items[listBox.Items.IndexOf(button.DataContext)];
			this.ViewModel.ExcluirEndereco(item);
		}

		private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e)
		{
			Button button = sender as Button;
			if (button == null)
			{
				return;
			}
			ListBox listBox = Extentions.FindVisualAncestor<ListBox>(button);
			SeguradoraContato item = (SeguradoraContato)listBox.Items[listBox.Items.IndexOf(button.DataContext)];
			this.ViewModel.ExcluirTelefone(item);
		}

		private async void Impostos_OnClick(object sender, RoutedEventArgs e)
		{
			List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
			if (configuracoes.All<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() != 5))
			{
				await this.ViewModel.ShowMessage("RECURSO NÃO HABILITADO, ACESSE AS CONFIGURAÇÕES DENTRO DO CADASTRO DE EMPRESAS E FILIAIS PARA HABILITAR O RECURSO.", "OK", "", false);
			}
			else if (await this.ViewModel.VerificarPermissao(56, false))
			{
				this.ViewModel.ShowDrawer(new ImpostoDrawer(0, this.ViewModel.SelectedSeguradora.get_Id()), 0, false);
			}
		}

		private void Incluir_OnClick(object sender, RoutedEventArgs e)
		{
			IncluirSeguradoraView incluirSeguradoraView = new IncluirSeguradoraView(this.ViewModel.Seguradoras);
			(new HosterWindow(incluirSeguradoraView, "INCLUIR SEGURADORA", new double?((double)500), new double?((double)600), false)).ShowDialog();
			if (incluirSeguradoraView.ViewModel.AdicionarSeguradora != null)
			{
				this.ViewModel.Incluir(incluirSeguradoraView.ViewModel.AdicionarSeguradora);
			}
		}

		private void IncluirEndereco_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.IncluirEndereco();
			this.ValidarTela();
		}

		private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e)
		{
			this.ViewModel.IncluirTelefone();
			this.ValidarTela();
		}

		[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/seguradoraview.xaml", UriKind.Relative));
		}

		public async void Metas_Click(object sender, RoutedEventArgs e)
		{
			this.ViewModel.Loading(true);
			if (await this.ViewModel.VerificarPermissao(31, false))
			{
				this.ViewModel.ShowDrawer(new MetaSeguradoraView(this.ViewModel.SelectedSeguradora), 0, false);
				this.ViewModel.Loading(false);
			}
		}

		private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
		{
			ContentPresenter contentPresenter;
			DataTemplate contentTemplate;
			TextBox textBox = (TextBox)sender;
			string str = ValidationHelper.FormatPostCode(textBox.Text);
			if (ValidationHelper.ValidatePostCode(str))
			{
				ListBox listBox = Extentions.FindVisualAncestor<ListBox>(textBox);
				ListBoxItem listBoxItem = (ListBoxItem)listBox.ItemContainerGenerator.ContainerFromIndex(listBox.Items.IndexOf(textBox.DataContext));
				contentPresenter = FindVisualChild.Find<ContentPresenter>(listBoxItem);
				contentTemplate = contentPresenter.ContentTemplate;
				((TextBox)contentTemplate.FindName("CepBox", contentPresenter)).Text = str;
				EnderecoBase enderecoBase = await this.ViewModel.BuscaCep(str);
				if (enderecoBase != null)
				{
					TextBox endereco = (TextBox)contentTemplate.FindName("EnderecoBox", contentPresenter);
					TextBox cidade = (TextBox)contentTemplate.FindName("CidadeBox", contentPresenter);
					TextBox estado = (TextBox)contentTemplate.FindName("EstadoBox", contentPresenter);
					TextBox bairro = (TextBox)contentTemplate.FindName("BairroBox", contentPresenter);
					endereco.Text = enderecoBase.get_Endereco();
					cidade.Text = enderecoBase.get_Cidade();
					estado.Text = enderecoBase.get_Estado();
					bairro.Text = enderecoBase.get_Bairro();
				}
			}
			contentPresenter = null;
			contentTemplate = null;
		}

		private async void Salvar_OnClick(object sender, RoutedEventArgs e)
		{
			bool flag;
			this.ViewModel.Loading(true);
			this.ViewModel.SelectedSeguradora.set_NomeSocial(this.ViewModel.SelectedSeguradora.get_NomeSocialBanco().Trim());
			if ((this.ToleranciaComissaoBox.get_Number() > new decimal(2) || this.ToleranciaPremioBox.get_Number() > new decimal(2)) && (this.ViewModel.Tolerancia != this.ToleranciaComissaoBox.get_Number() || this.ViewModel.Tolerancia != this.ToleranciaPremioBox.get_Number()))
			{
				bool? nullable = await this.ViewModel.ShowSenha("TOLERÂNCIA DE COMISSÃO, DIFERENÇA IMPORTAÇÃO OU REPASSE MAIOR QUE R$2,00, PREENCHA A SENHA ADM PARA PROSSEGUIR.");
				if (!nullable.HasValue)
				{
					this.ViewModel.Loading(false);
					return;
				}
				else if (!nullable.GetValueOrDefault())
				{
					await this.ViewModel.ShowMessage("SENHA INVÁLIDA", "OK", "", false);
					this.ViewModel.Loading(false);
					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", "");
			}
		}

		private void SeguradoraGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			DataGrid dataGrid = (DataGrid)sender;
			if (dataGrid != null && dataGrid.SelectedIndex < 0)
			{
				return;
			}
			this.ViewModel.SelecionaSeguradora((Seguradora)((dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null)));
		}

		public void Selector_ContactChanged(object sender, SelectionChangedEventArgs e)
		{
			this.ViewModel.TipoTelefoneVisibility = System.Windows.Visibility.Visible;
			this.ViewModel.TelefoneVisibility = System.Windows.Visibility.Visible;
			this.ViewModel.PrefixoVisibility = System.Windows.Visibility.Visible;
		}

		[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, SeguradoraView.AutoCompleteBoxSeguradora_Populating));
					((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
					return;
				}
				case 2:
				{
					((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, SeguradoraView.AutoCompleteBoxSeguradora_Populating));
					((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
					return;
				}
				case 3:
				{
					this.SeguradoraGrid = (DataGrid)target;
					return;
				}
				case 4:
				{
					this.NomeField = (DataGridTextColumn)target;
					return;
				}
				case 5:
				{
					this.ApelidoField = (DataGridTextColumn)target;
					return;
				}
				case 6:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
					return;
				}
				case 7:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick);
					return;
				}
				case 8:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
					return;
				}
				case 9:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick);
					return;
				}
				case 10:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click);
					return;
				}
				case 11:
				{
					this.MaisOpcoesButton = (MenuItem)target;
					return;
				}
				case 12:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Metas_Click);
					return;
				}
				case 13:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.Impostos_OnClick);
					return;
				}
				case 14:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
					return;
				}
				case 15:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick);
					return;
				}
				case 16:
				{
					this.AtivoBox = (ToggleButton)target;
					return;
				}
				case 17:
				{
					this.DocumentoPrincipalBox = (TextBox)target;
					SeguradoraView seguradoraView = this;
					this.DocumentoPrincipalBox.PreviewTextInput += new TextCompositionEventHandler(seguradoraView.SomenteNumeros);
					this.DocumentoPrincipalBox.LostFocus += new RoutedEventHandler(this.DocumentoPrincipalBox_LostFocus);
					return;
				}
				case 18:
				{
					this.AssistenciaBox = (TextBox)target;
					return;
				}
				case 19:
				{
					this.SusepBox = (TextBox)target;
					return;
				}
				case 20:
				{
					this.CodigoCiaBox = (TextBox)target;
					return;
				}
				case 21:
				{
					this.LinkAppAndroidBox = (TextBox)target;
					return;
				}
				case 22:
				{
					this.LinkAppIosBox = (TextBox)target;
					return;
				}
				case 23:
				{
					this.ToleranciaComissaoBox = (CurrencyTextBox)target;
					return;
				}
				case 24:
				{
					this.ToleranciaPremioBox = (CurrencyTextBox)target;
					return;
				}
				case 25:
				{
					this.ObservacaoBox = (TextBox)target;
					return;
				}
				case 26:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTelefone_OnClick);
					return;
				}
				case 27:
				{
					this.ContatosListBox = (ListBox)target;
					return;
				}
				case 28:
				case 29:
				case 30:
				case 31:
				case 34:
				case 35:
				case 36:
				{
					this._contentLoaded = true;
					return;
				}
				case 32:
				{
					((MenuItem)target).Click += new RoutedEventHandler(this.IncluirEndereco_OnClick);
					return;
				}
				case 33:
				{
					this.EnderecoSeguradoraBox = (ListBox)target;
					return;
				}
				case 37:
				{
					((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, SeguradoraView.AutoCompleteBoxDescricao_Populating));
					((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBoxDescricao_OnTextChanged));
					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 28:
				{
					((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Selector_ContactChanged);
					return;
				}
				case 29:
				{
					SeguradoraView seguradoraView = this;
					((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(seguradoraView.SomenteNumeros);
					return;
				}
				case 30:
				{
					SeguradoraView seguradoraView1 = this;
					((TextBox)target).LostFocus += new RoutedEventHandler(seguradoraView1.FormatarTelefone);
					SeguradoraView seguradoraView2 = this;
					((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(seguradoraView2.SomenteNumeros);
					return;
				}
				case 31:
				{
					((Button)target).Click += new RoutedEventHandler(this.ExcluirTelefone_OnClick);
					return;
				}
				case 32:
				case 33:
				{
					return;
				}
				case 34:
				{
					((TextBox)target).LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus);
					SeguradoraView seguradoraView3 = this;
					((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(seguradoraView3.SomenteNumeros);
					return;
				}
				case 35:
				{
					SeguradoraView seguradoraView4 = this;
					((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(seguradoraView4.SomenteNumeros);
					return;
				}
				case 36:
				{
					((Button)target).Click += new RoutedEventHandler(this.ExcluirEndereco_OnClick);
					return;
				}
				default:
				{
					return;
				}
			}
		}

		private void ValidarTela()
		{
			object keyValuePairs;
			object obj;
			if (this.ViewModel.SelectedSeguradora == null)
			{
				return;
			}
			List<KeyValuePair<string, string>> keyValuePairs1 = this.ViewModel.SelectedSeguradora.Validate();
			List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
			SeguradoraContato seguradoraContato = this.ViewModel.Contatos.FirstOrDefault<SeguradoraContato>();
			if (seguradoraContato != null)
			{
				keyValuePairs = seguradoraContato.Validate();
			}
			else
			{
				keyValuePairs = null;
			}
			if (keyValuePairs == null)
			{
				keyValuePairs = new List<KeyValuePair<string, string>>();
			}
			keyValuePairs2.AddRange((IEnumerable<!0>)keyValuePairs);
			List<KeyValuePair<string, string>> keyValuePairs3 = keyValuePairs1;
			SeguradoraEndereco seguradoraEndereco = this.ViewModel.Enderecos.FirstOrDefault<SeguradoraEndereco>();
			if (seguradoraEndereco != null)
			{
				obj = seguradoraEndereco.Validate();
			}
			else
			{
				obj = null;
			}
			if (obj == null)
			{
				obj = new List<KeyValuePair<string, string>>();
			}
			keyValuePairs3.AddRange((IEnumerable<!0>)obj);
			this.ValidateFields(keyValuePairs1, false);
		}
	}
}