summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs130
1 files changed, 130 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs
new file mode 100644
index 0000000..1f8772f
--- /dev/null
+++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs
@@ -0,0 +1,130 @@
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class RiscosDiversos : DomainBase, IDomain
+ {
+ private string _observacao;
+
+ public string Area
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Item Item
+ {
+ get;
+ set;
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ string str = this._observacao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._observacao = value;
+ }
+ }
+
+ public decimal? SubsidioEstadual
+ {
+ get;
+ set;
+ }
+
+ public decimal? SubsidioFederal
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ RiscosDiversos riscosDiverso = this;
+ return new Func<List<KeyValuePair<string, string>>>(riscosDiverso.Validate);
+ }
+ }
+
+ public RiscosDiversos()
+ {
+ }
+
+ public static List<TupleList> Log(Gestor.Model.Domain.Seguros.Item item)
+ {
+ List<TupleList> tupleLists = new List<TupleList>()
+ {
+ new TupleList()
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao), ""),
+ new Tuple<string, string, string>("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.RiscosDiversos.Observacao) ? "" : item.RiscosDiversos.Observacao.ToUpper()), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), ""));
+ decimal premio = cobertura.Premio;
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Franquia;
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Lmi;
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ }
+ tupleLists.Add(new TupleList()
+ {
+ Tuples = observableCollection
+ });
+ return tupleLists;
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ bool id;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Observacao))
+ {
+ Gestor.Model.Domain.Seguros.Item item = this.Item;
+ if (item != null)
+ {
+ id = item.Documento.Controle.Ramo.Id != (long)23;
+ }
+ else
+ {
+ id = true;
+ }
+ if (id)
+ {
+ keyValuePairs.AddValue<string, string>("Observacao", Messages.Obrigatorio, true);
+ }
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file