summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/BoletosNotasViewModel.cs
blob: 39f6c10ab8b57dc3992a74cbbfe86a025ad60cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System.Collections.Generic;
using System.Linq;
using Gestor.Application.Model.Ajuda;
using Gestor.Application.Servicos.Ajuda;
using Gestor.Application.ViewModels.Generic;

namespace Gestor.Application.ViewModels.Drawer.Ajuda;

public class BoletosNotasViewModel : BaseViewModel
{
	private readonly AjudaServico _ajudaServico;

	private bool _carregando;

	private List<Boleto> _boletos;

	private string _boletoDisponivel;

	private List<string> _status;

	public bool Carregando
	{
		get
		{
			return _carregando;
		}
		set
		{
			_carregando = value;
			base.IsEnabled = !value;
			base.EnableMenu = !value;
			OnPropertyChanged("Carregando");
		}
	}

	public List<Boleto> Boletos
	{
		get
		{
			return _boletos;
		}
		set
		{
			_boletos = value;
			OnPropertyChanged("Boletos");
		}
	}

	public string BoletoDisponivel
	{
		get
		{
			return _boletoDisponivel;
		}
		set
		{
			_boletoDisponivel = value;
			OnPropertyChanged("BoletoDisponivel");
		}
	}

	public List<string> Status
	{
		get
		{
			return _status;
		}
		set
		{
			_status = value;
			OnPropertyChanged("Status");
		}
	}

	public BoletosNotasViewModel()
	{
		_ajudaServico = new AjudaServico();
		LoadCombos();
		BoletoDisponivel = "Disponível para impressão a partir de\n10 (dez) dias antes do vencimento";
	}

	private void LoadCombos()
	{
		Status = new List<string>();
		Status.Add("PENDENTES");
		Status.Add("BAIXADOS");
	}

	public async void WorkOnSelectedStatus(string value)
	{
		Carregando = true;
		Boletos = new List<Boleto>();
		List<Boleto> list = await _ajudaServico.BuscarBoletosNotas(value);
		Boletos = ((value == "BAIXADOS") ? (from x in list
			where x.Pagamento.HasValue
			orderby x.Pagamento descending
			select x).ToList() : list);
		Carregando = false;
	}
}