summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs86
1 files changed, 86 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs
new file mode 100644
index 0000000..f0b8c66
--- /dev/null
+++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs
@@ -0,0 +1,86 @@
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class Cobertura : DomainBase, IDomain
+ {
+ private string _observacao;
+
+ public Gestor.Model.Domain.Seguros.CoberturaPadrao CoberturaPadrao
+ {
+ get;
+ set;
+ }
+
+ public decimal Franquia
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Item Item
+ {
+ get;
+ set;
+ }
+
+ public decimal Lmi
+ {
+ get;
+ set;
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ string str = this._observacao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._observacao = (!string.IsNullOrWhiteSpace(value) || this.CoberturaPadrao == null ? value : this.CoberturaPadrao.Descricao);
+ }
+ }
+
+ public decimal Premio
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Cobertura cobertura = this;
+ return new Func<List<KeyValuePair<string, string>>>(cobertura.Validate);
+ }
+ }
+
+ public Cobertura()
+ {
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if ((this.Lmi != decimal.Zero || this.Premio != decimal.Zero || this.Franquia != decimal.Zero) && string.IsNullOrWhiteSpace(this.Observacao))
+ {
+ keyValuePairs.AddValue<string, string>("Observacao", Messages.Obrigatorio, true);
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file