diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Views.BI/NotasView.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Views.BI/NotasView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views.BI/NotasView.cs | 275 |
1 files changed, 275 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.BI/NotasView.cs b/Decompiler/Gestor.Application.Views.BI/NotasView.cs new file mode 100644 index 0000000..788cf19 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/NotasView.cs @@ -0,0 +1,275 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +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.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.BI; +using Gestor.Application.Views.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.BI; + +public class NotasView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal ProgressBar ProgressRing; + + private bool _contentLoaded; + + public NotasViewModel ViewModel { get; set; } + + public NotasView() + { + ViewModel = new NotasViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private static object GetDataFromListBox(ItemsControl source, Point point) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + IInputElement obj = ((UIElement)source).InputHitTest(point); + UIElement val = (UIElement)(object)((obj is UIElement) ? obj : null); + if (val == null) + { + return null; + } + object obj2 = DependencyProperty.UnsetValue; + while (obj2 == DependencyProperty.UnsetValue) + { + if (val != null) + { + obj2 = source.ItemContainerGenerator.ItemFromContainer((DependencyObject)(object)val); + if (obj2 == DependencyProperty.UnsetValue) + { + DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)val); + val = (UIElement)(object)((parent is UIElement) ? parent : null); + } + if (val == source) + { + return null; + } + } + } + if (obj2 == DependencyProperty.UnsetValue) + { + return null; + } + return obj2; + } + + private async void AdicionarNota_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.AdicionarNota(); + } + + private async void ListBox_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + ListBox val = (ListBox)sender; + object dataFromListBox = GetDataFromListBox((ItemsControl)(object)val, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val)); + if (dataFromListBox != null) + { + Tarefa val2 = new Tarefa(); + DomainBase.Copy<Tarefa, Tarefa>(val2, (Tarefa)dataFromListBox); + val2.UsuariosVinculados = val2.Responsaveis?.Select((ResponsavelTarefa x) => x.Usuario).ToList(); + await AbrirNota(val2, (int)val2.Entidade == 1, (int)val2.Entidade == 1); + } + } + + private async Task AbrirNota(Tarefa data, bool notaBool = false, bool agendamento = false) + { + while (true) + { + Tarefa nota = await ViewModel.ShowTarefaDialog(data, notaBool, agendamento); + if (nota == null) + { + return; + } + if (nota.Usuario == null) + { + nota.Usuario = nota.UsuariosVinculados.FirstOrDefault(); + } + List<ResponsavelTarefa> responsaveis = ((IEnumerable<Usuario>)nota.UsuariosVinculados).Select((Func<Usuario, ResponsavelTarefa>)((Usuario x) => new ResponsavelTarefa + { + IdTarefa = ((DomainBase)nota).Id, + Usuario = x + })).ToList(); + nota.Responsaveis = responsaveis; + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(nota); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO."); + await ViewModel.CarregarNotas(); + } + + private async void NotaConcluida_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + val.Conclusao = Funcoes.GetNetworkTime(); + val.Status = (StatusTarefa)2; + await ViewModel.SalvarNota(val); + await ViewModel.CarregarNotas(); + } + } + + private void ToggleNotasConcluidas_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ToggleNotasConcluidas(); + } + + private async void ExcluirNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + await ViewModel.ExcluirNota(val); + await ViewModel.CarregarNotas(); + } + } + + private async void SarvarNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO."); + } + else + { + await ViewModel.CarregarNotas(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/notasview.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_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressRing = (ProgressBar)target; + break; + case 2: + ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarNota_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ToggleNotasConcluidas_OnClick); + break; + case 8: + ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //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 + switch (connectionId) + { + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirNota_OnClick); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(NotaConcluida_OnClick); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SarvarNota_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirNota_OnClick); + break; + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SarvarNota_OnClick); + break; + case 6: + case 7: + case 8: + break; + } + } +} |