using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using Gestor.Model.Attributes; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Seguros; using Gestor.Model.Helper; using Gestor.Model.Resources; using Newtonsoft.Json; namespace Gestor.Model.Domain.Financeiro; public class BancosContas : DomainBase, IDomain { private string _descricao; private string _agencia; private string _conta; private string _observacao; public bool Selecionado { get; set; } public long IdEmpresa { get; set; } = 1L; [Log(true)] public Banco Banco { get; set; } [Log(true)] [Name(true)] [Description("DESCRIÇÃO")] public string Descricao { get { return _descricao?.ToUpper(); } set { _descricao = value; } } [Log(true)] [Description("AGÊNCIA")] public string Agencia { get { return _agencia?.ToUpper().Trim(); } set { _agencia = value; } } [Log(true)] public string Conta { get { return _conta?.ToUpper().Trim(); } set { _conta = value; } } [Log(true)] [Description("OBSERVAÇÃO")] public string Observacao { get { return _observacao?.ToUpper(); } set { _observacao = value; } } [Log(true)] public bool Ativo { get; set; } [JsonIgnore] public Func>> ValidationEvent => Validate; public List> Validate() { List> list = new List>(); if (string.IsNullOrWhiteSpace(Descricao)) { list.AddValue("Descricao|DESCRIÇÃO", Messages.Obrigatorio); } if (Banco == null) { list.AddValue("Banco", Messages.Obrigatorio); } if (string.IsNullOrWhiteSpace(Agencia)) { list.AddValue("Agencia|AGÊNCIA", Messages.Obrigatorio); } if (string.IsNullOrWhiteSpace(Conta)) { list.AddValue("Conta", Messages.Obrigatorio); } return list; } public List Log() { return new List { new TupleList { Tuples = new ObservableCollection> { new Tuple("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), new Tuple("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia, ""), new Tuple("BANCO", (Banco == null) ? "" : Banco?.Nome, ""), new Tuple("CONTA CORRENTE/POUPANÇA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta, ""), new Tuple("ATIVO", Ativo ? "SIM" : "NÃO", ""), new Tuple("OBSERVAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "") } } }; } }