summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 15:29:41 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 15:29:41 +0000
commit225aa1499e37faf9d38257caabbadc68d78b427e (patch)
tree102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
parent1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff)
downloadgestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz
gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs')
-rw-r--r--Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs239
1 files changed, 239 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs b/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
new file mode 100644
index 0000000..20e17db
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
@@ -0,0 +1,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;
+ }
+ }
+}