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.ViewModels.Relatorios/DialogPrintViewModel.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs new file mode 100644 index 0000000..859ee64 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Configuracoes; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels.Relatorios; + +public class DialogPrintViewModel : BaseViewModel +{ + private bool _carregando; + + private ConfiguracaoImpressao _configuracoes; + + private List<string> _tamanhos = new List<string> { "GRANDE", "MÉDIO", "PEQUENO" }; + + private bool _orientacaoImpressaoPortrait; + + private bool _orientacaoImpressaoLandscape; + + private string _tamanhoFonte = "PEQUENO"; + + private Relatorio _relatorio { get; set; } + + private Type _tipo { get; set; } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public ConfiguracaoImpressao Configuracoes + { + get + { + return _configuracoes; + } + set + { + _configuracoes = value; + OnPropertyChanged("Configuracoes"); + } + } + + public List<string> Tamanhos + { + get + { + return _tamanhos; + } + set + { + _tamanhos = value; + OnPropertyChanged("Tamanhos"); + } + } + + public bool OrientacaoImpressaoPortrait + { + get + { + return _orientacaoImpressaoPortrait; + } + set + { + _orientacaoImpressaoPortrait = value; + OnPropertyChanged("OrientacaoImpressaoPortrait"); + } + } + + public bool OrientacaoImpressaoLandscape + { + get + { + return _orientacaoImpressaoLandscape; + } + set + { + _orientacaoImpressaoLandscape = value; + OnPropertyChanged("OrientacaoImpressaoLandscape"); + } + } + + public bool OrientacaoImpressao { get; set; } + + public string TamanhoFonte + { + get + { + return _tamanhoFonte; + } + set + { + _tamanhoFonte = value; + if (!(value == "MÉDIO")) + { + if (!(value == "GRANDE")) + { + Configuracoes.TamanhoFonte = 7; + } + else + { + Configuracoes.TamanhoFonte = 5; + } + } + else + { + Configuracoes.TamanhoFonte = 6; + } + OnPropertyChanged("TamanhoFonte"); + } + } + + public DialogPrintViewModel(Relatorio relatorio, Type tipo) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + _relatorio = relatorio; + _tipo = tipo; + } + + public async Task Carregar() + { + List<ParametrosRelatorio> list = await new ConfuguracoesServico().BuscarParametros(_relatorio); + if (list == null || list.Count == 0) + { + list = ((IEnumerable<PropertyInfo>)_tipo.GetProperties(BindingFlags.Instance | BindingFlags.Public)).Select((Func<PropertyInfo, ParametrosRelatorio>)((PropertyInfo x) => new ParametrosRelatorio + { + Campo = x.Name, + Header = x.GetDescriptionAttribute(), + Tipo = x.GetTypeAttribute(), + Relatorio = _relatorio, + Width = 0, + Ordem = 0 + })).ToList(); + } + list.ForEach(delegate(ParametrosRelatorio x) + { + x.Selecionado = true; + }); + Configuracoes = new ConfiguracaoImpressao + { + TamanhoFonte = 7, + Campos = list, + OrientacaoImpressao = false + }; + } + + public void Selecionar() + { + if (Carregando) + { + return; + } + ConfiguracaoImpressao configuracoes = Configuracoes; + if (configuracoes != null) + { + configuracoes.Campos?.ForEach(delegate(ParametrosRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + } + } +} |