summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Ferramentas/TipoVendedorView.cs
blob: 6bb42d7d56dc04703f821dc02c72a7e40427c1a0 (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
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.Helpers;
using Gestor.Application.ViewModels.Ferramentas;
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.Ferramentas;

public class TipoVendedorView : BaseUserControl, IComponentConnector
{
	[Serializable]
	[CompilerGenerated]
	private sealed class _003C_003Ec
	{
		public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec();

		public static MouseButtonEventHandler _003C_003E9__2_0;

		internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args)
		{
		}
	}

	public TipoVendedorViewModel ViewModel;

	internal DataGrid TipoVendedorGrid;

	internal MenuItem MaisOpcoesButton;

	internal ToggleButton AtivoBox;

	private bool _contentLoaded;

	public TipoVendedorView()
	{
		((FrameworkElement)this).Tag = "CADASTRO DE TIPO DE VENDEDOR";
		ViewModel = new TipoVendedorViewModel();
		((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)TipoVendedorGrid).SelectedIndex = 0;
		((Selector)TipoVendedorGrid).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorGrid_OnSelectionChanged);
		DataGrid tipoVendedorGrid = TipoVendedorGrid;
		object obj = _003C_003Ec._003C_003E9__2_0;
		if (obj == null)
		{
			MouseButtonEventHandler val = delegate
			{
			};
			_003C_003Ec._003C_003E9__2_0 = val;
			obj = (object)val;
		}
		((Control)tipoVendedorGrid).MouseDoubleClick += (MouseButtonEventHandler)obj;
	}

	private void Incluir_OnClick(object sender, RoutedEventArgs e)
	{
		ViewModel.Incluir();
		ValidarTela();
	}

	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);
		if (!num)
		{
			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
		}
	}

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

	private void Excluir_OnClick(object sender, RoutedEventArgs e)
	{
		ViewModel.Excluir();
	}

	private void AutoCompleteBoxTipoVendedor_Populating(object sender, PopulatingEventArgs e)
	{
		e.Cancel = true;
		ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<TipoVendedor>> 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.FiltrarTipoVendedor("");
		}
	}

	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.CancelTipoVendedor = (TipoVendedor)((DomainBase)ViewModel.SelectedTipoVendedor).Clone();
		ViewModel.Alterar(alterar: true);
		ValidarTela();
		((DomainBase)ViewModel.SelectedTipoVendedor).Initialize();
	}

	private void TipoVendedorGrid_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.SelecionaTipoVendedor((TipoVendedor)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null));
		}
	}

	private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
	{
		ViewModel.AbrirLog((TipoTela)14, ((DomainBase)ViewModel.SelectedTipoVendedor).Id);
	}

	private void ValidarTela()
	{
		if (ViewModel.SelectedTipoVendedor != null)
		{
			List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedTipoVendedor.Validate();
			((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false);
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	public void InitializeComponent()
	{
		if (!_contentLoaded)
		{
			_contentLoaded = true;
			Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/tipovendedorview.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_0036: 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_004c: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Expected O, but got Unknown
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Expected O, but got Unknown
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Expected O, but got Unknown
		switch (connectionId)
		{
		case 1:
			((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxTipoVendedor_Populating);
			((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
			break;
		case 2:
			TipoVendedorGrid = (DataGrid)target;
			break;
		case 3:
			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
			break;
		case 4:
			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
			break;
		case 5:
			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
			break;
		case 6:
			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
			break;
		case 7:
			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
			break;
		case 8:
			MaisOpcoesButton = (MenuItem)target;
			break;
		case 9:
			((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
			break;
		case 10:
			AtivoBox = (ToggleButton)target;
			break;
		default:
			_contentLoaded = true;
			break;
		}
	}
}