using Gestor.Model.Attributes; using Gestor.Model.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Helper; using Gestor.Model.Resources; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; namespace Gestor.Model.Domain.Seguros { public class SinistroAuto : DomainBase, IDomain { private string _numeroBo; private string _endereco; private string _envolvido; private string _motorista; private string _ddd; private string _telefone; private string _email; private string _cnh; [Log(true)] [Name(true)] public string Cnh { get { string str = this._cnh; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._cnh = value; } } [Description("DECLARA-SE CULPADO")] [Log(true)] [Name(true)] public bool? Culpado { get; set; } [Description("PREFIXO")] [Log(true)] [Name(true)] public string Ddd { get { string str = this._ddd; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._ddd = value; } } [Description("E-MAIL")] [Log(true)] [Name(true)] public string Email { get { string str = this._email; if (str == null) { return null; } return str.ToLower().Trim(); } set { this._email = value; } } [Description("ENDEREÇO")] [Log(true)] [Name(true)] public string Endereco { get { string str = this._endereco; if (str != null) { return str.ToUpper(); } return null; } set { this._endereco = value; } } [Log(true)] [Name(true)] public string Envolvido { get { string str = this._envolvido; if (str != null) { return str.ToUpper(); } return null; } set { this._envolvido = value; } } [Log(true)] [Name(true)] public string Motorista { get { string str = this._motorista; if (str != null) { return str.ToUpper(); } return null; } set { this._motorista = value; } } [Description("NUMERO B.O.")] [Log(true)] [Name(true)] public string NumeroBo { get { string str = this._numeroBo; if (str != null) { return str.ToUpper(); } return null; } set { this._numeroBo = value; } } [Description("FUNILARIA")] [Log(true)] public Parceiro ParceiroFunilaria { get; set; } [Description("MECÂNICA")] [Log(true)] public Parceiro ParceiroMecanica { get; set; } public Gestor.Model.Domain.Seguros.Sinistro Sinistro { get; set; } [Description("TELEFONE")] [Log(true)] [Name(true)] public string Telefone { get { string str = this._telefone; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._telefone = value; } } [Description("TIPO PERDA")] [Log(true)] [Name(true)] public Gestor.Model.Common.TipoPerda? TipoPerda { get; set; } [Description("DATA ÚLTIMO DOC. ENVIADO")] [Log(true)] [Name(true)] public DateTime? UltimoDocEnviado { get; set; } [JsonIgnore] public Func>> ValidationEvent { get { SinistroAuto sinistroAuto = this; return new Func>>(sinistroAuto.Validate); } } [Description("VALOR FINILARIA")] [Log(true)] [Name(true)] public decimal ValorFunilaria { get; set; } [Description("VALOR MECÂNICA")] [Log(true)] [Name(true)] public decimal ValorMecanica { get; set; } public SinistroAuto() { } public List> Validate() { List> keyValuePairs = ValidationHelper.AddValue(); if (this.Sinistro != null) { keyValuePairs.AddRange(this.Sinistro.Validate()); } if (this.UltimoDocEnviado.HasValue && (DateTime.Compare(this.UltimoDocEnviado.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.UltimoDocEnviado.Value, new DateTime(9999, 12, 31)) > 0)) { keyValuePairs.AddValue("UltimoDocEnviado", string.Format(Messages.DataInvalida, Array.Empty()), true); } return keyValuePairs; } } }