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
|
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 System.Windows.Threading;
using Gestor.Application.Componentes;
using Gestor.Application.Drawers;
using Gestor.Application.Drawers.Configuracoes;
using Gestor.Application.Helpers;
using Gestor.Application.Servicos;
using Gestor.Application.ViewModels.Ferramentas;
using Gestor.Application.Views.Generic;
using Gestor.Common.Validation;
using Gestor.Model.Common;
using Gestor.Model.Domain.Common;
using Gestor.Model.Domain.Generic;
namespace Gestor.Application.Views.Ferramentas;
public class EmpresaView : BaseUserControl, IComponentConnector
{
[Serializable]
[CompilerGenerated]
private sealed class _003C_003Ec
{
public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec();
public static MouseButtonEventHandler _003C_003E9__5_0;
internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args)
{
}
}
internal DataGrid EmpresaGrid;
internal MenuItem Alterar;
internal TextBox DocumentoPrincipalBox;
internal TextBox NomeBox;
internal TextBox CepBox;
internal TextBox EnderecoBox;
internal TextBox BairroBox;
internal TextBox CidadeBox;
internal TextBox EstadoBox;
internal CustomPasswordBox SenhaBox;
private bool _contentLoaded;
public EmpresaViewModel ViewModel { get; set; }
public EmpresaView()
{
((FrameworkElement)this).Tag = "CADASTRO DE EMPRESA E FILIAIS";
ViewModel = new EmpresaViewModel();
((FrameworkElement)this).DataContext = ViewModel;
InitializeComponent();
Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
if (dispatcher != null)
{
dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
}
}
private void ContentLoad()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
((Selector)EmpresaGrid).SelectedIndex = 0;
((Selector)EmpresaGrid).SelectionChanged += new SelectionChangedEventHandler(EmpresaGrid_OnSelectionChanged);
DataGrid empresaGrid = EmpresaGrid;
object obj = _003C_003Ec._003C_003E9__5_0;
if (obj == null)
{
MouseButtonEventHandler val = delegate
{
};
_003C_003Ec._003C_003E9__5_0 = val;
obj = (object)val;
}
((Control)empresaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj;
if (((DomainBase)Recursos.Usuario).Id == 0L)
{
((UIElement)Alterar).IsEnabled = true;
}
}
private void Cancelar_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.CancelarAlteracao();
if (((DomainBase)Recursos.Usuario).Id == 0L)
{
((UIElement)Alterar).IsEnabled = true;
}
((TextBoxBase)NomeBox).IsReadOnly = true;
((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true;
ViewModel.PassWordReadOnly = ViewModel.EnableFields;
ViewModel.ConfirmacaoSenha = (Visibility)2;
}
private 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);
ViewModel.PassWordReadOnly = ViewModel.EnableFields;
ViewModel.ConfirmacaoSenha = (Visibility)((list == null || list.Count <= 0) ? 2 : 0);
if (((DomainBase)Recursos.Usuario).Id == 0L)
{
((UIElement)Alterar).IsEnabled = true;
((TextBoxBase)NomeBox).IsReadOnly = true;
((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true;
}
if (!num)
{
await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
}
}
private void Alterar_OnClick(object sender, RoutedEventArgs e)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
ViewModel.CancelEmpresa = (Empresa)((DomainBase)ViewModel.SelectedEmpresa).Clone();
ViewModel.Alterar(alterar: true);
PermissaoAuteracao();
ViewModel.PassWordReadOnly = ViewModel.EnableFields;
ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0);
}
public void PermissaoAuteracao()
{
if (((DomainBase)Recursos.Usuario).Id != 0L)
{
((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true;
((TextBoxBase)NomeBox).IsReadOnly = true;
return;
}
ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0);
ViewModel.PassWordReadOnly = true;
((UIElement)Alterar).IsEnabled = false;
((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = false;
((TextBoxBase)NomeBox).IsReadOnly = false;
}
private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
{
if (!ViewModel.EnableFields)
{
return;
}
string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text);
CepBox.Text = text;
if (ValidationHelper.ValidatePostCode(text))
{
EnderecoBase val = await ViewModel.BuscaCep(text);
if (val != null)
{
EnderecoBox.Text = val.Endereco;
CidadeBox.Text = val.Cidade;
EstadoBox.Text = val.Estado;
BairroBox.Text = val.Bairro;
}
}
}
private void AutoCompleteBoxEmpresa_Populating(object sender, PopulatingEventArgs e)
{
e.Cancel = true;
ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Empresa>> searchResult)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (searchResult.Result != null)
{
AutoCompleteBox val = (AutoCompleteBox)sender;
val.ItemsSource = searchResult.Result;
val.PopulateComplete();
}
}, TaskScheduler.FromCurrentSynchronizationContext());
}
private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text))
{
ViewModel.FiltrarEmpresa("");
}
}
private void EmpresaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
DataGrid val = (DataGrid)sender;
if (val == null || ((Selector)val).SelectedIndex >= 0)
{
ViewModel.SelecionaEmpresa((Empresa)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null));
}
}
private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
{
if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)13).Consultar)
{
await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)13) + ".");
return;
}
FiltroArquivoDigital filtro = new FiltroArquivoDigital
{
Id = ((DomainBase)ViewModel.SelectedEmpresa).Id,
Tipo = (TipoArquivoDigital)13,
Parente = ViewModel.SelectedEmpresa
};
ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
}
private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.AbrirLog((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id);
}
private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.AbrirLogEmail((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id);
}
private async void Configuracoes_OnClick(object sender, RoutedEventArgs e)
{
if (await ViewModel.VerificarRestricao((TipoRestricao)64))
{
ViewModel.ShowDrawer(new ConfiguracoesDrawer(), 0, close: false);
}
}
private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (!((TextBoxBase)(TextBox)sender).IsReadOnly)
{
string text = DocumentoPrincipalBox.Text.Clear();
if (!string.IsNullOrEmpty(text))
{
DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14)));
}
}
}
private async void AnexarLogo_OnClick(object sender, RoutedEventArgs e)
{
ViewModel.Loading(isLoading: true);
await ViewModel.AnexarLogo();
ViewModel.Loading(isLoading: false);
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent()
{
if (!_contentLoaded)
{
_contentLoaded = true;
Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/empresaview.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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Expected O, but got Unknown
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Expected O, but got Unknown
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Expected O, but got Unknown
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Expected O, but got Unknown
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Expected O, but got Unknown
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Expected O, but got Unknown
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Expected O, but got Unknown
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Expected O, but got Unknown
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Expected O, but got Unknown
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Expected O, but got Unknown
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Expected O, but got Unknown
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Expected O, but got Unknown
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Expected O, but got Unknown
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Expected O, but got Unknown
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Expected O, but got Unknown
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Expected O, but got Unknown
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Expected O, but got Unknown
switch (connectionId)
{
case 1:
((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxEmpresa_Populating);
((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
break;
case 2:
EmpresaGrid = (DataGrid)target;
break;
case 3:
Alterar = (MenuItem)target;
Alterar.Click += new RoutedEventHandler(Alterar_OnClick);
break;
case 4:
((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
break;
case 5:
((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
break;
case 6:
((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click);
break;
case 7:
((MenuItem)target).Click += new RoutedEventHandler(AnexarLogo_OnClick);
break;
case 8:
((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
break;
case 9:
((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick);
break;
case 10:
((MenuItem)target).Click += new RoutedEventHandler(Configuracoes_OnClick);
break;
case 11:
DocumentoPrincipalBox = (TextBox)target;
((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus);
((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 12:
NomeBox = (TextBox)target;
break;
case 13:
CepBox = (TextBox)target;
((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus);
((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 14:
EnderecoBox = (TextBox)target;
break;
case 15:
BairroBox = (TextBox)target;
break;
case 16:
CidadeBox = (TextBox)target;
break;
case 17:
EstadoBox = (TextBox)target;
break;
case 18:
SenhaBox = (CustomPasswordBox)target;
break;
case 19:
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 20:
((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 21:
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 22:
((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 23:
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
case 24:
((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
break;
default:
_contentLoaded = true;
break;
}
}
}
|