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 _boletos; private string _boletoDisponivel; private List _status; public bool Carregando { get { return _carregando; } set { _carregando = value; base.IsEnabled = !value; base.EnableMenu = !value; OnPropertyChanged("Carregando"); } } public List Boletos { get { return _boletos; } set { _boletos = value; OnPropertyChanged("Boletos"); } } public string BoletoDisponivel { get { return _boletoDisponivel; } set { _boletoDisponivel = value; OnPropertyChanged("BoletoDisponivel"); } } public List 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(); Status.Add("PENDENTES"); Status.Add("BAIXADOS"); } public async void WorkOnSelectedStatus(string value) { Carregando = true; Boletos = new List(); List 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; } }