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; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; namespace Gestor.Model.Domain.Financeiro { public class BancosContas : DomainBase, IDomain { private string _descricao; private string _agencia; private string _conta; private string _observacao; [Description("AGÊNCIA")] [Log(true)] public string Agencia { get { string str = this._agencia; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._agencia = value; } } [Log(true)] public bool Ativo { get; set; } [Log(true)] public Gestor.Model.Domain.Common.Banco Banco { get; set; } [Log(true)] public string Conta { get { string str = this._conta; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._conta = value; } } [Description("DESCRIÇÃO")] [Log(true)] [Name(true)] public string Descricao { get { string str = this._descricao; if (str != null) { return str.ToUpper(); } return null; } set { this._descricao = value; } } public long IdEmpresa { get; set; } = (long)1; [Description("OBSERVAÇÃO")] [Log(true)] public string Observacao { get { string str = this._observacao; if (str != null) { return str.ToUpper(); } return null; } set { this._observacao = value; } } public bool Selecionado { get; set; } [JsonIgnore] public Func>> ValidationEvent { get { BancosContas bancosConta = this; return new Func>>(bancosConta.Validate); } } public BancosContas() { } public List Log() { string nome; List tupleLists = new List(); TupleList tupleList = new TupleList(); ObservableCollection> observableCollection = new ObservableCollection>() { new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(this.Descricao) ? "" : this.Descricao), ""), new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), "") }; if (this.Banco == null) { nome = ""; } else { Gestor.Model.Domain.Common.Banco banco = this.Banco; if (banco != null) { nome = banco.Nome; } else { nome = null; } } observableCollection.Add(new Tuple("BANCO", nome, "")); observableCollection.Add(new Tuple("CONTA CORRENTE/POUPANÇA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), "")); observableCollection.Add(new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "")); observableCollection.Add(new Tuple("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao), "")); tupleList.Tuples = observableCollection; tupleLists.Add(tupleList); return tupleLists; } public List> Validate() { List> keyValuePairs = new List>(); if (string.IsNullOrWhiteSpace(this.Descricao)) { keyValuePairs.AddValue("Descricao|DESCRIÇÃO", Messages.Obrigatorio, true); } if (this.Banco == null) { keyValuePairs.AddValue("Banco", Messages.Obrigatorio, true); } if (string.IsNullOrWhiteSpace(this.Agencia)) { keyValuePairs.AddValue("Agencia|AGÊNCIA", Messages.Obrigatorio, true); } if (string.IsNullOrWhiteSpace(this.Conta)) { keyValuePairs.AddValue("Conta", Messages.Obrigatorio, true); } return keyValuePairs; } } }