using Gestor.Application.ViewModels.Drawer; using Gestor.Application.ViewModels.Generic; using Gestor.Application.Views.Generic; using Gestor.Model.Common; using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; using Gestor.Model.Domain.Seguros; using MaterialDesignThemes.Wpf; 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; namespace Gestor.Application.Drawers { public class ExtratosDrawer : BaseUserControl, IComponentConnector { internal System.Windows.Controls.ProgressBar ProgressBar; internal StackPanel Tipo; internal StackPanel Cliente; internal ToggleButton ClienteToggle; internal StackPanel Documento; internal StackPanel Endosso; internal StackPanel Item; internal StackPanel Perfil; internal MaterialDesignThemes.Wpf.Snackbar Snackbar; private bool _contentLoaded; private static List Clientes { get; set; } private static List Documentos { get; set; } private static List Prospeccoes { get; set; } private static List Selecionados { get; set; } private static List SelecionadosPros { get; set; } private static Relatorio? TipoRelatorio { get; set; } public ExtratosViewModel ViewModel { get; set; } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] internal Delegate _CreateDelegate(Type delegateType, string handler) { return Delegate.CreateDelegate(delegateType, this, handler); } public ExtratosDrawer(List clientes = null, List documentos = null, Relatorio? tipoRelatorio = null, List selecionados = null, List selecionadosPros = null, List prospeccaos = null) { ExtratosDrawer.Documentos = documentos; ExtratosDrawer.Prospeccoes = prospeccaos; ExtratosDrawer.Selecionados = selecionados; ExtratosDrawer.Clientes = clientes; ExtratosDrawer.TipoRelatorio = tipoRelatorio; ExtratosDrawer.SelecionadosPros = selecionadosPros; this.ViewModel = new ExtratosViewModel() { TipoDeRelatorio = tipoRelatorio }; if (!tipoRelatorio.HasValue) { this.ViewModel.TipoExtratoEnabled = true; this.ViewModel.ClientePorPaginaVisibility = System.Windows.Visibility.Collapsed; } else { switch (tipoRelatorio.GetValueOrDefault()) { case 0: { this.ViewModel.TipoExtratoEnabled = false; this.ViewModel.SelectedTipoExtrato = 0; this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; break; } case 1: case 3: { this.ViewModel.SelectedTipoExtrato = 1; this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; break; } case 2: case 4: { this.ViewModel.TipoExtratoEnabled = false; this.ViewModel.SelectedTipoExtrato = 1; this.ViewModel.ClientePorPaginaVisibility = System.Windows.Visibility.Visible; this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; break; } default: { goto case 3; } } } if (this.ViewModel.SelectedTipoExtrato == null) { this.ViewModel.EsconderResumido = true; this.ViewModel.ClienteVisibility = true; } base.DataContext = this.ViewModel; this.InitializeComponent(); } private void Fechar_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.CloseDrawer(); } private async void Gerar_OnClick(object sender, RoutedEventArgs e) { if (ExtratosDrawer.Clientes != null) { await this.ViewModel.PrepararExtrato(ExtratosDrawer.Clientes, null, null, ExtratosDrawer.TipoRelatorio, null, null, false); } else if (ExtratosDrawer.Documentos != null || ExtratosDrawer.Prospeccoes != null) { await this.ViewModel.PrepararExtrato(null, ExtratosDrawer.Documentos, ExtratosDrawer.Prospeccoes, ExtratosDrawer.TipoRelatorio, ExtratosDrawer.Selecionados, ExtratosDrawer.SelecionadosPros, false); } } private async void GerarPDF_OnClick(object sender, RoutedEventArgs e) { if (ExtratosDrawer.Clientes != null) { await this.ViewModel.PrepararExtrato(ExtratosDrawer.Clientes, null, null, ExtratosDrawer.TipoRelatorio, null, null, true); } else if (ExtratosDrawer.Documentos != null || ExtratosDrawer.Prospeccoes != null) { await this.ViewModel.PrepararExtrato(null, ExtratosDrawer.Documentos, ExtratosDrawer.Prospeccoes, ExtratosDrawer.TipoRelatorio, ExtratosDrawer.Selecionados, ExtratosDrawer.SelecionadosPros, true); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (this._contentLoaded) { return; } this._contentLoaded = true; System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/drawers/extratosdrawer.xaml", UriKind.Relative)); } private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) { this.Snackbar.set_IsActive(false); } [DebuggerNonUserCode] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: { ((ScrollViewer)target).PreviewMouseWheel += new MouseWheelEventHandler(this.ScrollViewer_PreviewMouseWheel); return; } case 2: { this.ProgressBar = (System.Windows.Controls.ProgressBar)target; return; } case 3: { ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); return; } case 4: { this.Tipo = (StackPanel)target; return; } case 5: { this.Cliente = (StackPanel)target; return; } case 6: { this.ClienteToggle = (ToggleButton)target; return; } case 7: { this.Documento = (StackPanel)target; return; } case 8: { this.Endosso = (StackPanel)target; return; } case 9: { this.Item = (StackPanel)target; return; } case 10: { this.Perfil = (StackPanel)target; return; } case 11: { ((MenuItem)target).Click += new RoutedEventHandler(this.Gerar_OnClick); return; } case 12: { ((MenuItem)target).Click += new RoutedEventHandler(this.GerarPDF_OnClick); return; } case 13: { this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; return; } case 14: { ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); return; } } this._contentLoaded = true; } } }