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
|
using System;
using System.CodeDom.Compiler;
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.Markup;
using System.Windows.Threading;
using Gestor.Application.Helpers;
using Gestor.Application.Servicos;
using Gestor.Application.Servicos.Seguros;
using Gestor.Application.ViewModels.Generic;
using Gestor.Model.Common;
using Gestor.Model.Domain.Generic;
namespace Gestor.Application.Drawers;
public class ObservacoesDrawer : UserControl, IComponentConnector
{
private readonly BaseSegurosViewModel _viewModel;
private readonly long _id;
private TipoTela _tipo;
private ApoliceServico _apoliceServico;
private ParcelaServico _parcelaServico;
private ClienteServico _clienteServico;
internal Grid GridMainObservacao;
internal TextBlock Observacaotxt;
internal TextBox ObservacaoBox;
private bool _contentLoaded;
public ObservacoesDrawer(long id, TipoTela tipo)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
_apoliceServico = new ApoliceServico();
_parcelaServico = new ParcelaServico();
_clienteServico = new ClienteServico();
_viewModel = new BaseSegurosViewModel();
((FrameworkElement)this).DataContext = _viewModel;
InitializeComponent();
_id = id;
_tipo = tipo;
double windowHeight = _viewModel.GetWindowHeight();
((FrameworkElement)GridMainObservacao).Height = windowHeight;
Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
if (dispatcher != null)
{
dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
}
}
private async void ContentLoad()
{
await LoadObservacao(_id, _tipo, salvar: false);
}
private async Task LoadObservacao(long id, TipoTela tipo, bool salvar)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
string observacao2 = $"{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {Funcoes.GetNetworkTime():g}{Environment.NewLine}{_viewModel.Anotacoes}{Environment.NewLine}{Environment.NewLine}{ObservacaoBox.Text}";
_viewModel.VerificarEnables(id);
switch (tipo - 1)
{
case 0:
{
Observacaotxt.Text = "OBSERVAÇÃO CLIENTE";
TextBox observacaoBox;
if (!salvar)
{
observacaoBox = ObservacaoBox;
observacaoBox.Text = (await _clienteServico.BuscarClienteAsync(id)).Observacao;
break;
}
observacaoBox = ObservacaoBox;
observacaoBox.Text = await _clienteServico.SalvarObservacoes(_id, observacao2);
if (_clienteServico.Sucesso)
{
ObservacaoBox.Text = observacao2;
}
break;
}
case 1:
Observacaotxt.Text = "OBSERVAÇÃO APÓLICE";
if (!salvar)
{
TextBox observacaoBox = ObservacaoBox;
observacaoBox.Text = (await _apoliceServico.BuscarApoliceAsync(id)).Observacao;
break;
}
observacao2 = await _apoliceServico.Save(_id, observacao2);
if (_apoliceServico.Sucesso)
{
ObservacaoBox.Text = observacao2;
}
break;
case 4:
{
Observacaotxt.Text = "OBSERVAÇÃO PARCELA";
TextBox observacaoBox;
if (!salvar)
{
observacaoBox = ObservacaoBox;
observacaoBox.Text = (await _parcelaServico.BuscarParcela(id)).Observacao;
break;
}
observacaoBox = ObservacaoBox;
observacaoBox.Text = await _parcelaServico.SalvarObservacoes(_id, observacao2);
if (_parcelaServico.Sucesso)
{
ObservacaoBox.Text = observacao2;
}
break;
}
case 2:
case 3:
break;
}
}
private void Alterar_OnClick(object sender, RoutedEventArgs e)
{
_viewModel.Alterar(alterar: true);
}
private async void Salvar_OnClick(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrWhiteSpace(_viewModel.Anotacoes))
{
await LoadObservacao(_id, _tipo, salvar: true);
_viewModel.Anotacoes = string.Empty;
_viewModel.Alterar(alterar: false);
}
}
private void Fechar_OnClick(object sender, RoutedEventArgs e)
{
_viewModel.CloseDrawer();
}
private void Cancelar_OnClick(object sender, RoutedEventArgs e)
{
_viewModel.Alterar(alterar: false);
_viewModel.Anotacoes = string.Empty;
}
private async void ObservacoesDrawer_OnLoaded(object sender, RoutedEventArgs e)
{
await _viewModel.PermissaoTela((TipoTela)2);
_viewModel.Alterar(alterar: false);
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent()
{
if (!_contentLoaded)
{
_contentLoaded = true;
Uri uri = new Uri("/Gestor.Application;component/drawers/observacoesdrawer.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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
switch (connectionId)
{
case 1:
((FrameworkElement)(ObservacoesDrawer)target).Loaded += new RoutedEventHandler(ObservacoesDrawer_OnLoaded);
break;
case 2:
GridMainObservacao = (Grid)target;
break;
case 3:
((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
break;
case 4:
Observacaotxt = (TextBlock)target;
break;
case 5:
((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
break;
case 6:
((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
break;
case 7:
((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
break;
case 8:
ObservacaoBox = (TextBox)target;
break;
default:
_contentLoaded = true;
break;
}
}
}
|