summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs432
1 files changed, 432 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs
new file mode 100644
index 0000000..bd3728d
--- /dev/null
+++ b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs
@@ -0,0 +1,432 @@
+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 Gestor.Application.Drawers;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Financeiro;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Financeiro;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Views.Financeiro;
+
+public class FornecedorView : BaseUserControl, IComponentConnector
+{
+ internal DataGrid FornecedorGrid;
+
+ internal TextBox NomeBox;
+
+ internal TextBox DocumentoPrincipalBox;
+
+ internal ToggleButton AtivoBox;
+
+ internal TextBox CepBox;
+
+ internal ProgressBar ProgressCep;
+
+ internal TextBox EnderecoBox;
+
+ internal TextBox BairroBox;
+
+ internal TextBox CidadeBox;
+
+ internal TextBox EstadoBox;
+
+ internal ComboBox PlanoBox;
+
+ internal ComboBox CentroBox;
+
+ internal ComboBox ContaBox;
+
+ internal ComboBox TipoPagamentoBox;
+
+ private bool _contentLoaded;
+
+ public FornecedorViewModel ViewModel { get; set; }
+
+ public FornecedorView()
+ {
+ ((FrameworkElement)this).Tag = "CADASTRO DE FORNECEDORES";
+ ViewModel = new FornecedorViewModel();
+ ((FrameworkElement)this).DataContext = ViewModel;
+ InitializeComponent();
+ }
+
+ private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e)
+ {
+ if (e.Parameter.Length < 3)
+ {
+ return;
+ }
+ e.Cancel = true;
+ ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> 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.FiltrarFornecedor("");
+ }
+ }
+
+ private void Incluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Incluir();
+ }
+
+ private void ScrollToItem()
+ {
+ if (((Selector)FornecedorGrid).SelectedItem != null)
+ {
+ ((UIElement)FornecedorGrid).UpdateLayout();
+ FornecedorGrid.ScrollIntoView(((Selector)FornecedorGrid).SelectedItem);
+ }
+ }
+
+ private void Alterar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Alterar(alterar: true);
+ ((DomainBase)ViewModel.SelectedFornecedor).Initialize();
+ }
+
+ 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)
+ {
+ ScrollToItem();
+ }
+ else
+ {
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ }
+
+ private void Cancelar_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.CancelProduto = (Fornecedor)((DomainBase)ViewModel.SelectedFornecedor).Clone();
+ ViewModel.CancelarAlteracao();
+ ScrollToItem();
+ }
+
+ private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ await ViewModel.Delete();
+ ScrollToItem();
+ }
+
+ private void DocumentoPrincipalBox_OnLostFocus(object sender, RoutedEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ TextBox val = (TextBox)sender;
+ val.Text = ValidationHelper.FormatDocument(val.Text);
+ }
+
+ private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
+ {
+ if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)10).Consultar)
+ {
+ await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)10) + ".");
+ return;
+ }
+ FiltroArquivoDigital filtro = new FiltroArquivoDigital
+ {
+ Id = ViewModel.SelectedFornecedor.Id,
+ Tipo = (TipoArquivoDigital)10,
+ Parente = ViewModel.SelectedFornecedor
+ };
+ ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
+ }
+
+ private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
+ {
+ TextBox val = (TextBox)sender;
+ if (string.IsNullOrWhiteSpace(val.Text))
+ {
+ return;
+ }
+ string text = ValidationHelper.FormatPostCode(val.Text);
+ if (ValidationHelper.ValidatePostCode(text))
+ {
+ CepBox.Text = text;
+ EnderecoBase val2 = await ViewModel.BuscaCep(text);
+ if (val2 != null)
+ {
+ EnderecoBox.Text = val2.Endereco;
+ CidadeBox.Text = val2.Cidade;
+ EstadoBox.Text = val2.Estado;
+ BairroBox.Text = val2.Bairro;
+ }
+ }
+ }
+
+ private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLog((TipoTela)24, ViewModel.SelectedFornecedor.Id);
+ }
+
+ private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLogEmail((TipoTela)24, ViewModel.SelectedFornecedor.Id);
+ }
+
+ private async void CopiarDados_OnClick(object sender, RoutedEventArgs e)
+ {
+ Cliente cliente = await ViewModel.ShowCopiarCliente();
+ if (cliente != null)
+ {
+ ViewModel.Incluir();
+ Cliente val = cliente;
+ val.Enderecos = await new ClienteServico().BuscarEnderecosAsync(((DomainBase)cliente).Id);
+ val = cliente;
+ val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)cliente).Id);
+ val = cliente;
+ val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)cliente).Id);
+ ViewModel.Copiar(cliente);
+ }
+ }
+
+ private void Excel_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Excel();
+ }
+
+ private void Imprimir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Imprimir();
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/views/financeiro/fornecedorview.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_007e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_008a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0094: Expected O, but got Unknown
+ //IL_0095: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ab: Expected O, but got Unknown
+ //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c3: Expected O, but got Unknown
+ //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00db: Expected O, but got Unknown
+ //IL_00de: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e8: Expected O, but got Unknown
+ //IL_00ea: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0100: Expected O, but got Unknown
+ //IL_0102: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0118: Expected O, but got Unknown
+ //IL_011a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0126: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0130: Expected O, but got Unknown
+ //IL_0132: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0148: Expected O, but got Unknown
+ //IL_014a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0156: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0160: Expected O, but got Unknown
+ //IL_0162: Unknown result type (might be due to invalid IL or missing references)
+ //IL_016e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0178: Expected O, but got Unknown
+ //IL_017a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0186: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0190: Expected O, but got Unknown
+ //IL_0192: Unknown result type (might be due to invalid IL or missing references)
+ //IL_019e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01a8: Expected O, but got Unknown
+ //IL_01aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01b6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01c0: Expected O, but got Unknown
+ //IL_01c3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01cd: Expected O, but got Unknown
+ //IL_01d0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01da: Expected O, but got Unknown
+ //IL_01e8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01f2: Expected O, but got Unknown
+ //IL_01ff: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0209: Expected O, but got Unknown
+ //IL_020c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0216: Expected O, but got Unknown
+ //IL_0219: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0223: Expected O, but got Unknown
+ //IL_0230: Unknown result type (might be due to invalid IL or missing references)
+ //IL_023a: Expected O, but got Unknown
+ //IL_0248: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0252: Expected O, but got Unknown
+ //IL_0255: Unknown result type (might be due to invalid IL or missing references)
+ //IL_025f: Expected O, but got Unknown
+ //IL_0262: Unknown result type (might be due to invalid IL or missing references)
+ //IL_026c: Expected O, but got Unknown
+ //IL_026f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0279: Expected O, but got Unknown
+ //IL_027c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0286: Expected O, but got Unknown
+ //IL_0289: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0293: Expected O, but got Unknown
+ //IL_0295: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02a2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02ac: Expected O, but got Unknown
+ //IL_02ae: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02bb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02c5: Expected O, but got Unknown
+ //IL_02c8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02d2: Expected O, but got Unknown
+ //IL_02d5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02df: Expected O, but got Unknown
+ //IL_02e2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02ec: Expected O, but got Unknown
+ //IL_02ef: Unknown result type (might be due to invalid IL or missing references)
+ //IL_02f9: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 1:
+ ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteFornecedor_OnPopulating);
+ ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+ break;
+ case 2:
+ ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick);
+ break;
+ case 3:
+ ((MenuItem)target).Click += new RoutedEventHandler(Excel_OnClick);
+ break;
+ case 4:
+ FornecedorGrid = (DataGrid)target;
+ break;
+ case 5:
+ ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+ break;
+ case 6:
+ ((MenuItem)target).Click += new RoutedEventHandler(CopiarDados_OnClick);
+ break;
+ case 7:
+ ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+ break;
+ case 8:
+ ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+ break;
+ case 9:
+ ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+ break;
+ case 10:
+ ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+ break;
+ case 11:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click);
+ break;
+ case 12:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+ break;
+ case 13:
+ ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick);
+ break;
+ case 14:
+ NomeBox = (TextBox)target;
+ break;
+ case 15:
+ DocumentoPrincipalBox = (TextBox)target;
+ ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_OnLostFocus);
+ break;
+ case 16:
+ AtivoBox = (ToggleButton)target;
+ break;
+ case 17:
+ CepBox = (TextBox)target;
+ ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus);
+ ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+ break;
+ case 18:
+ ProgressCep = (ProgressBar)target;
+ break;
+ case 19:
+ EnderecoBox = (TextBox)target;
+ break;
+ case 20:
+ BairroBox = (TextBox)target;
+ break;
+ case 21:
+ CidadeBox = (TextBox)target;
+ break;
+ case 22:
+ EstadoBox = (TextBox)target;
+ break;
+ case 23:
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ break;
+ case 24:
+ ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+ break;
+ case 25:
+ PlanoBox = (ComboBox)target;
+ break;
+ case 26:
+ CentroBox = (ComboBox)target;
+ break;
+ case 27:
+ ContaBox = (ComboBox)target;
+ break;
+ case 28:
+ TipoPagamentoBox = (ComboBox)target;
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}