From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Gestor.Model/Model.Domain.Seguros/Vendedor.cs | 375 +++++++++++++++++++++ 1 file changed, 375 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs') diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs new file mode 100644 index 0000000..200f397 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs @@ -0,0 +1,375 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class Vendedor : EnderecoBase, IDomain, INotifyPropertyChanged + { + private bool _selecionado; + + private string _nome; + + private string _documento; + + private string _conta; + + private string _agencia; + + private string _observacao; + + private string _titularConta; + + private string _documentoTitular; + + public string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + public bool Ativo + { + get; + set; + } + + public Gestor.Model.Domain.Common.Banco Banco + { + get; + set; + } + + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + public Gestor.Model.Domain.Seguros.Controle Controle + { + get; + set; + } + + public bool Corretora + { + get; + set; + } + + public decimal? Desconto + { + get; + set; + } + + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public List Telefones + { + get; + set; + } + + public Gestor.Model.Common.TipoConta TipoConta + { + get; + set; + } + + public Gestor.Model.Common.TipoIncidenciaDesconto TipoIncidenciaDesconto + { + get; + set; + } + + public string TitularConta + { + get + { + string str = this._titularConta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._titularConta = value; + } + } + + public string TitularDocumento + { + get + { + string str = this._documentoTitular; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documentoTitular = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Vendedor vendedor = this; + return new Func>>(vendedor.Validate); + } + } + + public Vendedor() + { + } + + public List Log() + { + decimal? nullable; + string str; + string description; + decimal? nullable1; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), ""), + new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome), ""), + new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), ""), + new Tuple("CONTA CORRENTE/POUPANÇA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), ""), + new Tuple("TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularConta) ? "" : this.TitularConta), ""), + new Tuple("DOCUMENTO TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularDocumento) ? "" : this.TitularDocumento), ""), + new Tuple("TIPO CONTA", (string.IsNullOrWhiteSpace(this.TipoConta.GetDescription()) ? "" : this.TipoConta.GetDescription()), "") + }; + decimal? desconto = this.Desconto; + if (!desconto.HasValue) + { + str = ""; + } + else + { + desconto = this.Desconto; + decimal num = 100; + if (desconto.HasValue) + { + nullable1 = new decimal?(desconto.GetValueOrDefault() / num); + } + else + { + nullable = null; + nullable1 = nullable; + } + nullable = nullable1; + if (nullable.HasValue) + { + decimal valueOrDefault = nullable.GetValueOrDefault(); + str = valueOrDefault.ToString("P", new CultureInfo("pt-BR", false)); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("DESCONTO", str, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("CONTATOS$", "", "") + }; + if (this.Telefones != null && this.Telefones.Count != 0) + { + foreach (VendedorTelefone telefone in this.Telefones) + { + observableCollection1.Add(new Tuple(string.Format(" CONTATO {0}$", this.Telefones.IndexOf(telefone) + 1), "", "")); + observableCollection1.Add(new Tuple(" NOME", (string.IsNullOrWhiteSpace(telefone.Nome) ? "" : telefone.Nome), "")); + ObservableCollection> observableCollection2 = observableCollection1; + TipoTelefone? tipo = telefone.Tipo; + if (!tipo.HasValue) + { + description = ""; + } + else + { + tipo = telefone.Tipo; + if (tipo.HasValue) + { + description = tipo.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection2.Add(new Tuple(" TIPO DE TELEFONE", description, "")); + observableCollection1.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo), "")); + observableCollection1.Add(new Tuple(" NÚMERO DE TELEFONE", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), "")); + observableCollection1.Add(new Tuple(" E-MAIL", (string.IsNullOrWhiteSpace(telefone.Email) ? "" : telefone.Email), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + } + return tupleLists1; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrEmpty(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Documento) && !this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TitularDocumento) && !this.TitularDocumento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("TitularDocumento", Messages.Invalido, true); + } + if (this.Telefones == null) + { + return keyValuePairs; + } + foreach (VendedorTelefone telefone in this.Telefones) + { + keyValuePairs.AddRange(telefone.Validate()); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file -- cgit v1.2.3