summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs193
1 files changed, 0 insertions, 193 deletions
diff --git a/Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs b/Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs
deleted file mode 100644
index 537bed2..0000000
--- a/Gestor.Application/ViewModels/Relatorios/DialogPrintViewModel.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Configuracoes;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Relatorios;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-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 this._carregando;
- }
- set
- {
- this._carregando = value;
- base.OnPropertyChanged("Carregando");
- }
- }
-
- public ConfiguracaoImpressao Configuracoes
- {
- get
- {
- return this._configuracoes;
- }
- set
- {
- this._configuracoes = value;
- base.OnPropertyChanged("Configuracoes");
- }
- }
-
- public bool OrientacaoImpressao
- {
- get;
- set;
- }
-
- public bool OrientacaoImpressaoLandscape
- {
- get
- {
- return this._orientacaoImpressaoLandscape;
- }
- set
- {
- this._orientacaoImpressaoLandscape = value;
- base.OnPropertyChanged("OrientacaoImpressaoLandscape");
- }
- }
-
- public bool OrientacaoImpressaoPortrait
- {
- get
- {
- return this._orientacaoImpressaoPortrait;
- }
- set
- {
- this._orientacaoImpressaoPortrait = value;
- base.OnPropertyChanged("OrientacaoImpressaoPortrait");
- }
- }
-
- public string TamanhoFonte
- {
- get
- {
- return this._tamanhoFonte;
- }
- set
- {
- this._tamanhoFonte = value;
- if (value == "MÉDIO")
- {
- this.Configuracoes.set_TamanhoFonte(6);
- }
- else if (value == "GRANDE")
- {
- this.Configuracoes.set_TamanhoFonte(5);
- }
- else
- {
- this.Configuracoes.set_TamanhoFonte(7);
- }
- base.OnPropertyChanged("TamanhoFonte");
- }
- }
-
- public List<string> Tamanhos
- {
- get
- {
- return this._tamanhos;
- }
- set
- {
- this._tamanhos = value;
- base.OnPropertyChanged("Tamanhos");
- }
- }
-
- public DialogPrintViewModel(Relatorio relatorio, Type tipo)
- {
- this._relatorio = relatorio;
- this._tipo = tipo;
- }
-
- public async Task Carregar()
- {
- List<ParametrosRelatorio> list = await (new ConfuguracoesServico()).BuscarParametros(this._relatorio);
- if (list == null || list.Count == 0)
- {
- list = this._tipo.GetProperties(BindingFlags.Instance | BindingFlags.Public).Select<PropertyInfo, ParametrosRelatorio>((PropertyInfo x) => {
- ParametrosRelatorio parametrosRelatorio = new ParametrosRelatorio();
- parametrosRelatorio.set_Campo(x.Name);
- parametrosRelatorio.set_Header(x.GetDescriptionAttribute());
- parametrosRelatorio.set_Tipo(x.GetTypeAttribute());
- parametrosRelatorio.set_Relatorio(this._relatorio);
- parametrosRelatorio.set_Width(0);
- parametrosRelatorio.set_Ordem(0);
- return parametrosRelatorio;
- }).ToList<ParametrosRelatorio>();
- }
- List<ParametrosRelatorio> parametrosRelatorios = list;
- parametrosRelatorios.ForEach((ParametrosRelatorio x) => x.set_Selecionado(true));
- ConfiguracaoImpressao configuracaoImpressao = new ConfiguracaoImpressao();
- configuracaoImpressao.set_TamanhoFonte(7);
- configuracaoImpressao.set_Campos(list);
- configuracaoImpressao.set_OrientacaoImpressao(new bool?(false));
- this.Configuracoes = configuracaoImpressao;
- }
-
- public void Selecionar()
- {
- if (this.Carregando)
- {
- return;
- }
- ConfiguracaoImpressao configuracoes = this.Configuracoes;
- if (configuracoes == null)
- {
- return;
- }
- List<ParametrosRelatorio> campos = configuracoes.get_Campos();
- if (campos == null)
- {
- return;
- }
- campos.ForEach((ParametrosRelatorio x) => x.set_Selecionado(!x.get_Selecionado()));
- }
- }
-} \ No newline at end of file