diff options
Diffstat (limited to 'Gestor.Model/Model.Domain.Seguros/Vida.cs')
| -rw-r--r-- | Gestor.Model/Model.Domain.Seguros/Vida.cs | 306 |
1 files changed, 306 insertions, 0 deletions
diff --git a/Gestor.Model/Model.Domain.Seguros/Vida.cs b/Gestor.Model/Model.Domain.Seguros/Vida.cs new file mode 100644 index 0000000..4d945c4 --- /dev/null +++ b/Gestor.Model/Model.Domain.Seguros/Vida.cs @@ -0,0 +1,306 @@ +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 Vida : DomainBase, IDomain
+ {
+ private string _plano;
+
+ public decimal? CapitalFuncionarios
+ {
+ get;
+ set;
+ }
+
+ public decimal? CapitalSocios
+ {
+ get;
+ set;
+ }
+
+ public int? Funcionarios
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Item Item
+ {
+ get;
+ set;
+ }
+
+ public string Observacao
+ {
+ get;
+ set;
+ }
+
+ public string Plano
+ {
+ get
+ {
+ string str = this._plano;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._plano = value;
+ }
+ }
+
+ public int? Socios
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Vida vida = this;
+ return new Func<List<KeyValuePair<string, string>>>(vida.Validate);
+ }
+ }
+
+ public Vida()
+ {
+ }
+
+ public static List<TupleList> Log(Gestor.Model.Domain.Seguros.Item item)
+ {
+ string str;
+ string str1;
+ string str2;
+ string str3;
+ string str4;
+ string str5;
+ 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>("PLANO", (string.IsNullOrWhiteSpace(item.Vida.Plano) ? "" : item.Vida.Plano), ""),
+ new Tuple<string, string, string>("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao.ToUpper()), "")
+ };
+ int? socios = item.Vida.Socios;
+ if (!socios.HasValue)
+ {
+ str = "";
+ }
+ else
+ {
+ socios = item.Vida.Socios;
+ if (socios.HasValue)
+ {
+ str = socios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("SÓCIOS", str, ""));
+ decimal? capitalSocios = item.Vida.CapitalSocios;
+ if (!capitalSocios.HasValue)
+ {
+ str1 = "";
+ }
+ else
+ {
+ capitalSocios = item.Vida.CapitalSocios;
+ if (capitalSocios.HasValue)
+ {
+ str1 = capitalSocios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str1 = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("CAPITAL SÓCIO", str1, ""));
+ socios = item.Vida.Funcionarios;
+ if (!socios.HasValue)
+ {
+ str2 = "";
+ }
+ else
+ {
+ socios = item.Vida.Funcionarios;
+ if (socios.HasValue)
+ {
+ str2 = socios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str2 = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("FUNCIONÁRIOS", str2, ""));
+ capitalSocios = item.Vida.CapitalFuncionarios;
+ if (!capitalSocios.HasValue)
+ {
+ str3 = "";
+ }
+ else
+ {
+ capitalSocios = item.Vida.CapitalFuncionarios;
+ if (capitalSocios.HasValue)
+ {
+ str3 = capitalSocios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str3 = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("CAPITAL FUNCIONÁRIOS", str3, ""));
+ socios = item.Vida.Socios;
+ if (!socios.HasValue)
+ {
+ str4 = "";
+ }
+ else
+ {
+ socios = item.Vida.Socios;
+ if (socios.HasValue)
+ {
+ str4 = socios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str4 = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("QUANTIDADE DE TITULARES", str4, ""));
+ socios = item.Vida.Funcionarios;
+ if (!socios.HasValue)
+ {
+ str5 = "";
+ }
+ else
+ {
+ socios = item.Vida.Funcionarios;
+ if (socios.HasValue)
+ {
+ str5 = socios.GetValueOrDefault().ToString();
+ }
+ else
+ {
+ str5 = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("QUANTIDADE DE BENEFICIÁRIOS", str5, ""));
+ 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>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection1.Add(new Tuple<string, string, string>(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", ""));
+ observableCollection1.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), ""));
+ decimal premio = cobertura.Premio;
+ observableCollection1.Add(new Tuple<string, string, string>(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Franquia;
+ observableCollection1.Add(new Tuple<string, string, string>(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Lmi;
+ observableCollection1.Add(new Tuple<string, string, string>(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ }
+ tupleLists1.Add(new TupleList()
+ {
+ Tuples = observableCollection1
+ });
+ return tupleLists1;
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ decimal num;
+ bool documento;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Plano))
+ {
+ keyValuePairs.AddValue<string, string>("Plano", Messages.Obrigatorio, true);
+ }
+ Gestor.Model.Domain.Seguros.Item item = this.Item;
+ if (item != null)
+ {
+ documento = item.Documento;
+ }
+ else
+ {
+ documento = false;
+ }
+ if (!documento)
+ {
+ return keyValuePairs;
+ }
+ long id = this.Item.Documento.Controle.Ramo.Id;
+ if (id == (long)7 || id == (long)10 || id == (long)53)
+ {
+ int? socios = this.Socios;
+ if (socios.HasValue)
+ {
+ socios = this.Socios;
+ if (!(socios.GetValueOrDefault() < 0 & socios.HasValue))
+ {
+ goto Label0;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("Socios|SÓCIOS", Messages.Obrigatorio, true);
+ Label0:
+ socios = this.Funcionarios;
+ if (socios.HasValue)
+ {
+ socios = this.Funcionarios;
+ if (!(socios.GetValueOrDefault() < 0 & socios.HasValue))
+ {
+ goto Label1;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("Funcionarios|FUNCIONÁRIOS", Messages.Obrigatorio, true);
+ Label1:
+ decimal? capitalSocios = this.CapitalSocios;
+ if (capitalSocios.HasValue)
+ {
+ capitalSocios = this.CapitalSocios;
+ num = new decimal();
+ if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue))
+ {
+ goto Label2;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("CapitalSocios|CAPITAL SÓCIO", Messages.Obrigatorio, true);
+ Label2:
+ capitalSocios = this.CapitalFuncionarios;
+ if (capitalSocios.HasValue)
+ {
+ capitalSocios = this.CapitalFuncionarios;
+ num = new decimal();
+ if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue))
+ {
+ return keyValuePairs;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("CapitalFuncionarios|CAPITAL FUNCIONÁRIO", Messages.Obrigatorio, true);
+ }
+ return keyValuePairs;
+ }
+ }
+}
\ No newline at end of file |