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
|
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
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 Gestor.Application.Componentes;
using Gestor.Application.Drawers;
using Gestor.Application.Helpers;
using Gestor.Application.Servicos;
using Gestor.Application.ViewModels;
using Gestor.Application.ViewModels.Seguros;
using Gestor.Application.ViewModels.Seguros.Itens;
using Gestor.Application.Views.Generic;
using Gestor.Common.Validation;
using Gestor.Model.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Domain.Seguros;
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 ContentControl ContentControl;
internal CustomItemValidation MaisInformacoes;
private bool _contentLoaded;
public ConsorcioView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false)
{
_menuItemViewModel = menuItemViewModel;
ViewModel = new ConsorcioViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao);
((FrameworkElement)this).DataContext = ViewModel;
InitializeComponent();
Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
if (dispatcher != null)
{
dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
}
if (lockInsert)
{
((UIElement)IncluirItemButton).IsEnabled = false;
((UIElement)SinistroButton).Visibility = (Visibility)2;
}
}
public async Task Selecionar(Item item)
{
await ViewModel.SelecionaItem(item);
}
public void Manter(ManutencaoItem manutencao)
{
ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao);
}
public void Substituir()
{
ViewModel.Substituir(ConsultaViewModel.ItemSelecionado);
}
private void ContentLoad()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked);
((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked);
}
private void Documento_OnChecked(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
RadioButton val = (RadioButton)sender;
if (!string.IsNullOrEmpty(val.GroupName))
{
ViewModel.Descarregar();
((UIElement)ContentControl).Visibility = (Visibility)2;
((UIElement)MaisInformacoes).Visibility = (Visibility)2;
((DependencyObject)(object)MaisInformacoes).ClearInvalid();
((DependencyObject)(object)ContentControl).ClearInvalid();
if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton"))
{
((UIElement)ContentControl).Visibility = (Visibility)0;
ViewModel.CarregaCobertura();
}
else
{
((UIElement)MaisInformacoes).Visibility = (Visibility)0;
}
}
}
private async void Incluir_OnClick(object sender, RoutedEventArgs e)
{
await ViewModel.Incluir();
List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate();
((DependencyObject)(object)this).ValidateFields(errorMessages);
}
private async void Excluir_OnClick(object sender, RoutedEventArgs e)
{
await ViewModel.Excluir();
_menuItemViewModel?.RecarregarItens(null);
}
private void Cancelar_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.CancelarAlteracao();
}
public async void Salvar_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.Loading(isLoading: true);
List<KeyValuePair<string, string>> list = await ViewModel.Salvar();
((DependencyObject)(object)this).ValidateFields(list);
bool num = list == null || list.Count == 0;
ViewModel.Loading(isLoading: false);
if (num)
{
if (((DomainBase)ViewModel.SelectedItem).Id > 0)
{
_menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem);
}
}
else
{
await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
}
}
private void Alterar_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.Alterar(alterar: true);
}
private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
{
if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar)
{
await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + ".");
return;
}
FiltroArquivoDigital filtro = new FiltroArquivoDigital
{
Id = ((DomainBase)ViewModel.SelectedItem).Id,
IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id,
Tipo = (TipoArquivoDigital)4,
Parente = ViewModel.SelectedItem
};
ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
}
private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id);
}
private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id);
}
private void MenuItem_OnClick(object sender, RoutedEventArgs e)
{
((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog();
_menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem);
}
private void CopyCodItem(object sender, MouseButtonEventArgs e)
{
ViewModel.CodigoItem.CopyToClipboard();
ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem);
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent()
{
if (!_contentLoaded)
{
_contentLoaded = true;
Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/consorcioview.xaml", UriKind.Relative);
Application.LoadComponent((object)this, uri);
}
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
internal Delegate _CreateDelegate(Type delegateType, string handler)
{
return Delegate.CreateDelegate(delegateType, this, handler);
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
[EditorBrowsable(EditorBrowsableState.Never)]
void IComponentConnector.Connect(int connectionId, object target)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Expected O, but got Unknown
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
switch (connectionId)
{
case 1:
IncluirItemButton = (MenuItem)target;
IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick);
break;
case 2:
((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
break;
case 3:
((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
break;
case 4:
((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
break;
case 5:
((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
break;
case 6:
((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem);
break;
case 7:
((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click);
break;
case 8:
SinistroButton = (MenuItem)target;
SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick);
break;
case 9:
((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
break;
case 10:
((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick);
break;
case 11:
CoberturasRadioButton = (RadioButton)target;
break;
case 12:
MaisInformacoesRadioButton = (RadioButton)target;
break;
case 13:
ContentControl = (ContentControl)target;
break;
case 14:
MaisInformacoes = (CustomItemValidation)target;
break;
default:
_contentLoaded = true;
break;
}
}
}
|