summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs375
1 files changed, 375 insertions, 0 deletions
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<VendedorTelefone> 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<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Vendedor vendedor = this;
+ return new Func<List<KeyValuePair<string, string>>>(vendedor.Validate);
+ }
+ }
+
+ public Vendedor()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ decimal? nullable;
+ string str;
+ string description;
+ decimal? nullable1;
+ List<TupleList> tupleLists = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""),
+ new Tuple<string, string, string>("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""),
+ new Tuple<string, string, string>("ATIVO", (this.Ativo ? "SIM" : "NÃO"), ""),
+ new Tuple<string, string, string>("BANCO", (this.Banco == null ? "" : this.Banco.Nome), ""),
+ new Tuple<string, string, string>("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), ""),
+ new Tuple<string, string, string>("CONTA CORRENTE/POUPANÇA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), ""),
+ new Tuple<string, string, string>("TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularConta) ? "" : this.TitularConta), ""),
+ new Tuple<string, string, string>("DOCUMENTO TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularDocumento) ? "" : this.TitularDocumento), ""),
+ new Tuple<string, string, string>("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<string, string, string>("DESCONTO", str, ""));
+ tupleList.Tuples = observableCollection;
+ tupleLists.Add(tupleList);
+ List<TupleList> tupleLists1 = tupleLists;
+ ObservableCollection<Tuple<string, string, string>> observableCollection1 = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("CONTATOS$", "", "")
+ };
+ if (this.Telefones != null && this.Telefones.Count != 0)
+ {
+ foreach (VendedorTelefone telefone in this.Telefones)
+ {
+ observableCollection1.Add(new Tuple<string, string, string>(string.Format(" CONTATO {0}$", this.Telefones.IndexOf(telefone) + 1), "", ""));
+ observableCollection1.Add(new Tuple<string, string, string>(" NOME", (string.IsNullOrWhiteSpace(telefone.Nome) ? "" : telefone.Nome), ""));
+ ObservableCollection<Tuple<string, string, string>> 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<string, string, string>(" TIPO DE TELEFONE", description, ""));
+ observableCollection1.Add(new Tuple<string, string, string>(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo), ""));
+ observableCollection1.Add(new Tuple<string, string, string>(" NÚMERO DE TELEFONE", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), ""));
+ observableCollection1.Add(new Tuple<string, string, string>(" 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<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrEmpty(this.Nome))
+ {
+ keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Documento) && !this.Documento.ValidacaoDocumento())
+ {
+ keyValuePairs.AddValue<string, string>("Documento", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.TitularDocumento) && !this.TitularDocumento.ValidacaoDocumento())
+ {
+ keyValuePairs.AddValue<string, string>("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