summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs')
-rw-r--r--Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs1991
1 files changed, 1991 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs
new file mode 100644
index 0000000..990e3a2
--- /dev/null
+++ b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ReportRepository.cs
@@ -0,0 +1,1991 @@
+using Gestor.Common.Helpers;
+using Gestor.Infrastructure.Entities.Seguros;
+using Gestor.Infrastructure.Helpers;
+using Gestor.Infrastructure.Repository.Generic;
+using Gestor.Infrastructure.Repository.Interface;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Relatorios;
+using Gestor.Model.Domain.Seguros;
+using NHibernate;
+using NHibernate.Connection;
+using NHibernate.Impl;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
+
+namespace Gestor.Infrastructure.Repository.Logic
+{
+ public class ReportRepository : GenericRepository<DocumentoDb>, IReportRepository, IGenericRepository<DocumentoDb>
+ {
+ private readonly GenericUnitOfWork _unitOfWork;
+
+ public ReportRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session)
+ {
+ this._unitOfWork = unitOfWork;
+ }
+
+ public List<PlanilhaCompleta> PlanilhaCompleta(List<long> ids, bool configFranquia, bool configSomaPremio)
+ {
+ object connection;
+ List<long> nums = null;
+ List<long> nums1 = null;
+ if (ids == null || ids.Count == 0)
+ {
+ return new List<PlanilhaCompleta>();
+ }
+ DataTable dataTable = new DataTable();
+ DataTable dataTable1 = new DataTable();
+ DataTable dataTable2 = new DataTable();
+ DataTable dataTable3 = new DataTable();
+ DataTable dataTable4 = new DataTable();
+ DataTable dataTable5 = new DataTable();
+ DataTable dataTable6 = new DataTable();
+ DataTable dataTable7 = new DataTable();
+ DataTable dataTable8 = new DataTable();
+ DataTable dataTable9 = new DataTable();
+ DataTable dataTable10 = new DataTable();
+ DataTable dataTable11 = new DataTable();
+ DataTable dataTable12 = new DataTable();
+ DataTable dataTable13 = new DataTable();
+ DataTable dataTable14 = new DataTable();
+ DataTable dataTable15 = new DataTable();
+ DataTable dataTable16 = new DataTable();
+ DataTable dataTable17 = new DataTable();
+ DataTable dataTable18 = new DataTable();
+ DataTable dataTable19 = new DataTable();
+ DataTable dataTable20 = new DataTable();
+ SessionFactoryImpl sessionFactory = this._unitOfWork.Session.SessionFactory as SessionFactoryImpl;
+ if (sessionFactory != null)
+ {
+ connection = sessionFactory.ConnectionProvider.GetConnection();
+ }
+ else
+ {
+ connection = null;
+ }
+ using (SqlConnection sqlConnection = connection as SqlConnection)
+ {
+ using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
+ {
+ Auxiliar.CriarAuxiliar(sqlCommand, false);
+ for (List<long> i1 = ids; i1.Count > 0; i1 = nums1)
+ {
+ List<long> nums2 = i1.Take<long>(2100).ToList<long>();
+ string str9 = string.Concat(" AND d.iddocumento IN (", string.Join<long>(",", nums2), ")");
+ DataTable table = new DataTable();
+ string str10 = string.Concat("SELECT DISTINCT *, r.nome AS nomeRamo, cs.nome AS nomeCiaseg, ven.nome AS nomeVendedor, cl.idcodigobanco AS cliBanco, cl.agencia AS cliAgencia, cl.Conta AS cliConta, d.adinacomis as adinacomis, prod.nome as nomeProduto, c.idciasegant as idciasegant FROM documento d INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN cliente cl on cl.idcliente = c.idcliente INNER JOIN ramo r on r.idramo = c.idramo INNER JOIN ciaseg cs on cs.idciaseg = c.idciaseg OUTER APPLY (SELECT TOP 1 idvendedor FROM vendedorparcela vp WHERE vp.iddocumento = d.iddocumento AND vp.idtipovendedor = 1) vp LEFT OUTER JOIN vendedor ven on ven.idvendedor = vp.idvendedor LEFT OUTER JOIN produto prod on prod.idproduto = c.idproduto WHERE 1=1 ", str9, " AND d.tiporecebimento = 1;");
+ sqlCommand.CommandText = str10 ?? "";
+ using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter())
+ {
+ sqlDataAdapter.SelectCommand = sqlCommand;
+ sqlCommand.CommandTimeout = 3000;
+ sqlDataAdapter.Fill(table);
+ }
+ dataTable.Merge(table);
+ table = new DataTable();
+ string str11 = string.Concat("SELECT d.idcontrole, d.pedadit, d.aditamento, d.ordem, pr_liq, pr_adic, pr_custo, pr_iof, pr_total FROM documento d INNER JOIN controle c on c.idcontrole = d.idcontrole WHERE 1=1 AND c.idcontrole IN (SELECT d.idcontrole FROM documento d WHERE 1=1 ", str9, ")AND d.tiporecebimento = 1 AND d.ordem != 0 ORDER BY d.ordem");
+ sqlCommand.CommandText = str11 ?? "";
+ using (SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter())
+ {
+ sqlDataAdapter1.SelectCommand = sqlCommand;
+ sqlDataAdapter1.Fill(table);
+ }
+ dataTable16.Merge(table);
+ table = new DataTable();
+ string str12 = string.Concat("SELECT d.iddocumento, ce.endereco, ce.numero, ce.uf, ce.bairro, ce.cep, ce.cidade, ce.ordem FROM cliendereco ce INNER JOIN cliente cl on cl.idcliente = ce.idcliente INNER JOIN controle c on c.idcliente = cl.idcliente INNER JOIN documento d on d.idcontrole = c.idcontrole WHERE 1=1 ", str9, ";");
+ sqlCommand.CommandText = str12 ?? "";
+ using (SqlDataAdapter sqlDataAdapter2 = new SqlDataAdapter())
+ {
+ sqlDataAdapter2.SelectCommand = sqlCommand;
+ sqlDataAdapter2.Fill(table);
+ }
+ DataView defaultView = table.DefaultView;
+ defaultView.Sort = "ordem";
+ table = defaultView.ToTable();
+ dataTable4.Merge(table);
+ table = new DataTable();
+ string str13 = string.Concat("SELECT d.iddocumento, email, cm.ordem FROM climail cm INNER JOIN cliente cl on cl.idcliente = cm.idcliente INNER JOIN controle c on c.idcliente = cl.idcliente INNER JOIN documento d on d.idcontrole = c.idcontrole WHERE 1=1 ", str9, " ;");
+ sqlCommand.CommandText = str13 ?? "";
+ using (SqlDataAdapter sqlDataAdapter3 = new SqlDataAdapter())
+ {
+ sqlDataAdapter3.SelectCommand = sqlCommand;
+ sqlDataAdapter3.Fill(table);
+ }
+ DataView dataViews = table.DefaultView;
+ dataViews.Sort = "ordem";
+ table = dataViews.ToTable();
+ dataTable3.Merge(table);
+ table = new DataTable();
+ string str14 = string.Concat("SELECT d.iddocumento, ddd, fone, ct.ordem FROM clitelefone ct INNER JOIN cliente cl on cl.idcliente = ct.idcliente INNER JOIN controle c on c.idcliente = cl.idcliente INNER JOIN documento d on d.idcontrole = c.idcontrole WHERE 1=1 ", str9, ";");
+ sqlCommand.CommandText = str14 ?? "";
+ using (SqlDataAdapter sqlDataAdapter4 = new SqlDataAdapter())
+ {
+ sqlDataAdapter4.SelectCommand = sqlCommand;
+ sqlDataAdapter4.Fill(table);
+ }
+ DataView defaultView1 = table.DefaultView;
+ defaultView1.Sort = "ordem";
+ table = defaultView1.ToTable();
+ dataTable2.Merge(table);
+ table = new DataTable();
+ string str15 = string.Concat("SELECT d.iddocumento, nome AS nomeEstipulante, CASE WHEN es.idestipulante = d.idestipulante THEN '1'WHEN es.idestipulante = d.idestipulante2 THEN '2'WHEN es.idestipulante = d.idestipulante3 THEN '3'WHEN es.idestipulante = d.idestipulante4 THEN '4'WHEN es.idestipulante = d.idestipulante5 THEN '5'ELSE 'N/A'END AS 'index'FROM estipulante es INNER JOIN documento d on es.idestipulante IN (d.idestipulante, d.idestipulante2, d.idestipulante3, d.idestipulante4, d.idestipulante5) WHERE 1=1 ", str9, ";");
+ sqlCommand.CommandText = str15 ?? "";
+ using (SqlDataAdapter sqlDataAdapter5 = new SqlDataAdapter())
+ {
+ sqlDataAdapter5.SelectCommand = sqlCommand;
+ sqlDataAdapter5.Fill(table);
+ }
+ dataTable1.Merge(table);
+ table = new DataTable();
+ string str16 = string.Concat("SELECT d.iddocumento, * FROM cliContato cc INNER JOIN cliente cl on cl.idcliente = cc.idcliente INNER JOIN controle c on c.idcliente = cl.idcliente INNER JOIN documento d on d.idcontrole = c.idcontrole WHERE 1=1 ", str9, ";");
+ sqlCommand.CommandText = str16 ?? "";
+ using (SqlDataAdapter sqlDataAdapter6 = new SqlDataAdapter())
+ {
+ sqlDataAdapter6.SelectCommand = sqlCommand;
+ sqlDataAdapter6.Fill(table);
+ }
+ dataTable5.Merge(table);
+ table = new DataTable();
+ string str17 = string.Concat("SELECT DISTINCT idcontrolesinistro, idcontrole as id FROM controlesinistro cs INNER JOIN item i on i.iditem = cs.iditem INNER JOIN documento d on d.iddocumento = i.iddocumento WHERE 1=1 ", str9);
+ sqlCommand.CommandText = str17 ?? "";
+ using (SqlDataAdapter sqlDataAdapter7 = new SqlDataAdapter())
+ {
+ sqlDataAdapter7.SelectCommand = sqlCommand;
+ sqlDataAdapter7.Fill(table);
+ }
+ dataTable7.Merge(table);
+ table = new DataTable();
+ string str18 = string.Concat(" AND d.idcontrole IN (", string.Join<long>(",", dataTable.AsEnumerable().Select<DataRow, long>((DataRow v) => v.Field<long>("idcontrole"))), ")");
+ sqlCommand.CommandText = string.Concat("SELECT it.iditem, d.iddocumento, it.descricao, it.sinistrado, it.obs, it.status, d.idcontrole FROM item it INNER JOIN documento d on d.iddocumento = it.iddocumento WHERE 1=1 AND (cancelado IS NULL OR cancelado != '1') AND idsubstituido IS NULL ", " ", str18);
+ using (SqlDataAdapter sqlDataAdapter8 = new SqlDataAdapter())
+ {
+ sqlDataAdapter8.SelectCommand = sqlCommand;
+ sqlDataAdapter8.Fill(table);
+ }
+ dataTable6.Merge(table);
+ for (List<long> j = table.AsEnumerable().Select<DataRow, long>((DataRow i) => i.Field<long>("iditem")).ToList<long>(); j.Count > 0; j = nums)
+ {
+ List<long> nums3 = j.Take<long>(2000).ToList<long>();
+ SqlQueryCondition sqlQueryCondition = (new List<Condicao>()
+ {
+ new Condicao()
+ {
+ Campo = "iditem",
+ Valores = nums3.CriarValor<long>()
+ }
+ }).CreateParameters(0);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT iditem, a.codfipe, a.modelo, a.idcategoria, a.idtabelareferencia, a.idcombustivel, a.chassi, a.placa, a.anofab, a.anomod, a.renavam, a.capacidade, a.portas, a.idcor, a.obs, a.regiaocirculacao, a.bonus, a.porcentagemreferencia, a.valordeterminado, a.ci, a.ceppernoite, a.financiado, a.zerokm, a.isencao, a.pcd, a.correcao, a.idfabricante, fab.descricao as fabricante FROM auto a LEFT JOIN fabricante fab on fab.idfabricante = a.idfabricante WHERE ", "");
+ dataTable9.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT iditem, res.endereco as enderecoitem, res.numero as numeroitem, res.bens, res.cidade as cidadeitem, res.uf as ufitem, res.bairro as bairroitem, res.cep as cepitem, res.complemento as complementoitem, res.tiporesidencia, res.obs as obsresidencia, res.imobiliaria, res.contato as contatoresidencia, res.idfonetipo as fonetipoloc, res.ddd as dddloc, res.fone as foneloc, res.locatario, res.cpflocatario1, res.ddd2 as ddd2loc, res.fone2 as fone2loc, res.locatario2, res.cpflocatario2, res.dddlocatario2, res.fonelocatario2, res.locatario3, res.cpflocatario3, res.dddlocatario3, res.fonelocatario3 FROM resempco res WHERE ", "");
+ dataTable10.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM granizo g WHERE ", "");
+ dataTable11.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM aeronautico a WHERE ", "");
+ dataTable12.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM riscosdiversos r WHERE ", "");
+ dataTable13.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM vida v WHERE ", "");
+ dataTable14.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM controlesinistro cs INNER JOIN sinistro s on s.idcontrolesinistro = cs.idcontrolesinistro WHERE ", "");
+ dataTable8.Merge(table);
+ table = sqlCommand.Select(sqlQueryCondition, "SELECT * FROM consorcio WHERE", "");
+ dataTable20.Merge(table);
+ nums = (nums3.Count < 2000 ? new List<long>() : j.Except<long>(nums3).ToList<long>());
+ }
+ table = new DataTable();
+ string str19 = string.Concat(" select cli.* from clivinculo cli inner join controle con on cli.idcliente1 = con.idcliente inner join documento d on d.idcontrole = con.idcontrole inner join cliente cliente on cliente.IDCLIENTE = cli.idcliente1 WHERE 1=1 ", str9, ";");
+ sqlCommand.CommandText = str19 ?? "";
+ using (SqlDataAdapter sqlDataAdapter9 = new SqlDataAdapter())
+ {
+ sqlDataAdapter9.SelectCommand = sqlCommand;
+ sqlDataAdapter9.Fill(table);
+ }
+ dataTable15.Merge(table);
+ table = new DataTable();
+ string str20 = string.Concat("SELECT franquia, d.iddocumento FROM cobertura c INNER JOIN item i ON i.iditem = c.iditem INNER JOIN documento d ON d.iddocumento = i.iddocumento WHERE 1=1 AND franquia IS NOT NULL AND franquia != 0 ", str9, " ;");
+ if (configFranquia)
+ {
+ str20 = string.Concat("SELECT SUM(franquia) AS franquia, d.iddocumento FROM cobertura c INNER JOIN item i ON i.iditem = c.iditem INNER JOIN documento d ON d.iddocumento = i.iddocumento WHERE 1=1 ", str9, " GROUP BY d.iddocumento;");
+ }
+ sqlCommand.CommandText = str20 ?? "";
+ using (SqlDataAdapter sqlDataAdapter10 = new SqlDataAdapter())
+ {
+ sqlDataAdapter10.SelectCommand = sqlCommand;
+ sqlDataAdapter10.Fill(table);
+ }
+ dataTable17.Merge(table);
+ table = new DataTable();
+ string str21 = string.Concat("SELECT idcoberturapadrao, franquia, lmi, observacao, premio, c.iditem FROM cobertura c INNER JOIN item i ON i.iditem = c.iditem INNER JOIN documento d ON d.iddocumento = i.iddocumento WHERE 1=1 ", str9, " AND idcoberturapadrao IN (2, 3, 17, 7, 5);");
+ sqlCommand.CommandText = str21 ?? "";
+ using (SqlDataAdapter sqlDataAdapter11 = new SqlDataAdapter())
+ {
+ sqlDataAdapter11.SelectCommand = sqlCommand;
+ sqlDataAdapter11.Fill(table);
+ }
+ dataTable18.Merge(table);
+ table = new DataTable();
+ string str22 = string.Concat("SELECT DISTINCT p.nomecompleto, p.cpf, p.datanascimento, p.sexo, p.estadocivil, p.ceppernoite, p.cepcirculacao, c.idcontrole, d.iddocumento FROM perfil p INNER JOIN controle c on c.idcontrole = p.idcontrole INNER JOIN documento d on d.idcontrole = c.idcontrole WHERE 1=1 ", str9);
+ sqlCommand.CommandText = str22 ?? "";
+ using (SqlDataAdapter sqlDataAdapter12 = new SqlDataAdapter())
+ {
+ sqlDataAdapter12.SelectCommand = sqlCommand;
+ sqlDataAdapter12.Fill(table);
+ }
+ dataTable19.Merge(table);
+ nums1 = (nums2.Count < 2100 ? new List<long>() : i1.Except<long>(nums2).ToList<long>());
+ }
+ }
+ }
+ if (dataTable.Rows.Count == 0)
+ {
+ return new List<PlanilhaCompleta>();
+ }
+ List<PlanilhaCompleta> planilhaCompletas = new List<PlanilhaCompleta>();
+ dataTable.AsEnumerable().ToList<DataRow>().ForEach((DataRow x) => {
+ decimal? nullable;
+ decimal? nullable1;
+ decimal? nullable2;
+ decimal? nullable3;
+ decimal? nullable4;
+ decimal? nullable5;
+ decimal? nullable6;
+ decimal? nullable7;
+ decimal num;
+ DateTime? nullable8;
+ long? nullable9;
+ string nome;
+ decimal? nullable10;
+ decimal? nullable11;
+ decimal? nullable12;
+ decimal? nullable13;
+ decimal? nullable14;
+ decimal? nullable15;
+ string str;
+ DateTime? nullable16;
+ DateTime? nullable17;
+ DateTime? nullable18;
+ DateTime? nullable19;
+ decimal? nullable20;
+ decimal? nullable21;
+ decimal? nullable22;
+ int? nullable23;
+ decimal? nullable24;
+ object empty;
+ object obj;
+ object empty1;
+ object obj1;
+ object empty2;
+ DateTime? nullable25;
+ string nome1;
+ DateTime? nullable26;
+ DateTime? nullable27;
+ DateTime? nullable28;
+ DateTime? nullable29;
+ DateTime? nullable30;
+ DateTime? nullable31;
+ DateTime? nullable32;
+ DateTime? nullable33;
+ string description;
+ string description1;
+ string str1;
+ decimal? nullable34;
+ decimal? nullable35;
+ string description2;
+ string str2;
+ DateTime? nullable36;
+ DateTime? nullable37;
+ decimal? nullable38;
+ decimal? nullable39;
+ int? nullable40;
+ int? nullable41;
+ int? nullable42;
+ long? nullable43;
+ DateTime? nullable44;
+ decimal? nullable45;
+ decimal? nullable46;
+ int? nullable47;
+ int? nullable48;
+ decimal? nullable49;
+ decimal? nullable50;
+ DateTime? nullable51;
+ DateTime? nullable52;
+ DateTime? nullable53;
+ decimal? nullable54;
+ decimal? nullable55;
+ decimal? nullable56;
+ decimal? nullable57;
+ decimal? nullable58;
+ decimal? nullable59;
+ decimal? nullable60;
+ decimal? nullable61;
+ decimal? nullable62;
+ decimal? nullable63;
+ decimal? nullable64;
+ decimal? nullable65;
+ decimal? nullable66;
+ decimal? nullable67;
+ decimal? nullable68;
+ decimal? nullable69;
+ decimal? nullable70;
+ decimal? nullable71;
+ try
+ {
+ DataRow dataRow = dataTable16.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("idcontrole") == x.Field<long>("idcontrole"));
+ List<DataRow> list = dataTable2.AsEnumerable().Where<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento")).Take<DataRow>(3).ToList<DataRow>();
+ List<DataRow> dataRows = dataTable3.AsEnumerable().Where<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento")).Take<DataRow>(2).ToList<DataRow>();
+ DataRow dataRow1 = dataTable4.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento"));
+ DataRow dataRow2 = dataTable5.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento"));
+ List<DataRow> list1 = dataTable6.AsEnumerable().Where<DataRow>((DataRow e) => e.Field<long>("idcontrole") == x.Field<long>("idcontrole")).ToList<DataRow>();
+ bool count = list1.Count != 1;
+ DataRow dataRow3 = (count ? null : dataTable9.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow4 = (count ? null : dataTable10.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow5 = (count ? null : dataTable11.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow6 = (count ? null : dataTable12.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow7 = (count ? null : dataTable13.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow8 = (count ? null : dataTable14.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ DataRow dataRow9 = (count ? null : dataTable8.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem")));
+ NegocioCorretora negocioCorretora = (x.Field<object>("negociocorretora") == null ? ((TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field<object>("situacao").ToString()) != TipoSeguro.Renovacao || x.Field<object>("idnegocio") == null || !(x.Field<object>("idnegocio").ToString() == "1") ? NegocioCorretora.Novo : NegocioCorretora.Proprio) : (NegocioCorretora)Enum.Parse(typeof(NegocioCorretora), x.Field<object>("negociocorretora").ToString()));
+ EnumerableRowCollection<DataRow> dataRows1 = dataTable1.AsEnumerable().Where<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento"));
+ string str3 = (x.Field<object>("situacao") == null || !(x.Field<object>("situacao").ToString() != "") || string.IsNullOrWhiteSpace(x.Field<object>("situacao").ToString()) ? null : ((TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field<object>("situacao").ToString())).GetDescription<TipoSeguro>());
+ string str4 = (x.Field<object>("sexo") == null || !(x.Field<object>("sexo").ToString() != "") || string.IsNullOrWhiteSpace(x.Field<object>("sexo").ToString()) ? "" : ((Sexo)Enum.Parse(typeof(Sexo), x.Field<object>("sexo").ToString())).GetDescription<Sexo>());
+ object obj2 = x.Field<object>("clibanco");
+ List<Banco> banco = Auxiliar.Banco;
+ List<Banco> bancos = banco;
+ Predicate<Banco> u003cu003e9_217 = ReportRepository.u003cu003ec.u003cu003e9__2_17;
+ if (u003cu003e9_217 == null)
+ {
+ u003cu003e9_217 = (Banco y) => y == null;
+ ReportRepository.u003cu003ec.u003cu003e9__2_17 = u003cu003e9_217;
+ }
+ bancos.RemoveAll(u003cu003e9_217);
+ if (obj2 == null || string.IsNullOrWhiteSpace(obj2.ToString()))
+ {
+ nome = "";
+ }
+ else
+ {
+ Banco banco1 = banco.FirstOrDefault<Banco>((Banco b) => b.Id == int.Parse(obj2.ToString()));
+ if (banco1 != null)
+ {
+ nome = banco1.Nome;
+ }
+ else
+ {
+ nome = null;
+ }
+ }
+ string str5 = nome;
+ string str6 = "";
+ if (dataRow9 != null && dataRow9.Field<string>("observacao") != null)
+ {
+ str6 = (new Regex("<title>.*<\\/title>")).Replace((dataRow9 != null ? dataRow9.Field<string>("observacao") : null), "").Trim();
+ str6 = (new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)")).Replace(str6, "").Trim();
+ }
+ if (dataRow3 == null || dataRow3.Field<object>("bonus") == null)
+ {
+ nullable5 = null;
+ nullable10 = nullable5;
+ }
+ else
+ {
+ nullable10 = new decimal?(decimal.Parse(dataRow3.Field<object>("bonus").ToString()));
+ }
+ decimal? nullable72 = nullable10;
+ DataRow dataRow10 = dataTable15.AsEnumerable().FirstOrDefault<DataRow>((DataRow v) => v.Field<long>("idcliente1") == x.Field<long>("idcliente")) ?? dataTable15.AsEnumerable().FirstOrDefault<DataRow>((DataRow v) => v.Field<long>("idcliente2") == x.Field<long>("idcliente"));
+ DataRow dataRow11 = dataTable17.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento"));
+ EnumerableRowCollection<DataRow> dataRows2 = dataTable18.AsEnumerable().Where<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem"));
+ Cobertura cobertura = new Cobertura();
+ if (list1.Count > 0)
+ {
+ EnumerableRowCollection<DataRow> dataRows3 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_223 = ReportRepository.u003cu003ec.u003cu003e9__2_23;
+ if (u003cu003e9_223 == null)
+ {
+ u003cu003e9_223 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)3;
+ ReportRepository.u003cu003ec.u003cu003e9__2_23 = u003cu003e9_223;
+ }
+ if (dataRows3.Where<DataRow>(u003cu003e9_223).AsEnumerable<DataRow>().ToList<DataRow>().Count > 0)
+ {
+ Cobertura valueOrDefault = new Cobertura();
+ EnumerableRowCollection<DataRow> dataRows4 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_234 = ReportRepository.u003cu003ec.u003cu003e9__2_34;
+ if (u003cu003e9_234 == null)
+ {
+ u003cu003e9_234 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)3;
+ ReportRepository.u003cu003ec.u003cu003e9__2_34 = u003cu003e9_234;
+ }
+ nullable5 = dataRows4.FirstOrDefault<DataRow>(u003cu003e9_234).Field<decimal?>("franquia");
+ valueOrDefault.Franquia = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows5 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_235 = ReportRepository.u003cu003ec.u003cu003e9__2_35;
+ if (u003cu003e9_235 == null)
+ {
+ u003cu003e9_235 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)3;
+ ReportRepository.u003cu003ec.u003cu003e9__2_35 = u003cu003e9_235;
+ }
+ nullable5 = dataRows5.FirstOrDefault<DataRow>(u003cu003e9_235).Field<decimal?>("premio");
+ valueOrDefault.Premio = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows6 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_236 = ReportRepository.u003cu003ec.u003cu003e9__2_36;
+ if (u003cu003e9_236 == null)
+ {
+ u003cu003e9_236 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)3;
+ ReportRepository.u003cu003ec.u003cu003e9__2_36 = u003cu003e9_236;
+ }
+ nullable5 = dataRows6.FirstOrDefault<DataRow>(u003cu003e9_236).Field<decimal?>("lmi");
+ valueOrDefault.Lmi = nullable5.GetValueOrDefault();
+ cobertura = valueOrDefault;
+ }
+ }
+ Cobertura cobertura1 = new Cobertura();
+ if (list1.Count > 0)
+ {
+ EnumerableRowCollection<DataRow> dataRows7 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_224 = ReportRepository.u003cu003ec.u003cu003e9__2_24;
+ if (u003cu003e9_224 == null)
+ {
+ u003cu003e9_224 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)2;
+ ReportRepository.u003cu003ec.u003cu003e9__2_24 = u003cu003e9_224;
+ }
+ if (dataRows7.Where<DataRow>(u003cu003e9_224).AsEnumerable<DataRow>().ToList<DataRow>().Count > 0)
+ {
+ Cobertura valueOrDefault1 = new Cobertura();
+ EnumerableRowCollection<DataRow> dataRows8 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_237 = ReportRepository.u003cu003ec.u003cu003e9__2_37;
+ if (u003cu003e9_237 == null)
+ {
+ u003cu003e9_237 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)2;
+ ReportRepository.u003cu003ec.u003cu003e9__2_37 = u003cu003e9_237;
+ }
+ nullable5 = dataRows8.FirstOrDefault<DataRow>(u003cu003e9_237).Field<decimal?>("franquia");
+ valueOrDefault1.Franquia = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows9 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_238 = ReportRepository.u003cu003ec.u003cu003e9__2_38;
+ if (u003cu003e9_238 == null)
+ {
+ u003cu003e9_238 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)2;
+ ReportRepository.u003cu003ec.u003cu003e9__2_38 = u003cu003e9_238;
+ }
+ nullable5 = dataRows9.FirstOrDefault<DataRow>(u003cu003e9_238).Field<decimal?>("premio");
+ valueOrDefault1.Premio = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows10 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_239 = ReportRepository.u003cu003ec.u003cu003e9__2_39;
+ if (u003cu003e9_239 == null)
+ {
+ u003cu003e9_239 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)2;
+ ReportRepository.u003cu003ec.u003cu003e9__2_39 = u003cu003e9_239;
+ }
+ nullable5 = dataRows10.FirstOrDefault<DataRow>(u003cu003e9_239).Field<decimal?>("lmi");
+ valueOrDefault1.Lmi = nullable5.GetValueOrDefault();
+ cobertura1 = valueOrDefault1;
+ }
+ }
+ Cobertura cobertura2 = new Cobertura();
+ if (list1.Count > 0)
+ {
+ EnumerableRowCollection<DataRow> dataRows11 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_225 = ReportRepository.u003cu003ec.u003cu003e9__2_25;
+ if (u003cu003e9_225 == null)
+ {
+ u003cu003e9_225 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)17;
+ ReportRepository.u003cu003ec.u003cu003e9__2_25 = u003cu003e9_225;
+ }
+ if (dataRows11.Where<DataRow>(u003cu003e9_225).AsEnumerable<DataRow>().ToList<DataRow>().Count > 0)
+ {
+ Cobertura valueOrDefault2 = new Cobertura();
+ EnumerableRowCollection<DataRow> dataRows12 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_240 = ReportRepository.u003cu003ec.u003cu003e9__2_40;
+ if (u003cu003e9_240 == null)
+ {
+ u003cu003e9_240 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)17;
+ ReportRepository.u003cu003ec.u003cu003e9__2_40 = u003cu003e9_240;
+ }
+ nullable5 = dataRows12.FirstOrDefault<DataRow>(u003cu003e9_240).Field<decimal?>("franquia");
+ valueOrDefault2.Franquia = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows13 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_241 = ReportRepository.u003cu003ec.u003cu003e9__2_41;
+ if (u003cu003e9_241 == null)
+ {
+ u003cu003e9_241 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)17;
+ ReportRepository.u003cu003ec.u003cu003e9__2_41 = u003cu003e9_241;
+ }
+ nullable5 = dataRows13.FirstOrDefault<DataRow>(u003cu003e9_241).Field<decimal?>("premio");
+ valueOrDefault2.Premio = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows14 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_242 = ReportRepository.u003cu003ec.u003cu003e9__2_42;
+ if (u003cu003e9_242 == null)
+ {
+ u003cu003e9_242 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)17;
+ ReportRepository.u003cu003ec.u003cu003e9__2_42 = u003cu003e9_242;
+ }
+ nullable5 = dataRows14.FirstOrDefault<DataRow>(u003cu003e9_242).Field<decimal?>("lmi");
+ valueOrDefault2.Lmi = nullable5.GetValueOrDefault();
+ cobertura2 = valueOrDefault2;
+ }
+ }
+ Cobertura cobertura3 = new Cobertura();
+ if (list1.Count > 0)
+ {
+ EnumerableRowCollection<DataRow> dataRows15 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_226 = ReportRepository.u003cu003ec.u003cu003e9__2_26;
+ if (u003cu003e9_226 == null)
+ {
+ u003cu003e9_226 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)5;
+ ReportRepository.u003cu003ec.u003cu003e9__2_26 = u003cu003e9_226;
+ }
+ if (dataRows15.Where<DataRow>(u003cu003e9_226).AsEnumerable<DataRow>().ToList<DataRow>().Count > 0)
+ {
+ Cobertura valueOrDefault3 = new Cobertura();
+ EnumerableRowCollection<DataRow> dataRows16 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_243 = ReportRepository.u003cu003ec.u003cu003e9__2_43;
+ if (u003cu003e9_243 == null)
+ {
+ u003cu003e9_243 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)5;
+ ReportRepository.u003cu003ec.u003cu003e9__2_43 = u003cu003e9_243;
+ }
+ nullable5 = dataRows16.FirstOrDefault<DataRow>(u003cu003e9_243).Field<decimal?>("franquia");
+ valueOrDefault3.Franquia = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows17 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_244 = ReportRepository.u003cu003ec.u003cu003e9__2_44;
+ if (u003cu003e9_244 == null)
+ {
+ u003cu003e9_244 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)5;
+ ReportRepository.u003cu003ec.u003cu003e9__2_44 = u003cu003e9_244;
+ }
+ nullable5 = dataRows17.FirstOrDefault<DataRow>(u003cu003e9_244).Field<decimal?>("premio");
+ valueOrDefault3.Premio = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows18 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_245 = ReportRepository.u003cu003ec.u003cu003e9__2_45;
+ if (u003cu003e9_245 == null)
+ {
+ u003cu003e9_245 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)5;
+ ReportRepository.u003cu003ec.u003cu003e9__2_45 = u003cu003e9_245;
+ }
+ nullable5 = dataRows18.FirstOrDefault<DataRow>(u003cu003e9_245).Field<decimal?>("lmi");
+ valueOrDefault3.Lmi = nullable5.GetValueOrDefault();
+ cobertura3 = valueOrDefault3;
+ }
+ }
+ Cobertura cobertura4 = new Cobertura();
+ if (list1.Count > 0)
+ {
+ EnumerableRowCollection<DataRow> dataRows19 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_227 = ReportRepository.u003cu003ec.u003cu003e9__2_27;
+ if (u003cu003e9_227 == null)
+ {
+ u003cu003e9_227 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)7;
+ ReportRepository.u003cu003ec.u003cu003e9__2_27 = u003cu003e9_227;
+ }
+ if (dataRows19.Where<DataRow>(u003cu003e9_227).AsEnumerable<DataRow>().ToList<DataRow>().Count > 0)
+ {
+ Cobertura valueOrDefault4 = new Cobertura();
+ EnumerableRowCollection<DataRow> dataRows20 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_246 = ReportRepository.u003cu003ec.u003cu003e9__2_46;
+ if (u003cu003e9_246 == null)
+ {
+ u003cu003e9_246 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)7;
+ ReportRepository.u003cu003ec.u003cu003e9__2_46 = u003cu003e9_246;
+ }
+ valueOrDefault4.Observacao = dataRows20.FirstOrDefault<DataRow>(u003cu003e9_246).Field<string>("observacao") ?? "";
+ EnumerableRowCollection<DataRow> dataRows21 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_247 = ReportRepository.u003cu003ec.u003cu003e9__2_47;
+ if (u003cu003e9_247 == null)
+ {
+ u003cu003e9_247 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)7;
+ ReportRepository.u003cu003ec.u003cu003e9__2_47 = u003cu003e9_247;
+ }
+ nullable5 = dataRows21.FirstOrDefault<DataRow>(u003cu003e9_247).Field<decimal?>("franquia");
+ valueOrDefault4.Franquia = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows22 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_248 = ReportRepository.u003cu003ec.u003cu003e9__2_48;
+ if (u003cu003e9_248 == null)
+ {
+ u003cu003e9_248 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)7;
+ ReportRepository.u003cu003ec.u003cu003e9__2_48 = u003cu003e9_248;
+ }
+ nullable5 = dataRows22.FirstOrDefault<DataRow>(u003cu003e9_248).Field<decimal?>("premio");
+ valueOrDefault4.Premio = nullable5.GetValueOrDefault();
+ EnumerableRowCollection<DataRow> dataRows23 = dataRows2;
+ Func<DataRow, bool> u003cu003e9_249 = ReportRepository.u003cu003ec.u003cu003e9__2_49;
+ if (u003cu003e9_249 == null)
+ {
+ u003cu003e9_249 = (DataRow v) => v.Field<long>("idcoberturapadrao") == (long)7;
+ ReportRepository.u003cu003ec.u003cu003e9__2_49 = u003cu003e9_249;
+ }
+ nullable5 = dataRows23.FirstOrDefault<DataRow>(u003cu003e9_249).Field<decimal?>("lmi");
+ valueOrDefault4.Lmi = nullable5.GetValueOrDefault();
+ cobertura4 = valueOrDefault4;
+ }
+ }
+ IEnumerable<DataRow> list2 =
+ from e in dataTable16.AsEnumerable().ToList<DataRow>()
+ where e.Field<long>("idcontrole") == x.Field<long>("idcontrole")
+ select e;
+ if (!configSomaPremio)
+ {
+ nullable6 = x.Field<decimal?>("pr_liq");
+ if (nullable6.HasValue)
+ {
+ nullable11 = x.Field<decimal?>("pr_liq");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable11 = nullable6;
+ }
+ nullable = nullable11;
+ nullable6 = x.Field<decimal?>("pr_adic");
+ if (nullable6.HasValue)
+ {
+ nullable12 = x.Field<decimal?>("pr_adic");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable12 = nullable6;
+ }
+ nullable1 = nullable12;
+ nullable6 = x.Field<decimal?>("pr_custo");
+ if (nullable6.HasValue)
+ {
+ nullable13 = x.Field<decimal?>("pr_custo");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable13 = nullable6;
+ }
+ nullable2 = nullable13;
+ nullable6 = x.Field<decimal?>("pr_iof");
+ if (nullable6.HasValue)
+ {
+ nullable14 = x.Field<decimal?>("pr_iof");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable14 = nullable6;
+ }
+ nullable3 = nullable14;
+ nullable6 = x.Field<decimal?>("pr_total");
+ if (nullable6.HasValue)
+ {
+ nullable15 = x.Field<decimal?>("pr_total");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable15 = nullable6;
+ }
+ nullable4 = nullable15;
+ }
+ else
+ {
+ IEnumerable<DataRow> dataRows24 = list2;
+ Func<DataRow, bool> u003cu003e9_250 = ReportRepository.u003cu003ec.u003cu003e9__2_50;
+ if (u003cu003e9_250 == null)
+ {
+ u003cu003e9_250 = (DataRow z) => z.Field<decimal?>("pr_liq").HasValue;
+ ReportRepository.u003cu003ec.u003cu003e9__2_50 = u003cu003e9_250;
+ }
+ IEnumerable<DataRow> dataRows25 = dataRows24.Where<DataRow>(u003cu003e9_250);
+ if (dataRows25 != null)
+ {
+ Func<DataRow, decimal?> u003cu003e9_251 = ReportRepository.u003cu003ec.u003cu003e9__2_51;
+ if (u003cu003e9_251 == null)
+ {
+ u003cu003e9_251 = (DataRow y) => y.Field<decimal?>("pr_liq");
+ ReportRepository.u003cu003ec.u003cu003e9__2_51 = u003cu003e9_251;
+ }
+ nullable62 = dataRows25.Sum<DataRow>(u003cu003e9_251);
+ }
+ else
+ {
+ nullable7 = null;
+ nullable62 = nullable7;
+ }
+ nullable5 = nullable62;
+ nullable6 = x.Field<decimal?>("pr_liq");
+ if (nullable5.HasValue & nullable6.HasValue)
+ {
+ nullable63 = new decimal?(nullable5.GetValueOrDefault() + nullable6.GetValueOrDefault());
+ }
+ else
+ {
+ nullable7 = null;
+ nullable63 = nullable7;
+ }
+ nullable = nullable63;
+ IEnumerable<DataRow> dataRows26 = list2;
+ Func<DataRow, bool> u003cu003e9_252 = ReportRepository.u003cu003ec.u003cu003e9__2_52;
+ if (u003cu003e9_252 == null)
+ {
+ u003cu003e9_252 = (DataRow z) => z.Field<decimal?>("pr_adic").HasValue;
+ ReportRepository.u003cu003ec.u003cu003e9__2_52 = u003cu003e9_252;
+ }
+ IEnumerable<DataRow> dataRows27 = dataRows26.Where<DataRow>(u003cu003e9_252);
+ if (dataRows27 != null)
+ {
+ Func<DataRow, decimal?> u003cu003e9_253 = ReportRepository.u003cu003ec.u003cu003e9__2_53;
+ if (u003cu003e9_253 == null)
+ {
+ u003cu003e9_253 = (DataRow y) => y.Field<decimal?>("pr_adic");
+ ReportRepository.u003cu003ec.u003cu003e9__2_53 = u003cu003e9_253;
+ }
+ nullable64 = dataRows27.Sum<DataRow>(u003cu003e9_253);
+ }
+ else
+ {
+ nullable7 = null;
+ nullable64 = nullable7;
+ }
+ nullable6 = nullable64;
+ nullable5 = x.Field<decimal?>("pr_adic");
+ if (nullable6.HasValue & nullable5.HasValue)
+ {
+ nullable65 = new decimal?(nullable6.GetValueOrDefault() + nullable5.GetValueOrDefault());
+ }
+ else
+ {
+ nullable7 = null;
+ nullable65 = nullable7;
+ }
+ nullable1 = nullable65;
+ IEnumerable<DataRow> dataRows28 = list2;
+ Func<DataRow, bool> u003cu003e9_254 = ReportRepository.u003cu003ec.u003cu003e9__2_54;
+ if (u003cu003e9_254 == null)
+ {
+ u003cu003e9_254 = (DataRow z) => z.Field<decimal?>("pr_custo").HasValue;
+ ReportRepository.u003cu003ec.u003cu003e9__2_54 = u003cu003e9_254;
+ }
+ IEnumerable<DataRow> dataRows29 = dataRows28.Where<DataRow>(u003cu003e9_254);
+ if (dataRows29 != null)
+ {
+ Func<DataRow, decimal?> u003cu003e9_255 = ReportRepository.u003cu003ec.u003cu003e9__2_55;
+ if (u003cu003e9_255 == null)
+ {
+ u003cu003e9_255 = (DataRow y) => y.Field<decimal?>("pr_custo");
+ ReportRepository.u003cu003ec.u003cu003e9__2_55 = u003cu003e9_255;
+ }
+ nullable66 = dataRows29.Sum<DataRow>(u003cu003e9_255);
+ }
+ else
+ {
+ nullable7 = null;
+ nullable66 = nullable7;
+ }
+ nullable5 = nullable66;
+ nullable6 = x.Field<decimal?>("pr_custo");
+ if (nullable5.HasValue & nullable6.HasValue)
+ {
+ nullable67 = new decimal?(nullable5.GetValueOrDefault() + nullable6.GetValueOrDefault());
+ }
+ else
+ {
+ nullable7 = null;
+ nullable67 = nullable7;
+ }
+ nullable2 = nullable67;
+ IEnumerable<DataRow> dataRows30 = list2;
+ Func<DataRow, bool> u003cu003e9_256 = ReportRepository.u003cu003ec.u003cu003e9__2_56;
+ if (u003cu003e9_256 == null)
+ {
+ u003cu003e9_256 = (DataRow z) => z.Field<decimal?>("pr_iof").HasValue;
+ ReportRepository.u003cu003ec.u003cu003e9__2_56 = u003cu003e9_256;
+ }
+ IEnumerable<DataRow> dataRows31 = dataRows30.Where<DataRow>(u003cu003e9_256);
+ if (dataRows31 != null)
+ {
+ Func<DataRow, decimal?> u003cu003e9_257 = ReportRepository.u003cu003ec.u003cu003e9__2_57;
+ if (u003cu003e9_257 == null)
+ {
+ u003cu003e9_257 = (DataRow y) => y.Field<decimal?>("pr_iof");
+ ReportRepository.u003cu003ec.u003cu003e9__2_57 = u003cu003e9_257;
+ }
+ nullable68 = dataRows31.Sum<DataRow>(u003cu003e9_257);
+ }
+ else
+ {
+ nullable7 = null;
+ nullable68 = nullable7;
+ }
+ nullable6 = nullable68;
+ nullable5 = x.Field<decimal?>("pr_iof");
+ if (nullable6.HasValue & nullable5.HasValue)
+ {
+ nullable69 = new decimal?(nullable6.GetValueOrDefault() + nullable5.GetValueOrDefault());
+ }
+ else
+ {
+ nullable7 = null;
+ nullable69 = nullable7;
+ }
+ nullable3 = nullable69;
+ IEnumerable<DataRow> dataRows32 = list2;
+ Func<DataRow, bool> u003cu003e9_258 = ReportRepository.u003cu003ec.u003cu003e9__2_58;
+ if (u003cu003e9_258 == null)
+ {
+ u003cu003e9_258 = (DataRow z) => z.Field<decimal?>("pr_total").HasValue;
+ ReportRepository.u003cu003ec.u003cu003e9__2_58 = u003cu003e9_258;
+ }
+ IEnumerable<DataRow> dataRows33 = dataRows32.Where<DataRow>(u003cu003e9_258);
+ if (dataRows33 != null)
+ {
+ Func<DataRow, decimal?> u003cu003e9_259 = ReportRepository.u003cu003ec.u003cu003e9__2_59;
+ if (u003cu003e9_259 == null)
+ {
+ u003cu003e9_259 = (DataRow y) => y.Field<decimal?>("pr_total");
+ ReportRepository.u003cu003ec.u003cu003e9__2_59 = u003cu003e9_259;
+ }
+ nullable70 = dataRows33.Sum<DataRow>(u003cu003e9_259);
+ }
+ else
+ {
+ nullable7 = null;
+ nullable70 = nullable7;
+ }
+ nullable5 = nullable70;
+ nullable6 = x.Field<decimal?>("pr_total");
+ if (nullable5.HasValue & nullable6.HasValue)
+ {
+ nullable71 = new decimal?(nullable5.GetValueOrDefault() + nullable6.GetValueOrDefault());
+ }
+ else
+ {
+ nullable7 = null;
+ nullable71 = nullable7;
+ }
+ nullable4 = nullable71;
+ }
+ int num1 = dataTable16.AsEnumerable().Count<DataRow>((DataRow e) => e.Field<long>("idcontrole") == x.Field<long>("idcontrole"));
+ int num2 = dataTable7.AsEnumerable().Count<DataRow>((DataRow s) => s.Field<long>("id") == x.Field<long>("idcontrole"));
+ DataRow dataRow12 = dataTable19.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iddocumento") == x.Field<long>("iddocumento"));
+ string str7 = ((dataRow12 != null ? dataRow12.Field<object>("sexo") == null : true) ? "" : (dataRow12.Field<object>("sexo").ToString() == "2" ? Sexo.Feminino.GetDescription<Sexo>() : (dataRow12.Field<object>("sexo").ToString() == "1" ? Sexo.Masculino.GetDescription<Sexo>() : "")));
+ if (x.Field<object>("idciasegant") == null)
+ {
+ str = "";
+ }
+ else
+ {
+ Seguradora seguradora = Auxiliar.Seguradoras.FirstOrDefault<Seguradora>((Seguradora ciaseg) => ciaseg.Id == x.Field<long>("idciasegant"));
+ if (seguradora != null)
+ {
+ str = seguradora.Nome;
+ }
+ else
+ {
+ str = null;
+ }
+ }
+ string str8 = str;
+ DataRow dataRow13 = dataTable20.AsEnumerable().FirstOrDefault<DataRow>((DataRow e) => e.Field<long>("iditem") == list1.First<DataRow>().Field<long>("iditem"));
+ PlanilhaCompleta planilhaCompletum = new PlanilhaCompleta()
+ {
+ NumeroProposta = x.Field<string>("proposta"),
+ NumeroApolice = x.Field<string>("contrato"),
+ NumeroPedidoEndosso = (!string.IsNullOrEmpty(x.Field<string>("pedadit")) || dataRow == null ? x.Field<string>("pedadit") : dataRow.Field<string>("pedadit")),
+ NumeroEndosso = (!string.IsNullOrEmpty(x.Field<string>("aditamento")) || dataRow == null ? x.Field<string>("aditamento") : dataRow.Field<string>("aditamento")),
+ Status = str3,
+ TipoRecebimento = TipoRecebimento.Parcela.GetDescription<TipoRecebimento>()
+ };
+ DateTime? nullable73 = x.Field<DateTime?>("emissao");
+ if (nullable73.HasValue)
+ {
+ nullable16 = x.Field<DateTime?>("emissao");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable16 = nullable73;
+ }
+ planilhaCompletum.Emissao = nullable16;
+ nullable73 = x.Field<DateTime?>("vigencia1");
+ if (nullable73.HasValue)
+ {
+ nullable17 = x.Field<DateTime?>("vigencia1");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable17 = nullable73;
+ }
+ planilhaCompletum.VigenciaInicial = nullable17;
+ nullable73 = x.Field<DateTime?>("vigencia2");
+ if (nullable73.HasValue)
+ {
+ nullable18 = x.Field<DateTime?>("vigencia2");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable18 = nullable73;
+ }
+ planilhaCompletum.VigenciaFinal = nullable18;
+ nullable73 = x.Field<DateTime?>("remessa");
+ if (nullable73.HasValue)
+ {
+ nullable19 = x.Field<DateTime?>("remessa");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable19 = nullable73;
+ }
+ planilhaCompletum.Remessa = nullable19;
+ nullable6 = x.Field<decimal?>("com01");
+ if (nullable6.HasValue)
+ {
+ nullable20 = x.Field<decimal?>("com01");
+ }
+ else
+ {
+ nullable6 = null;
+ nullable20 = nullable6;
+ }
+ planilhaCompletum.Comissao = nullable20;
+ planilhaCompletum.AdicionalComiss = x.Field<string>("adinacomis") == "1";
+ nullable7 = nullable;
+ if (x.Field<string>("adinacomis") == "1")
+ {
+ nullable21 = nullable1;
+ }
+ else
+ {
+ num = new decimal();
+ nullable21 = new decimal?(num);
+ }
+ decimal? nullable74 = nullable21;
+ nullable6 = (nullable7.HasValue & nullable74.HasValue ? new decimal?(nullable7.GetValueOrDefault() + nullable74.GetValueOrDefault()) : null);
+ nullable5 = x.Field<decimal?>("com01");
+ if (nullable6.HasValue & nullable5.HasValue)
+ {
+ nullable22 = new decimal?((nullable6.GetValueOrDefault() * nullable5.GetValueOrDefault()) * new decimal(1, 0, 0, false, 2));
+ }
+ else
+ {
+ nullable74 = null;
+ nullable22 = nullable74;
+ }
+ planilhaCompletum.ComissaoGerada = nullable22;
+ planilhaCompletum.PremioLiquido = new decimal?(nullable.GetValueOrDefault());
+ planilhaCompletum.PremioAdicional = new decimal?(nullable1.GetValueOrDefault());
+ planilhaCompletum.PremioCusto = new decimal?(nullable2.GetValueOrDefault());
+ num = new decimal();
+ planilhaCompletum.LiquidoFatura = new decimal?(num);
+ num = new decimal();
+ planilhaCompletum.TotalFatura = new decimal?(num);
+ planilhaCompletum.Iof = new decimal?(nullable3.GetValueOrDefault());
+ planilhaCompletum.PremioTotal = nullable4;
+ int? nullable75 = x.Field<int?>("n_parc");
+ if (nullable75.HasValue)
+ {
+ nullable23 = x.Field<int?>("n_parc");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable23 = nullable75;
+ }
+ planilhaCompletum.NumParcelas = nullable23;
+ nullable75 = x.Field<int?>("n_parc");
+ if (!nullable75.HasValue || x.Field<int>("n_parc") <= 0)
+ {
+ num = new decimal();
+ nullable24 = new decimal?(num);
+ }
+ else
+ {
+ nullable5 = x.Field<decimal?>("pr_total");
+ num = x.Field<int>("n_parc");
+ if (nullable5.HasValue)
+ {
+ nullable24 = new decimal?(nullable5.GetValueOrDefault() / num);
+ }
+ else
+ {
+ nullable6 = null;
+ nullable24 = nullable6;
+ }
+ }
+ planilhaCompletum.ValorParcela = nullable24;
+ planilhaCompletum.FormaPagamento = (x.Field<object>("formapagamento") == null || !(x.Field<object>("formapagamento").ToString() != "") || string.IsNullOrWhiteSpace(x.Field<object>("formapagamento").ToString()) ? null : ((FormaPagamento)Enum.Parse(typeof(FormaPagamento), x.Field<object>("formapagamento").ToString())).GetDescription<FormaPagamento>());
+ planilhaCompletum.Negocio = negocioCorretora.GetDescription<NegocioCorretora>();
+ if (dataRows1 != null)
+ {
+ EnumerableRowCollection<DataRow> dataRows34 = dataRows1;
+ Func<DataRow, bool> u003cu003e9_260 = ReportRepository.u003cu003ec.u003cu003e9__2_60;
+ if (u003cu003e9_260 == null)
+ {
+ u003cu003e9_260 = (DataRow e) => e.Field<string>("index").Equals("1");
+ ReportRepository.u003cu003ec.u003cu003e9__2_60 = u003cu003e9_260;
+ }
+ DataRow dataRow14 = dataRows34.FirstOrDefault<DataRow>(u003cu003e9_260);
+ if (dataRow14 != null)
+ {
+ empty = dataRow14.Field<string>("nomeEstipulante");
+ }
+ else
+ {
+ empty = null;
+ }
+ }
+ else
+ {
+ empty = null;
+ }
+ if (empty == null)
+ {
+ empty = string.Empty;
+ }
+ planilhaCompletum.Estipulante = (string)empty;
+ if (dataRows1 != null)
+ {
+ EnumerableRowCollection<DataRow> dataRows35 = dataRows1;
+ Func<DataRow, bool> u003cu003e9_261 = ReportRepository.u003cu003ec.u003cu003e9__2_61;
+ if (u003cu003e9_261 == null)
+ {
+ u003cu003e9_261 = (DataRow e) => e.Field<string>("index").Equals("2");
+ ReportRepository.u003cu003ec.u003cu003e9__2_61 = u003cu003e9_261;
+ }
+ DataRow dataRow15 = dataRows35.FirstOrDefault<DataRow>(u003cu003e9_261);
+ if (dataRow15 != null)
+ {
+ obj = dataRow15.Field<string>("nomeEstipulante");
+ }
+ else
+ {
+ obj = null;
+ }
+ }
+ else
+ {
+ obj = null;
+ }
+ if (obj == null)
+ {
+ obj = string.Empty;
+ }
+ planilhaCompletum.Estipulante2 = (string)obj;
+ if (dataRows1 != null)
+ {
+ EnumerableRowCollection<DataRow> dataRows36 = dataRows1;
+ Func<DataRow, bool> u003cu003e9_262 = ReportRepository.u003cu003ec.u003cu003e9__2_62;
+ if (u003cu003e9_262 == null)
+ {
+ u003cu003e9_262 = (DataRow e) => e.Field<string>("index").Equals("3");
+ ReportRepository.u003cu003ec.u003cu003e9__2_62 = u003cu003e9_262;
+ }
+ DataRow dataRow16 = dataRows36.FirstOrDefault<DataRow>(u003cu003e9_262);
+ if (dataRow16 != null)
+ {
+ empty1 = dataRow16.Field<string>("nomeEstipulante");
+ }
+ else
+ {
+ empty1 = null;
+ }
+ }
+ else
+ {
+ empty1 = null;
+ }
+ if (empty1 == null)
+ {
+ empty1 = string.Empty;
+ }
+ planilhaCompletum.Estipulante3 = (string)empty1;
+ if (dataRows1 != null)
+ {
+ EnumerableRowCollection<DataRow> dataRows37 = dataRows1;
+ Func<DataRow, bool> u003cu003e9_263 = ReportRepository.u003cu003ec.u003cu003e9__2_63;
+ if (u003cu003e9_263 == null)
+ {
+ u003cu003e9_263 = (DataRow e) => e.Field<string>("index").Equals("4");
+ ReportRepository.u003cu003ec.u003cu003e9__2_63 = u003cu003e9_263;
+ }
+ DataRow dataRow17 = dataRows37.FirstOrDefault<DataRow>(u003cu003e9_263);
+ if (dataRow17 != null)
+ {
+ obj1 = dataRow17.Field<string>("nomeEstipulante");
+ }
+ else
+ {
+ obj1 = null;
+ }
+ }
+ else
+ {
+ obj1 = null;
+ }
+ if (obj1 == null)
+ {
+ obj1 = string.Empty;
+ }
+ planilhaCompletum.Estipulante4 = (string)obj1;
+ if (dataRows1 != null)
+ {
+ EnumerableRowCollection<DataRow> dataRows38 = dataRows1;
+ Func<DataRow, bool> u003cu003e9_264 = ReportRepository.u003cu003ec.u003cu003e9__2_64;
+ if (u003cu003e9_264 == null)
+ {
+ u003cu003e9_264 = (DataRow e) => e.Field<string>("index").Equals("5");
+ ReportRepository.u003cu003ec.u003cu003e9__2_64 = u003cu003e9_264;
+ }
+ DataRow dataRow18 = dataRows38.FirstOrDefault<DataRow>(u003cu003e9_264);
+ if (dataRow18 != null)
+ {
+ empty2 = dataRow18.Field<string>("nomeEstipulante");
+ }
+ else
+ {
+ empty2 = null;
+ }
+ }
+ else
+ {
+ empty2 = null;
+ }
+ if (empty2 == null)
+ {
+ empty2 = string.Empty;
+ }
+ planilhaCompletum.Estipulante5 = (string)empty2;
+ planilhaCompletum.Vendedor = x.Field<string>("nomeVendedor");
+ planilhaCompletum.Produto = x.Field<string>("nomeProduto");
+ nullable73 = x.Field<DateTime?>("datacontrole");
+ if (nullable73.HasValue)
+ {
+ nullable25 = x.Field<DateTime?>("datacontrole");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable25 = nullable73;
+ }
+ planilhaCompletum.DataControle = nullable25;
+ planilhaCompletum.Seguradora = x.Field<string>("nomeCiaseg");
+ planilhaCompletum.Ramo = x.Field<string>("nomeRamo");
+ planilhaCompletum.SeguradoraAnterior = str8 ?? "";
+ planilhaCompletum.IdDocumento = x.Field<long>("iddocumento");
+ planilhaCompletum.ObservacaoDocumento = (x.Field<string>("obs") == null || x.Field<string>("obs").Length <= 30000 ? x.Field<string>("obs") : x.Field<string>("obs").Substring(0, 30000));
+ planilhaCompletum.NomeCliente = x.Field<string>("nome");
+ if (x.Field<object>("idprofissao") != null)
+ {
+ Profissao profissao = Auxiliar.Profissoes.FirstOrDefault<Profissao>((Profissao p) => p.Id == long.Parse(x.Field<object>("idprofissao").ToString()));
+ if (profissao != null)
+ {
+ nome1 = profissao.Nome;
+ }
+ else
+ {
+ nome1 = null;
+ }
+ }
+ else
+ {
+ nome1 = "";
+ }
+ planilhaCompletum.ProfissaoCliente = nome1;
+ nullable73 = x.Field<DateTime?>("dtnasc");
+ if (nullable73.HasValue)
+ {
+ nullable26 = x.Field<DateTime?>("dtnasc");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable26 = nullable73;
+ }
+ planilhaCompletum.NascimentoCliente = nullable26;
+ planilhaCompletum.SexoCliente = str4;
+ planilhaCompletum.EstadoCivilCliente = x.Field<string>("estadocivi");
+ planilhaCompletum.DocumentoCliente = x.Field<string>("cgccpf");
+ planilhaCompletum.IdentidadeCliente = x.Field<string>("rg");
+ planilhaCompletum.EmissorCliente = x.Field<string>("emissor");
+ planilhaCompletum.EstadoEmissorCliente = x.Field<string>("rguf");
+ nullable73 = x.Field<DateTime?>("rgexpedica");
+ if (nullable73.HasValue)
+ {
+ nullable27 = x.Field<DateTime?>("rgexpedica");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable27 = nullable73;
+ }
+ planilhaCompletum.ExpedicaoCliente = nullable27;
+ planilhaCompletum.HabilitacaoCliente = x.Field<string>("numehabili");
+ nullable73 = x.Field<DateTime?>("primehabil");
+ if (nullable73.HasValue)
+ {
+ nullable28 = x.Field<DateTime?>("primehabil");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable28 = nullable73;
+ }
+ planilhaCompletum.PrimeiraHabilitacaoCliente = nullable28;
+ nullable73 = x.Field<DateTime?>("venchabili");
+ if (nullable73.HasValue)
+ {
+ nullable29 = x.Field<DateTime?>("venchabili");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable29 = nullable73;
+ }
+ planilhaCompletum.VencimentoHabilitacaoCliente = nullable29;
+ planilhaCompletum.CategoriaHabilitacaoCliente = x.Field<string>("cathabili");
+ nullable73 = x.Field<DateTime?>("clidesde");
+ if (nullable73.HasValue)
+ {
+ nullable30 = x.Field<DateTime?>("clidesde");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable30 = nullable73;
+ }
+ planilhaCompletum.ClienteDesde = nullable30;
+ planilhaCompletum.PastaCliente = x.Field<string>("pasta");
+ planilhaCompletum.CeiCliente = x.Field<string>("cei");
+ planilhaCompletum.RneCliente = x.Field<string>("rne");
+ planilhaCompletum.FalecidoCliente = (!x.Field<bool?>("falecido").HasValue || !x.Field<bool?>("falecido").GetValueOrDefault() ? "NÃO" : "SIM");
+ planilhaCompletum.ObservacaoCliente = (x.Field<string>("anotacoes") == null || x.Field<string>("anotacoes").Length <= 30000 ? x.Field<string>("anotacoes") : x.Field<string>("anotacoes").Substring(0, 30000));
+ planilhaCompletum.Prefixo1 = (list == null || list.Count <= 0 ? "" : list[0].Field<string>("ddd"));
+ planilhaCompletum.Telefone1 = (list == null || list.Count <= 0 ? "" : list[0].Field<string>("fone"));
+ planilhaCompletum.Prefixo2 = (list == null || list.Count <= 1 ? "" : list[1].Field<string>("ddd"));
+ planilhaCompletum.Telefone2 = (list == null || list.Count <= 1 ? "" : list[1].Field<string>("fone"));
+ planilhaCompletum.Prefixo3 = (list == null || list.Count <= 2 ? "" : list[2].Field<string>("ddd"));
+ planilhaCompletum.Telefone3 = (list == null || list.Count <= 2 ? "" : list[2].Field<string>("fone"));
+ planilhaCompletum.Email1 = (dataRows == null || dataRows.Count <= 0 ? "" : dataRows[0].Field<string>("email"));
+ planilhaCompletum.Email2 = (dataRows == null || dataRows.Count <= 1 ? "" : dataRows[1].Field<string>("email"));
+ planilhaCompletum.Endereco = (dataRow1 != null ? dataRow1.Field<string>("endereco") : null);
+ planilhaCompletum.Numero = (dataRow1 != null ? dataRow1.Field<string>("numero") : null);
+ planilhaCompletum.Bairro = (dataRow1 != null ? dataRow1.Field<string>("bairro") : null);
+ planilhaCompletum.Cidade = (dataRow1 != null ? dataRow1.Field<string>("cidade") : null);
+ planilhaCompletum.Estado = (dataRow1 != null ? dataRow1.Field<string>("uf") : null);
+ planilhaCompletum.Cep = (dataRow1 != null ? dataRow1.Field<string>("cep") : null);
+ planilhaCompletum.BancoCliente = str5;
+ planilhaCompletum.AgenciaCliente = x.Field<string>("cliAgencia");
+ planilhaCompletum.ContaCliente = x.Field<string>("cliConta");
+ planilhaCompletum.NomeContato = (dataRow2 != null ? dataRow2.Field<string>("nome") : null);
+ if (dataRow2 != null)
+ {
+ nullable73 = dataRow2.Field<DateTime?>("dtnasc");
+ if (!nullable73.HasValue)
+ {
+ goto Label1;
+ }
+ if (dataRow2 != null)
+ {
+ nullable31 = dataRow2.Field<DateTime?>("dtnasc");
+ goto Label0;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable31 = nullable73;
+ goto Label0;
+ }
+ }
+ Label1:
+ nullable73 = null;
+ nullable31 = nullable73;
+ Label0:
+ planilhaCompletum.NascimentoContato = nullable31;
+ planilhaCompletum.DocumentoContato = (dataRow2 != null ? dataRow2.Field<string>("cgccpf") : null);
+ planilhaCompletum.IdentidadeContato = (dataRow2 != null ? dataRow2.Field<string>("rg") : null);
+ if (dataRow2 != null)
+ {
+ nullable73 = dataRow2.Field<DateTime?>("rgexpedicao");
+ if (!nullable73.HasValue)
+ {
+ goto Label3;
+ }
+ if (dataRow2 != null)
+ {
+ nullable32 = dataRow2.Field<DateTime?>("rgexpedicao");
+ goto Label2;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable32 = nullable73;
+ goto Label2;
+ }
+ }
+ Label3:
+ nullable73 = null;
+ nullable32 = nullable73;
+ Label2:
+ planilhaCompletum.ExpedicaoContato = nullable32;
+ planilhaCompletum.PrefixoContato = (dataRow2 != null ? dataRow2.Field<string>("ddd") : null);
+ planilhaCompletum.TelefoneContato = (dataRow2 != null ? dataRow2.Field<string>("fone") : null);
+ planilhaCompletum.EmailContato = (dataRow2 != null ? dataRow2.Field<string>("email") : null);
+ planilhaCompletum.HabilitacaoContato = (dataRow2 != null ? dataRow2.Field<string>("cnh") : null);
+ if (dataRow2 != null)
+ {
+ nullable73 = dataRow2.Field<DateTime?>("prihabilitacao");
+ if (!nullable73.HasValue)
+ {
+ goto Label5;
+ }
+ if (dataRow2 != null)
+ {
+ nullable33 = dataRow2.Field<DateTime?>("prihabilitacao");
+ goto Label4;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable33 = nullable73;
+ goto Label4;
+ }
+ }
+ Label5:
+ nullable73 = null;
+ nullable33 = nullable73;
+ Label4:
+ planilhaCompletum.PrimeiraHabilitacaoContato = nullable33;
+ planilhaCompletum.BancoContato = (dataRow2 != null ? dataRow2.Field<string>("banco") : null);
+ planilhaCompletum.AgenciaContato = (dataRow2 != null ? dataRow2.Field<string>("agencia") : null);
+ planilhaCompletum.ContaContato = (dataRow2 != null ? dataRow2.Field<string>("conta") : null);
+ planilhaCompletum.DocumentoSinistrado = (num2 > 0 ? "SIM" : "NÃO");
+ planilhaCompletum.Frota = (list1.Count == 0 ? "" : (list1.Count > 1 ? "ESTE DOCUMENTO SE TRATA DE UMA FROTA" : ""));
+ planilhaCompletum.DescricaoItem = (list1.Count == 0 ? "" : (list1.Count > 1 ? "ESTE DOCUMENTO SE TRATA DE UMA FROTA" : list1.First<DataRow>().Field<string>("descricao")));
+ planilhaCompletum.StatusItem = (list1.Count == 0 || list1.Count > 1 ? "" : list1.First<DataRow>().Field<string>("status"));
+ planilhaCompletum.CodFipe = (string)((dataRow3 != null ? dataRow3.Field<string>("codfipe") : null) ?? "");
+ if (dataRow3 != null && dataRow3.Field<object>("idcombustivel") != null)
+ {
+ if (string.IsNullOrWhiteSpace((dataRow3 != null ? dataRow3.Field<object>("idcombustivel").ToString() : null)))
+ {
+ goto Label7;
+ }
+ description = ((Combustivel)Enum.Parse(typeof(Combustivel), dataRow3.Field<object>("idcombustivel").ToString())).GetDescription<Combustivel>();
+ goto Label6;
+ }
+ Label7:
+ description = "";
+ Label6:
+ planilhaCompletum.Combustivel = description;
+ planilhaCompletum.Modelo = (string)((dataRow3 != null ? dataRow3.Field<string>("modelo") : null) ?? "");
+ planilhaCompletum.Fabricante = (string)((dataRow3 != null ? dataRow3.Field<string>("fabricante") : null) ?? "");
+ if (dataRow3 != null && dataRow3.Field<object>("idcategoria") != null)
+ {
+ if (string.IsNullOrWhiteSpace((dataRow3 != null ? dataRow3.Field<object>("idcategoria").ToString() : null)))
+ {
+ goto Label9;
+ }
+ description1 = ((Categoria)Enum.Parse(typeof(Categoria), dataRow3.Field<object>("idcategoria").ToString())).GetDescription<Categoria>();
+ goto Label8;
+ }
+ Label9:
+ description1 = "";
+ Label8:
+ planilhaCompletum.Categoria = description1;
+ planilhaCompletum.Chassi = (string)((dataRow3 != null ? dataRow3.Field<string>("chassi") : null) ?? "");
+ planilhaCompletum.Placa = (string)((dataRow3 != null ? dataRow3.Field<string>("placa") : null) ?? "");
+ planilhaCompletum.AnoFab = (string)((dataRow3 != null ? dataRow3.Field<string>("anofab") : null) ?? "");
+ planilhaCompletum.AnoMod = (string)((dataRow3 != null ? dataRow3.Field<string>("anomod") : null) ?? "");
+ planilhaCompletum.Renavam = (string)((dataRow3 != null ? dataRow3.Field<string>("renavam") : null) ?? "");
+ planilhaCompletum.Capacidade = (string)((dataRow3 != null ? dataRow3.Field<string>("capacidade") : null) ?? "");
+ planilhaCompletum.Portas = (string)((dataRow3 != null ? dataRow3.Field<string>("portas") : null) ?? "");
+ planilhaCompletum.ObsAuto = (string)((dataRow3 != null ? dataRow3.Field<string>("obs") : null) ?? "");
+ planilhaCompletum.ObsVida = (string)((dataRow8 != null ? dataRow8.Field<string>("obs") : null) ?? "");
+ planilhaCompletum.RegCirc = (string)((dataRow3 != null ? dataRow3.Field<string>("regiaocirculacao") : null) ?? "");
+ if (dataRow3 != null && dataRow3.Field<object>("idtabelareferencia") != null)
+ {
+ if (string.IsNullOrWhiteSpace((dataRow3 != null ? dataRow3.Field<object>("idtabelareferencia").ToString() : null)))
+ {
+ goto Label11;
+ }
+ str1 = ((TabelaReferencia)Enum.Parse(typeof(TabelaReferencia), dataRow3.Field<object>("idtabelareferencia").ToString())).GetDescription<TabelaReferencia>();
+ goto Label10;
+ }
+ Label11:
+ str1 = "";
+ Label10:
+ planilhaCompletum.TabelaRef = str1;
+ if (dataRow3 != null)
+ {
+ nullable34 = dataRow3.Field<decimal?>("porcentagemreferencia");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable34 = nullable5;
+ }
+ planilhaCompletum.PorcRef = nullable34;
+ if (dataRow3 != null)
+ {
+ nullable35 = dataRow3.Field<decimal?>("valordeterminado");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable35 = nullable5;
+ }
+ planilhaCompletum.ValorDeterminado = nullable35;
+ planilhaCompletum.Ci = (string)((dataRow3 != null ? dataRow3.Field<string>("ci") : null) ?? "");
+ planilhaCompletum.CepPernoite = (string)((dataRow3 != null ? dataRow3.Field<string>("ceppernoite") : null) ?? "");
+ planilhaCompletum.Financiado = (dataRow3 == null ? "" : (dataRow3.Field<string>("financiado") == "1" ? "SIM" : "NÃO"));
+ planilhaCompletum.ZeroKm = (dataRow3 == null ? "" : (dataRow3.Field<string>("zerokm") == "1" ? "SIM" : "NÃO"));
+ planilhaCompletum.Pcd = (dataRow3 == null ? "" : (dataRow3.Field<object>("pcd") == null || !(dataRow3.Field<object>("pcd").ToString() == "1") ? "NÃO" : "SIM"));
+ if (dataRow3 != null && dataRow3.Field<object>("idcor") != null)
+ {
+ if (string.IsNullOrWhiteSpace((dataRow3 != null ? dataRow3.Field<object>("idcor").ToString() : null)))
+ {
+ goto Label13;
+ }
+ description2 = ((Cor)Enum.Parse(typeof(Cor), dataRow3.Field<object>("idcor").ToString())).GetDescription<Cor>();
+ goto Label12;
+ }
+ Label13:
+ description2 = "";
+ Label12:
+ planilhaCompletum.Cor = description2;
+ if (dataRow3 != null && dataRow3.Field<object>("correcao") != null)
+ {
+ if (string.IsNullOrWhiteSpace((dataRow3 != null ? dataRow3.Field<object>("correcao").ToString() : null)))
+ {
+ goto Label15;
+ }
+ str2 = ((Correcao)Enum.Parse(typeof(Correcao), dataRow3.Field<object>("correcao").ToString())).GetDescription<Correcao>();
+ goto Label14;
+ }
+ Label15:
+ str2 = "";
+ Label14:
+ planilhaCompletum.Correcao = str2;
+ planilhaCompletum.Bonus = nullable72;
+ planilhaCompletum.CpfPerfil = (string)((dataRow12 != null ? dataRow12.Field<string>("cpf") : null) ?? "");
+ planilhaCompletum.NomePerfil = (string)((dataRow12 != null ? dataRow12.Field<string>("nomecompleto") : null) ?? "");
+ if (dataRow12 != null)
+ {
+ nullable36 = dataRow12.Field<DateTime?>("datanascimento");
+ }
+ else
+ {
+ nullable8 = null;
+ nullable36 = nullable8;
+ }
+ nullable73 = nullable36;
+ if (nullable73.HasValue)
+ {
+ nullable37 = nullable73;
+ }
+ else
+ {
+ nullable8 = null;
+ nullable37 = nullable8;
+ }
+ planilhaCompletum.NascimentoPerfil = nullable37;
+ planilhaCompletum.SexoPerfil = str7 ?? "";
+ planilhaCompletum.EstadoCivilPerfil = (string)((dataRow12 != null ? dataRow12.Field<string>("estadocivil") : null) ?? "");
+ planilhaCompletum.CEPCirculacaoPerfil = (string)((dataRow12 != null ? dataRow12.Field<string>("cepcirculacao") : null) ?? "");
+ planilhaCompletum.CEPPernoitePerfil = (string)((dataRow12 != null ? dataRow12.Field<string>("ceppernoite") : null) ?? "");
+ planilhaCompletum.DanosMateriasPremios = new decimal?((cobertura1 != null ? cobertura1.Premio : decimal.Zero));
+ planilhaCompletum.DanosMateriasFranquia = new decimal?((cobertura1 != null ? cobertura1.Franquia : decimal.Zero));
+ planilhaCompletum.DanosMateriasLmi = new decimal?((cobertura1 != null ? cobertura1.Lmi : decimal.Zero));
+ planilhaCompletum.DanosCorporaisPremios = new decimal?((cobertura != null ? cobertura.Premio : decimal.Zero));
+ planilhaCompletum.DanosCorporaisFranquia = new decimal?((cobertura != null ? cobertura.Franquia : decimal.Zero));
+ planilhaCompletum.DanosCorporaisLmi = new decimal?((cobertura != null ? cobertura.Lmi : decimal.Zero));
+ planilhaCompletum.DanosMoraisPremios = new decimal?((cobertura2 != null ? cobertura2.Premio : decimal.Zero));
+ planilhaCompletum.DanosMoraisFranquia = new decimal?((cobertura2 != null ? cobertura2.Franquia : decimal.Zero));
+ planilhaCompletum.DanosMoraisLmi = new decimal?((cobertura2 != null ? cobertura2.Lmi : decimal.Zero));
+ planilhaCompletum.AppPremios = new decimal?((cobertura3 != null ? cobertura3.Premio : decimal.Zero));
+ planilhaCompletum.AppFranquia = new decimal?((cobertura3 != null ? cobertura3.Franquia : decimal.Zero));
+ planilhaCompletum.AppLmi = new decimal?((cobertura3 != null ? cobertura3.Lmi : decimal.Zero));
+ planilhaCompletum.CarroReservaPremios = new decimal?((cobertura4 != null ? cobertura4.Premio : decimal.Zero));
+ planilhaCompletum.CarroReservaFranquia = new decimal?((cobertura4 != null ? cobertura4.Franquia : decimal.Zero));
+ planilhaCompletum.CarroReservaLmi = new decimal?((cobertura4 != null ? cobertura4.Lmi : decimal.Zero));
+ planilhaCompletum.CarroReservaObs = (cobertura4 != null ? cobertura4.Observacao : "");
+ planilhaCompletum.EnderecoItem = (dataRow4 != null ? dataRow4.Field<string>("enderecoitem") : (dataRow5 != null ? dataRow5.Field<string>("endereco") : null));
+ planilhaCompletum.NumeroItem = (dataRow4 != null ? dataRow4.Field<string>("numeroitem") : (dataRow5 != null ? dataRow5.Field<string>("numero") : null));
+ planilhaCompletum.ComplementoItem = (dataRow4 != null ? dataRow4.Field<string>("complementoitem") : (dataRow5 != null ? dataRow5.Field<string>("complemento") : null));
+ planilhaCompletum.BairroItem = (dataRow4 != null ? dataRow4.Field<string>("bairroitem") : (dataRow5 != null ? dataRow5.Field<string>("bairro") : null));
+ planilhaCompletum.CidadeItem = (dataRow4 != null ? dataRow4.Field<string>("cidadeitem") : (dataRow5 != null ? dataRow5.Field<string>("cidade") : null));
+ planilhaCompletum.UfItem = (dataRow4 != null ? dataRow4.Field<string>("ufitem") : (dataRow5 != null ? dataRow5.Field<string>("uf") : null));
+ planilhaCompletum.CepItem = (dataRow4 != null ? dataRow4.Field<string>("cepitem") : (dataRow5 != null ? dataRow5.Field<string>("cep") : null));
+ planilhaCompletum.ObsPatrimonial = (dataRow4 != null ? dataRow4.Field<string>("obsresidencia") : null);
+ planilhaCompletum.ObsGranizo = (dataRow5 != null ? dataRow5.Field<string>("obs") : null);
+ planilhaCompletum.CulturaGranizo = (dataRow5 != null ? dataRow5.Field<string>("cultura") : null);
+ planilhaCompletum.SitioGranizo = (dataRow5 != null ? dataRow5.Field<string>("sitio") : null);
+ if (dataRow5 != null)
+ {
+ nullable38 = dataRow5.Field<decimal?>("subfed");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable38 = nullable5;
+ }
+ planilhaCompletum.SubFedGranizo = nullable38;
+ if (dataRow5 != null)
+ {
+ nullable39 = dataRow5.Field<decimal?>("subest");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable39 = nullable5;
+ }
+ planilhaCompletum.SubEstGranizo = nullable39;
+ planilhaCompletum.ImobiliariaPatrimonial = (dataRow4 != null ? dataRow4.Field<string>("imobiliaria") : null);
+ planilhaCompletum.ContatoPatrimonial = (dataRow4 != null ? dataRow4.Field<string>("contatoresidencia") : null);
+ planilhaCompletum.Locatario = (dataRow4 != null ? dataRow4.Field<string>("locatario") : null);
+ planilhaCompletum.DocumentoLocatario = (dataRow4 != null ? dataRow4.Field<string>("cpflocatario1") : null);
+ planilhaCompletum.DddLocatario = (dataRow4 != null ? dataRow4.Field<string>("dddloc") : null);
+ planilhaCompletum.TelefoneLocatario = (dataRow4 != null ? dataRow4.Field<string>("foneloc") : null);
+ planilhaCompletum.Ddd2Locatario = (dataRow4 != null ? dataRow4.Field<string>("ddd2loc") : null);
+ planilhaCompletum.Telefone2Locatario = (dataRow4 != null ? dataRow4.Field<string>("fone2loc") : null);
+ planilhaCompletum.Locatario2 = (dataRow4 != null ? dataRow4.Field<string>("locatario2") : null);
+ planilhaCompletum.DocumentoLocatario2 = (dataRow4 != null ? dataRow4.Field<string>("cpflocatario2") : null);
+ planilhaCompletum.DddLocatario2 = (dataRow4 != null ? dataRow4.Field<string>("dddlocatario2") : null);
+ planilhaCompletum.TelefoneLocatario2 = (dataRow4 != null ? dataRow4.Field<string>("fonelocatario2") : null);
+ planilhaCompletum.Locatario3 = (dataRow4 != null ? dataRow4.Field<string>("locatario3") : null);
+ planilhaCompletum.DocumentoLocatario3 = (dataRow4 != null ? dataRow4.Field<string>("cpflocatario3") : null);
+ planilhaCompletum.DddLocatario3 = (dataRow4 != null ? dataRow4.Field<string>("dddlocatario3") : null);
+ planilhaCompletum.TelefoneLocatario3 = (dataRow4 != null ? dataRow4.Field<string>("fonelocatario3") : null);
+ planilhaCompletum.BensPatrimonial = (dataRow4 != null ? dataRow4.Field<string>("bens") : null);
+ planilhaCompletum.FabricanteAero = (dataRow6 != null ? dataRow6.Field<string>("fabricante") : null);
+ planilhaCompletum.ModeloAero = (dataRow6 != null ? dataRow6.Field<string>("modelo") : null);
+ planilhaCompletum.SerieAero = (dataRow6 != null ? dataRow6.Field<string>("serieregistro") : null);
+ planilhaCompletum.NomeAero = (dataRow6 != null ? dataRow6.Field<string>("nomeprefixo") : null);
+ if (dataRow6 != null)
+ {
+ nullable40 = dataRow6.Field<int?>("anofab");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable40 = nullable75;
+ }
+ planilhaCompletum.AnoFabAero = nullable40;
+ if (dataRow6 != null)
+ {
+ nullable41 = dataRow6.Field<int?>("tripulantes");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable41 = nullable75;
+ }
+ planilhaCompletum.TripulantesAero = nullable41;
+ if (dataRow6 != null)
+ {
+ nullable42 = dataRow6.Field<int?>("passageiros");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable42 = nullable75;
+ }
+ nullable75 = nullable42;
+ planilhaCompletum.PassageirosAero = new int?(nullable75.GetValueOrDefault());
+ if (dataRow6 != null)
+ {
+ nullable43 = dataRow6.Field<long?>("peso");
+ }
+ else
+ {
+ nullable9 = null;
+ nullable43 = nullable9;
+ }
+ nullable9 = nullable43;
+ planilhaCompletum.PesoAero = new decimal?(nullable9.GetValueOrDefault());
+ planilhaCompletum.MarinaAero = (dataRow6 != null ? dataRow6.Field<string>("marinaaero") : null);
+ planilhaCompletum.CertificadoAero = (dataRow6 != null ? dataRow6.Field<string>("certificado") : null);
+ if (dataRow6 != null)
+ {
+ nullable44 = dataRow6.Field<DateTime?>("vistoria");
+ }
+ else
+ {
+ nullable73 = null;
+ nullable44 = nullable73;
+ }
+ planilhaCompletum.VistoriaAero = nullable44;
+ planilhaCompletum.CascoAero = (dataRow6 != null ? dataRow6.Field<string>("casco") : null);
+ planilhaCompletum.NavegacaoAero = (dataRow6 != null ? dataRow6.Field<string>("navegacao") : null);
+ planilhaCompletum.ObsAero = (dataRow6 != null ? dataRow6.Field<string>("obs") : null);
+ planilhaCompletum.ObsRiscos = (dataRow7 != null ? dataRow7.Field<string>("obs") : null);
+ if (dataRow7 != null)
+ {
+ nullable45 = dataRow7.Field<decimal?>("subfed");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable45 = nullable5;
+ }
+ planilhaCompletum.SubFedRiscos = nullable45;
+ if (dataRow7 != null)
+ {
+ nullable46 = dataRow7.Field<decimal?>("subest");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable46 = nullable5;
+ }
+ planilhaCompletum.SubEstRiscos = nullable46;
+ planilhaCompletum.PlanoVida = (dataRow8 != null ? dataRow8.Field<string>("plano") : null);
+ if (dataRow8 != null)
+ {
+ nullable47 = dataRow8.Field<int?>("socios");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable47 = nullable75;
+ }
+ planilhaCompletum.SociosVida = nullable47;
+ if (dataRow8 != null)
+ {
+ nullable48 = dataRow8.Field<int?>("funcionarios");
+ }
+ else
+ {
+ nullable75 = null;
+ nullable48 = nullable75;
+ }
+ planilhaCompletum.FuncionariosVida = nullable48;
+ if (dataRow8 != null)
+ {
+ nullable49 = dataRow8.Field<decimal?>("capitalsocio");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable49 = nullable5;
+ }
+ planilhaCompletum.CapitalSociosVida = nullable49;
+ if (dataRow8 != null)
+ {
+ nullable50 = dataRow8.Field<decimal?>("capitalfunc");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable50 = nullable5;
+ }
+ planilhaCompletum.CapitalFuncionariosVida = nullable50;
+ planilhaCompletum.ObsItem = (list1.Count != 1 ? "" : list1.First<DataRow>().Field<string>("obs"));
+ planilhaCompletum.DescricaoSinistro = (dataRow9 != null ? dataRow9.Field<string>("descricao") : null);
+ planilhaCompletum.NumeroSinistro = (dataRow9 != null ? dataRow9.Field<string>("numsinistro") : null);
+ if (dataRow9 != null)
+ {
+ nullable73 = dataRow9.Field<DateTime?>("datareclamacao");
+ if (!nullable73.HasValue)
+ {
+ goto Label17;
+ }
+ if (dataRow9 != null)
+ {
+ nullable51 = dataRow9.Field<DateTime?>("datareclamacao");
+ goto Label16;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable51 = nullable73;
+ goto Label16;
+ }
+ }
+ Label17:
+ nullable73 = null;
+ nullable51 = nullable73;
+ Label16:
+ planilhaCompletum.DataReclamacao = nullable51;
+ if (dataRow9 != null)
+ {
+ nullable73 = dataRow9.Field<DateTime?>("datasinistro");
+ if (!nullable73.HasValue)
+ {
+ goto Label19;
+ }
+ if (dataRow9 != null)
+ {
+ nullable52 = dataRow9.Field<DateTime?>("datasinistro");
+ goto Label18;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable52 = nullable73;
+ goto Label18;
+ }
+ }
+ Label19:
+ nullable73 = null;
+ nullable52 = nullable73;
+ Label18:
+ planilhaCompletum.DataSinistro = nullable52;
+ if (dataRow9 != null)
+ {
+ nullable73 = dataRow9.Field<DateTime?>("dataliquidacao");
+ if (!nullable73.HasValue)
+ {
+ goto Label21;
+ }
+ if (dataRow9 != null)
+ {
+ nullable53 = dataRow9.Field<DateTime?>("dataliquidacao");
+ goto Label20;
+ }
+ else
+ {
+ nullable73 = null;
+ nullable53 = nullable73;
+ goto Label20;
+ }
+ }
+ Label21:
+ nullable73 = null;
+ nullable53 = nullable73;
+ Label20:
+ planilhaCompletum.DataLiquidacao = nullable53;
+ planilhaCompletum.ObsSinistro = (str6.Length > 30000 ? str6.Substring(0, 30000) : str6);
+ planilhaCompletum.MotivoSinistro = (dataRow9 != null ? dataRow9.Field<string>("motivo") : null);
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("valor");
+ if (!nullable5.HasValue)
+ {
+ goto Label23;
+ }
+ if (dataRow9 != null)
+ {
+ nullable54 = dataRow9.Field<decimal?>("valor");
+ goto Label22;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable54 = nullable5;
+ goto Label22;
+ }
+ }
+ Label23:
+ nullable5 = null;
+ nullable54 = nullable5;
+ Label22:
+ planilhaCompletum.ValorSinistro = nullable54;
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("vlrfranquia");
+ if (!nullable5.HasValue)
+ {
+ goto Label25;
+ }
+ if (dataRow9 != null)
+ {
+ nullable55 = dataRow9.Field<decimal?>("vlrfranquia");
+ goto Label24;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable55 = nullable5;
+ goto Label24;
+ }
+ }
+ Label25:
+ nullable5 = null;
+ nullable55 = nullable5;
+ Label24:
+ planilhaCompletum.ValorFranquiaSinistro = nullable55;
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("vlrorcado");
+ if (!nullable5.HasValue)
+ {
+ goto Label27;
+ }
+ if (dataRow9 != null)
+ {
+ nullable56 = dataRow9.Field<decimal?>("vlrorcado");
+ goto Label26;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable56 = nullable5;
+ goto Label26;
+ }
+ }
+ Label27:
+ nullable5 = null;
+ nullable56 = nullable5;
+ Label26:
+ planilhaCompletum.ValorOrcado = nullable56;
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("vlrliberado");
+ if (!nullable5.HasValue)
+ {
+ goto Label29;
+ }
+ if (dataRow9 != null)
+ {
+ nullable57 = dataRow9.Field<decimal?>("vlrliberado");
+ goto Label28;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable57 = nullable5;
+ goto Label28;
+ }
+ }
+ Label29:
+ nullable5 = null;
+ nullable57 = nullable5;
+ Label28:
+ planilhaCompletum.ValorLiberado = nullable57;
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("vlrpago");
+ if (!nullable5.HasValue)
+ {
+ goto Label31;
+ }
+ if (dataRow9 != null)
+ {
+ nullable58 = dataRow9.Field<decimal?>("vlrpago");
+ goto Label30;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable58 = nullable5;
+ goto Label30;
+ }
+ }
+ Label31:
+ nullable5 = null;
+ nullable58 = nullable5;
+ Label30:
+ planilhaCompletum.ValorPago = nullable58;
+ if (dataRow9 != null)
+ {
+ nullable5 = dataRow9.Field<decimal?>("vlrsalvado");
+ if (!nullable5.HasValue)
+ {
+ goto Label33;
+ }
+ if (dataRow9 != null)
+ {
+ nullable59 = dataRow9.Field<decimal?>("vlrsalvado");
+ goto Label32;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable59 = nullable5;
+ goto Label32;
+ }
+ }
+ Label33:
+ nullable5 = null;
+ nullable59 = nullable5;
+ Label32:
+ planilhaCompletum.ValorSalvo = nullable59;
+ planilhaCompletum.Parentesco = (dataRow10 != null ? ((ParentescoVinculo?)Enum.Parse(typeof(ParentescoVinculo), dataRow10.Field<object>("parentesco").ToString())).GetDescription<ParentescoVinculo?>() : "");
+ if (dataRow11 != null)
+ {
+ nullable5 = dataRow11.Field<decimal?>("franquia");
+ if (!nullable5.HasValue)
+ {
+ goto Label35;
+ }
+ if (dataRow11 != null)
+ {
+ nullable60 = dataRow11.Field<decimal?>("franquia");
+ goto Label34;
+ }
+ else
+ {
+ nullable5 = null;
+ nullable60 = nullable5;
+ goto Label34;
+ }
+ }
+ Label35:
+ nullable5 = null;
+ nullable60 = nullable5;
+ Label34:
+ planilhaCompletum.ValorFranquiaApolice = nullable60;
+ planilhaCompletum.QtdeEndosso = num1;
+ planilhaCompletum.QtdeSinistro = num2;
+ planilhaCompletum.BensConsorcio = (dataRow13 != null ? dataRow13.Field<string>("bensconsorcio") : null);
+ planilhaCompletum.Grupo = (dataRow13 != null ? dataRow13.Field<string>("grupo") : null);
+ planilhaCompletum.Cota = (dataRow13 != null ? dataRow13.Field<string>("cota") : null);
+ if (dataRow13 != null)
+ {
+ nullable61 = dataRow13.Field<decimal?>("valorCredito");
+ }
+ else
+ {
+ nullable5 = null;
+ nullable61 = nullable5;
+ }
+ planilhaCompletum.ValorCredito = nullable61;
+ planilhaCompletum.AreaRiscos = (dataRow7 != null ? dataRow7.Field<string>("area") : null);
+ planilhaCompletum.AreaGranizo = (dataRow5 != null ? dataRow5.Field<string>("area") : null);
+ planilhaCompletas.Add(planilhaCompletum);
+ }
+ catch (Exception exception)
+ {
+ }
+ });
+ return planilhaCompletas;
+ }
+
+ public List<PlanilhaCompleta> PlanilhaCompletaFatura(List<long> ids, Relatorio relatorio, DateTime inicio, DateTime fim, bool configFranquia, bool configSomaPremio)
+ {
+ //
+ // Current member / type: System.Collections.Generic.List`1<Gestor.Model.Domain.Relatorios.PlanilhaCompleta> Gestor.Infrastructure.Repository.Logic.ReportRepository::PlanilhaCompletaFatura(System.Collections.Generic.List`1<System.Int64>,Gestor.Model.Common.Relatorio,System.DateTime,System.DateTime,System.Boolean,System.Boolean)
+ // File path: C:\AggerSeguros\Lib\Gestor.Infrastructure.dll
+ //
+ // Product version: 0.0.0.0
+ // Exception in: System.Collections.Generic.List<Gestor.Model.Domain.Relatorios.PlanilhaCompleta> PlanilhaCompletaFatura(System.Collections.Generic.List<System.Int64>,Gestor.Model.Common.Relatorio,System.DateTime,System.DateTime,System.Boolean,System.Boolean)
+ //
+ // An item with the same key has already been added. Key: Label0
+ // at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
+ // at System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(KeyValuePair`2 keyValuePair)
+ // at Telerik.JustDecompiler.Common.Extensions.AddRange[TKey,TValue](IDictionary`2 self, IDictionary`2 source) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Common\Extensions.cs:line 99
+ // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.AnonymousDelegateRebuilder.VisitObjectCreationExpression(ObjectCreationExpression node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 332
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.Visit(ICodeNode node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 273
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.Visit[TCollection,TElement](TCollection original) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 290
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.Visit(ExpressionCollection node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 322
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.VisitMethodInvocationExpression(MethodInvocationExpression node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 499
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.Visit(ICodeNode node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 273
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.VisitExpressionStatement(ExpressionStatement node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 383
+ // at Telerik.JustDecompiler.Ast.BaseCodeTransformer.Visit(ICodeNode node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeTransformer.cs:line 273
+ // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.AnonymousDelegateRebuilder.Match(BlockStatement theBlock, Int32 index) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 114
+ // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.VisitBlockStatement(BlockStatement node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 30
+ // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 21
+ // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
+ // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
+ // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95
+ // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
+ // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118
+ //
+ // mailto: JustDecompilePublicFeedback@telerik.com
+
+ }
+ }
+} \ No newline at end of file