using Gestor.Application.Componentes; using Gestor.Application.Helpers; using Gestor.Application.Servicos; using Gestor.Application.Servicos.Seguros; using Gestor.Application.Servicos.Seguros.Itens; using Gestor.Application.ViewModels; using Gestor.Application.ViewModels.Generic; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Configuracoes; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; using Gestor.Model.Domain.Seguros; using NReco.PdfGenerator; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; namespace Gestor.Application.ViewModels.Drawer { public class ExtratosViewModel : BaseSegurosViewModel { private readonly ClienteServico _clienteServico = new ClienteServico(); private List _documentos; private List _prospeccoes; private List _clientes; private bool _tipoExtratoEnabled = true; private bool _extratoResumido; private bool _segurosVigentes; private Visibility _clientePorPaginaVisibility; private bool _clientePorPagina; private bool _extratoPorPagina; private bool _clientePorPaginaEnabled = true; private bool _obsCliente; private bool _comissaoDocumento; private bool _premioParcela; private bool _obsApolice; private bool _beneficiariosItens; private bool _selecionarItens; private bool _endossos; private bool _somenteEndosso; private Visibility _selecionarItensVisibility; private Visibility _endossoVisibility; private Visibility _obsDocVisibility; private Visibility _segurosVigentesVisibility; private bool _obsItem; private bool _separarPagina; private bool _perfilCondutor; private bool _obsClienteEnabled = true; private bool _comissaoDocumentoEnabled; private bool _obsApoliceEnabled; private bool _beneficiariosItensEnabled; private bool _obsItemEnabled; private bool _separarPaginaEnabled; private bool _coberturasEnabled; private bool _coberturas; private bool _perfilCondutorEnabled; private bool _endossoEnabled; private bool _esconderResumido; private bool _clienteVisibility; private bool _documentoVisibility; private bool _itemVisibility; private bool _perfilVisibility; private TipoExtrato _selectedTipoExtrato; private bool _carregando; private List _itensSelecionados; internal Relatorio? TipoDeRelatorio; public bool BeneficiariosItens { get { return this._beneficiariosItens; } set { this._beneficiariosItens = value; base.OnPropertyChanged("BeneficiariosItens"); } } public bool BeneficiariosItensEnabled { get { return this._beneficiariosItensEnabled; } set { this._beneficiariosItensEnabled = value; base.OnPropertyChanged("BeneficiariosItensEnabled"); } } public bool Carregando { get { return this._carregando; } set { this._carregando = value; base.IsEnabled = !value; base.EnableMenu = !value; base.OnPropertyChanged("Carregando"); } } public bool ClientePorPagina { get { return this._clientePorPagina; } set { this._clientePorPagina = value; base.OnPropertyChanged("ClientePorPagina"); } } public bool ClientePorPaginaEnabled { get { return this._clientePorPaginaEnabled; } set { this._clientePorPaginaEnabled = value; base.OnPropertyChanged("ClientePorPaginaEnabled"); } } public Visibility ClientePorPaginaVisibility { get { return this._clientePorPaginaVisibility; } set { this._clientePorPaginaVisibility = value; base.OnPropertyChanged("ClientePorPaginaVisibility"); } } public List Clientes { get { return this._clientes; } set { this._clientes = value; base.OnPropertyChanged("Clientes"); } } public bool ClienteVisibility { get { return this._clienteVisibility; } set { this._clienteVisibility = value; base.OnPropertyChanged("ClienteVisibility"); } } public bool Coberturas { get { return this._coberturas; } set { this._coberturas = value; base.OnPropertyChanged("Coberturas"); } } public bool CoberturasEnabled { get { return this._coberturasEnabled; } set { this._coberturasEnabled = value; base.OnPropertyChanged("CoberturasEnabled"); } } public bool ComissaoDocumento { get { return this._comissaoDocumento; } set { this._comissaoDocumento = value; base.OnPropertyChanged("ComissaoDocumento"); } } public bool ComissaoDocumentoEnabled { get { return this._comissaoDocumentoEnabled; } set { this._comissaoDocumentoEnabled = value; base.OnPropertyChanged("ComissaoDocumentoEnabled"); } } public List Documentos { get { return this._documentos; } set { this._documentos = value; base.OnPropertyChanged("Documentos"); } } public bool DocumentoVisibility { get { return this._documentoVisibility; } set { this._documentoVisibility = value; base.OnPropertyChanged("DocumentoVisibility"); } } public bool EndossoEnabled { get { return this._endossoEnabled; } set { this._endossoEnabled = value; base.OnPropertyChanged("EndossoEnabled"); } } public bool Endossos { get { return this._endossos; } set { this._endossos = value; if (this.SomenteEndossos != !value) { this.SomenteEndossos = !value; } base.OnPropertyChanged("Endossos"); } } public Visibility EndossoVisibility { get { return this._endossoVisibility; } set { this._endossoVisibility = value; base.OnPropertyChanged("EndossoVisibility"); } } public bool EsconderResumido { get { return this._esconderResumido; } set { this._esconderResumido = value; base.OnPropertyChanged("EsconderResumido"); } } public bool ExtratoPorPagina { get { return this._extratoPorPagina; } set { this._extratoPorPagina = value; base.OnPropertyChanged("ExtratoPorPagina"); } } public bool ExtratoResumido { get { return this._extratoResumido; } set { this._extratoResumido = value; if (!value) { this.ClienteVisibility = true; this.DocumentoVisibility = true; this.ItemVisibility = true; this.AjustaTipoSelecionado(this.SelectedTipoExtrato); } else { this.ClienteVisibility = false; this.DocumentoVisibility = false; this.ItemVisibility = this.CoberturasEnabled; this.SelecionarItensVisibility = Visibility.Collapsed; this.BeneficiariosItensEnabled = false; this.ObsItemEnabled = false; this.SepararPaginaEnabled = false; } base.OnPropertyChanged("ExtratoResumido"); } } public bool ItemVisibility { get { return this._itemVisibility; } set { this._itemVisibility = value; base.OnPropertyChanged("ItemVisibility"); } } public bool ObsApolice { get { return this._obsApolice; } set { this._obsApolice = value; base.OnPropertyChanged("ObsApolice"); } } public bool ObsApoliceEnabled { get { return this._obsApoliceEnabled; } set { this._obsApoliceEnabled = value; base.OnPropertyChanged("ObsApoliceEnabled"); } } public bool ObsCliente { get { return this._obsCliente; } set { this._obsCliente = value; base.OnPropertyChanged("ObsCliente"); } } public bool ObsClienteEnabled { get { return this._obsClienteEnabled; } set { this._obsClienteEnabled = value; base.OnPropertyChanged("ObsClienteEnabled"); } } public Visibility ObsDocVisibility { get { return this._obsDocVisibility; } set { this._obsDocVisibility = value; base.OnPropertyChanged("ObsDocVisibility"); } } public bool ObsItem { get { return this._obsItem; } set { this._obsItem = value; base.OnPropertyChanged("ObsItem"); } } public bool ObsItemEnabled { get { return this._obsItemEnabled; } set { this._obsItemEnabled = value; base.OnPropertyChanged("ObsItemEnabled"); } } public bool PerfilCondutor { get { return this._perfilCondutor; } set { this._perfilCondutor = value; base.OnPropertyChanged("PerfilCondutor"); } } public bool PerfilCondutorEnabled { get { return this._perfilCondutorEnabled; } set { this._perfilCondutorEnabled = value; base.OnPropertyChanged("PerfilCondutorEnabled"); } } public bool PerfilVisibility { get { return this._perfilVisibility; } set { this._perfilVisibility = value; base.OnPropertyChanged("PerfilVisibility"); } } public bool PremioParcela { get { return this._premioParcela; } set { this._premioParcela = value; base.OnPropertyChanged("PremioParcela"); } } public List Prospeccoes { get { return this._prospeccoes; } set { this._prospeccoes = value; base.OnPropertyChanged("Prospeccoes"); } } public bool SegurosVigentes { get { return this._segurosVigentes; } set { this._segurosVigentes = value; base.OnPropertyChanged("SegurosVigentes"); } } public Visibility SegurosVigentesVisibility { get { return this._segurosVigentesVisibility; } set { this._segurosVigentesVisibility = value; base.OnPropertyChanged("SegurosVigentesVisibility"); } } public bool SelecionarItens { get { return this._selecionarItens; } set { this._selecionarItens = value; if (!value) { this._itensSelecionados = new List(); } base.OnPropertyChanged("SelecionarItens"); } } public Visibility SelecionarItensVisibility { get { return this._selecionarItensVisibility; } set { this._selecionarItensVisibility = value; base.OnPropertyChanged("SelecionarItensVisibility"); } } public TipoExtrato SelectedTipoExtrato { get { return this._selectedTipoExtrato; } set { this._selectedTipoExtrato = value; this.AjustaTipoSelecionado(value); base.OnPropertyChanged("SelectedTipoExtrato"); } } public bool SepararPagina { get { return this._separarPagina; } set { this._separarPagina = value; base.OnPropertyChanged("SepararPagina"); } } public bool SepararPaginaEnabled { get { return this._separarPaginaEnabled; } set { this._separarPaginaEnabled = value; base.OnPropertyChanged("SepararPaginaEnabled"); } } public bool SomenteEndossos { get { return this._somenteEndosso; } set { this._somenteEndosso = value; if (this.Endossos != !value) { this.Endossos = !value; } base.OnPropertyChanged("SomenteEndossos"); } } public bool TipoExtratoEnabled { get { return this._tipoExtratoEnabled; } set { this._tipoExtratoEnabled = value; base.OnPropertyChanged("TipoExtratoEnabled"); } } public ExtratosViewModel() { } public void AjustaTipoSelecionado(TipoExtrato tipoExtrato) { switch (tipoExtrato) { case 0: { this.ClienteVisibility = true; this.ClientePorPaginaVisibility = Visibility.Hidden; this.DocumentoVisibility = false; this.ItemVisibility = false; this.PerfilVisibility = false; this.EsconderResumido = true; this.SelecionarItensVisibility = Visibility.Collapsed; this.SegurosVigentesVisibility = Visibility.Collapsed; this.SegurosVigentes = false; this.EndossoVisibility = Visibility.Collapsed; this.ObsDocVisibility = Visibility.Collapsed; this.ExtratoCliente(); return; } case 1: { this.ClienteVisibility = true; this.ClientePorPaginaVisibility = Visibility.Visible; this.DocumentoVisibility = true; this.ItemVisibility = true; this.PerfilVisibility = true; this.EsconderResumido = false; this.SelecionarItensVisibility = (!this.TipoDeRelatorio.HasValue ? Visibility.Visible : Visibility.Collapsed); this.SegurosVigentesVisibility = Visibility.Collapsed; this.SegurosVigentes = false; this.EndossoVisibility = Visibility.Visible; this.ObsDocVisibility = Visibility.Visible; this.ApoliceSelecionada(); return; } case 2: { this.ClienteVisibility = false; this.ClientePorPaginaVisibility = Visibility.Collapsed; this.DocumentoVisibility = true; this.ItemVisibility = false; this.PerfilVisibility = true; this.EsconderResumido = false; this.SelecionarItensVisibility = Visibility.Collapsed; this.SegurosVigentesVisibility = Visibility.Visible; this.EndossoVisibility = Visibility.Collapsed; this.ObsDocVisibility = Visibility.Collapsed; this.RelacaoApolices(); return; } default: { return; } } } private void ApoliceSelecionada() { this.SetAllFalse(); this.ObsClienteEnabled = true; this.ClientePorPaginaEnabled = true; this.ComissaoDocumentoEnabled = true; this.ObsApoliceEnabled = true; this.BeneficiariosItensEnabled = true; this.ObsItemEnabled = true; this.SepararPaginaEnabled = true; this.PerfilCondutorEnabled = true; this.EndossoEnabled = true; this.CoberturasEnabled = true; } private void ExtratoCliente() { this.SetAllFalse(); this.ObsClienteEnabled = true; } public async Task Gerar(Relatorio? tipoRelatorio = null, bool pdf = false) { DateTime date; List items; int numeroParcela; DateTime? clienteDesde; EstadoCivil? estadoCivil; Sexo? sexo; TipoTelefone? nullable; TipoTelefone tipoTelefone; decimal premioLiquido; List controleSinistros; long id; Patrimonial patrimonial; Auto auto; TipoCobertura? tipoCobertura; int? bonus; TabelaReferencia? tabelaReferencia; Vida vida; RiscosDiversos riscosDiverso; Aeronautico aeronautico; Granizo granizo; string str14; string str15; string str16; string str17; string str18; string str19; string str20; string str21; string str22; string shortDateString; string str23; string str24; string shortDateString1; string str25; string str26; string str27; string str28; string str29; string str30; string str31; string str32; string shortDateString2; string str33; string str34; string str35; string str36; string str37; string str38; string str39; string str40; string str41; string str42; string str43; string str44; string str45; string str46; string str47; string str48; string shortDateString3; string str49; string str50; string str51; string str52; string str53; string endosso; string str54; string str55; string str56; string str57; string str58; string str59; string str60; string str61; string str62; string str63; string str64; string str65; string str66; string str67; string str68; string str69; string str70; string str71; string str72; string shortDateString4; string str73; string shortDateString5; string str74; string str75; string str76; string str77; string str78; string str79; string str80; string str81; string str82; string str83; string str84; string str85; string str86; string str87; string str88; string str89; string str90; string description; string str91; string str92; string str93; string str94; string description1; string str95; string str96; string str97; string str98; string str99; string str100; string str101; string str102; string str103; string str104; string str105; string str106; DateTime? dataReclamacao; string shortDateString6; string str107; string description2; string str108; string str109; string currency; string str110; string str111; string descricao; string str112; string str113; string str114; string str115; string str116; string str117; string str118; string shortDateString7; string str119; string str120; string str121; string str122; string str123; string str124; string str125; string str126; string str127; string str128; string str129; string str130; string str131; string str132; string str133; string str134; string str135; string str136; string str137; string str138; string str139; string str140; string str141; string str142; string str143; string str144; string str145; string str146; string str147; string str148; string str149; string str150; string str151; string str152; string str153; string str154; string str155; string str156; string str157; string str158; string str159; string str160; string str161; string str162; string str163; bool count; string str164; string str165; string str166; string str167; string str168; string str169; string str170; string str171; string str172; string str173; string str174; string str175; NegocioCorretora negocioCorretora; string str176; string str177; string str178; string str179; string shortDateString8; string str180; string str181; string str182; string str183; string str184; string str185; string shortDateString9; string str186; string str187; string str188; string str189; string str190; string str191; string str192; string str193; string str194; string str195; string str196; string str197; string str198; string str199; string str200; string str201; string str202; string str203; string str204; string str205; string str206; string str207; string str208; string str209; string str210; string str211; string str212; string str213; string str214; string str215; string str216; string str217; string str218; string str219; string str220; string str221; string str222; string str223; string str224; string shortDateString10; string str225; string str226; string str227; string str228; string str229; string shortDateString11; string str230; string shortDateString12; string str231; string shortDateString13; string str232; string str233; string str234; string str235; string str236; string str237; string str238; string str239; string str240; string str241; string str242; string str243; Documento documento; string str244; string str245; string str246; string shortDateString14; string str247; string str248; string str249; string str250; string str251; string endosso1; string str252; string str253; string str254; string str255; string str256; string str257; string str258; string str259; string str260; string str261; string str262; string str263; string str264; string str265; string str266; string str267; string str268; string str269; string str270; string str271; string str272; string str273; string str274; string str275; string str276; string str277; string description3; string str278; string str279; string str280; string str281; string description4; string str282; string str283; string str284; string str285; string str286; string str287; string str288; string str289; string str290; string str291; DateTime? dataReclamacao1; string shortDateString15; string str292; string str293; string str294; string str295; string descricao1; string str296; string str297; string str298; string str299; string str300; string str301; string str302; string shortDateString16; string str303; string str304; string str305; string str306; string str307; string str308; string str309; string str310; string str311; string str312; string str313; string str314; string str315; string str316; string str317; string str318; string str319; string str320; string str321; string str322; string str323; string str324; string str325; string str326; string str327; string str328; string str329; string str330; string str331; NegocioCorretora negocioCorretora1; string str332; string str333; string str334; string str335; string str336; string str337; string str338; string str339; string str340; string str341; string str342; string str343; string str344; string str345; string str346; string str347; string str348; string str349; string str350; string str351; string str352; string shortDateString17; string str353; string str354; string str355; string str356; string str357; string str358; string str359; string str360; string str361; string str362; string str363; string str364; string str365; string str366; string str367; string str368; string str369; ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable9 = null; int num10; List list; Item item = null; Item item1; string str370; string str371 = ""; if (this.Clientes != null && this.Documentos == null) { str371 = string.Concat(str371, ""); str367 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str367, " DO CLIENTE"); str371 = string.Concat(str371, str370); str371 = string.Concat(str371, "
"); str371 = string.Concat(str371, ""); long id1 = (long)0; this.Clientes.ForEach((Cliente x) => { TipoTelefone? tipo; TipoTelefone valueOrDefault; string str; string str1; string upper; string str2; string str3; string str4; string upper1; string str5; string str6; string str7; string str8; int num = 0; if (id1 != x.get_Id()) { id1 = x.get_Id(); str371 = string.Concat(str371, (!this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
")); str371 = string.Concat(str371, "

"); str370 = string.Concat("EXTRATO", (this.ExtratoResumido ? " RESUMIDO" : ""), " DO CLIENTE: ", x.get_Nome()); str371 = string.Concat(str371, str370, "


"); string str9 = (x.get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); bool pessoaFisica = x.get_PessoaFisica(); ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals1 = variable9; string[] strArrays = new string[] { str371, ""; cSu0024u003cu003e8_locals1.html = string.Concat(strArrays); if (!pessoaFisica) { num++; } else { ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable = variable9; string[] cSu0024u003cu003e8_locals11 = new string[] { str371, ""; variable.html = string.Concat(cSu0024u003cu003e8_locals11); } str371 = string.Concat(str371, ""); if (x.get_Atividade() != null) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable1 = variable9; string[] nome = new string[] { str371, ""; variable1.html = string.Concat(nome); if (!pessoaFisica) { num++; } } if (this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); if (pessoaFisica) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals12 = variable9; string[] strArrays1 = new string[] { str371, ""; cSu0024u003cu003e8_locals12.html = string.Concat(strArrays1); } ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable2 = variable9; string[] strArrays2 = new string[] { str371, ""; cSu0024u003cu003e8_locals13.html = string.Concat(strArrays3); } if (!string.IsNullOrWhiteSpace(x.get_Identidade())) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable3 = variable9; string[] cSu0024u003cu003e8_locals14 = new string[] { str371, ""; variable3.html = string.Concat(cSu0024u003cu003e8_locals14); } if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable4 = variable9; string[] strArrays4 = new string[] { str371, ""; variable4.html = string.Concat(strArrays4); } if ((x.get_Telefones() != null || x.get_Emails() != null) && this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); if (x.get_Telefones() != null) { string str10 = ""; foreach (ClienteTelefone telefone in x.get_Telefones()) { string[] prefixo = new string[] { str10, "
", null, null, null, null, null }; tipo = telefone.get_Tipo(); if (tipo.HasValue) { valueOrDefault = tipo.GetValueOrDefault(); upper1 = valueOrDefault.ToString().ToUpper(); } else { upper1 = null; } prefixo[2] = upper1; prefixo[3] = " ("; prefixo[4] = telefone.get_Prefixo(); prefixo[5] = ") "; prefixo[6] = telefone.get_Numero(); str10 = string.Concat(prefixo); } ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals15 = variable9; string[] strArrays5 = new string[] { str371, "
"; cSu0024u003cu003e8_locals15.html = string.Concat(strArrays5); } if (x.get_Emails() != null && !this.ExtratoResumido) { string str11 = ""; foreach (ClienteEmail email in x.get_Emails()) { str11 = string.Concat(str11, "
", email.get_Email()); } ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable5 = variable9; string[] cSu0024u003cu003e8_locals16 = new string[] { str371, "
"; variable5.html = string.Concat(cSu0024u003cu003e8_locals16); } num++; str371 = string.Concat(str371, ""); } if (x.get_Enderecos() != null && this.SelectedTipoExtrato != 2) { string str12 = ""; foreach (ClienteEndereco endereco in x.get_Enderecos()) { string[] bairro = new string[] { str12, "
", endereco.get_Endereco(), ", ", endereco.get_Numero(), ", ", null, null, null, null, null, null, null, null }; bairro[6] = (string.IsNullOrWhiteSpace(endereco.get_Complemento()) ? "" : string.Concat(endereco.get_Complemento(), ", ")); bairro[7] = endereco.get_Bairro(); bairro[8] = " - "; bairro[9] = endereco.get_Cidade(); bairro[10] = " - "; bairro[11] = endereco.get_Estado(); bairro[12] = " - "; bairro[13] = endereco.get_Cep(); str12 = string.Concat(bairro); } ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable6 = variable9; string[] strArrays6 = new string[] { str371, "
"; variable6.html = string.Concat(strArrays6); } if (x.get_Profissao() != null && this.SelectedTipoExtrato != 2) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals17 = variable9; string[] nome1 = new string[] { str371, ""; cSu0024u003cu003e8_locals17.html = string.Concat(nome1); } if (x.get_Contatos() != null && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { string str13 = ""; foreach (MaisContato contato in x.get_Contatos()) { string[] nome2 = new string[15]; nome2[0] = str13; nome2[1] = "
NOME: "; nome2[2] = contato.get_Nome(); nome2[3] = (!string.IsNullOrWhiteSpace(contato.get_Documento()) ? string.Concat(", DOCUMENTO: ", contato.get_Documento()) : ""); nascimento = contato.get_Nascimento(); if (nascimento.HasValue) { nascimento = contato.get_Nascimento(); str = string.Concat(", NASCIMENTO: ", (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null)); } else { str = ""; } nome2[4] = str; Parentesco? parentesco = contato.get_Parentesco(); if (parentesco.HasValue) { parentesco = contato.get_Parentesco(); str1 = string.Concat(", PARENTESCO: ", (parentesco.HasValue ? parentesco.GetValueOrDefault().ToString().ToUpper() : null)); } else { str1 = ""; } nome2[5] = str1; nome2[6] = (!string.IsNullOrWhiteSpace(contato.get_Banco()) || !string.IsNullOrWhiteSpace(contato.get_Agencia()) || !string.IsNullOrWhiteSpace(contato.get_Conta()) ? "
" : ""); nome2[7] = (!string.IsNullOrWhiteSpace(contato.get_Banco()) ? string.Concat("BANCO: ", contato.get_Banco()) : ""); nome2[8] = (!string.IsNullOrWhiteSpace(contato.get_Agencia()) ? string.Concat((!string.IsNullOrWhiteSpace(contato.get_Banco()) ? ", AGÊNCIA: " : "AGÊNCIA: "), contato.get_Agencia()) : ""); nome2[9] = (!string.IsNullOrWhiteSpace(contato.get_Conta()) ? string.Concat((!string.IsNullOrWhiteSpace(contato.get_Banco()) || !string.IsNullOrWhiteSpace(contato.get_Agencia()) ? ", CONTA: " : "CONTA: "), contato.get_Conta()) : ""); tipo = contato.get_Tipo(); nome2[10] = (tipo.HasValue || !string.IsNullOrWhiteSpace(contato.get_Prefixo()) && !string.IsNullOrWhiteSpace(contato.get_Telefone()) || !string.IsNullOrWhiteSpace(contato.get_Email()) ? "
" : ""); tipo = contato.get_Tipo(); if (tipo.HasValue) { tipo = contato.get_Tipo(); if (tipo.HasValue) { valueOrDefault = tipo.GetValueOrDefault(); upper = valueOrDefault.ToString().ToUpper(); } else { upper = null; } str2 = string.Concat("TIPO DO TELEFONE: ", upper); } else { str2 = ""; } nome2[11] = str2; if (string.IsNullOrWhiteSpace(contato.get_Prefixo()) || string.IsNullOrWhiteSpace(contato.get_Telefone())) { str3 = ""; } else { tipo = contato.get_Tipo(); str3 = string.Concat((tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: ("), contato.get_Prefixo(), ") ", contato.get_Telefone()); } nome2[12] = str3; if (!string.IsNullOrWhiteSpace(contato.get_Email())) { tipo = contato.get_Tipo(); str4 = string.Concat((tipo.HasValue || !string.IsNullOrWhiteSpace(contato.get_Prefixo()) && !string.IsNullOrWhiteSpace(contato.get_Telefone()) ? ", EMAIL: " : "EMAIL: "), contato.get_Email()); } else { str4 = ""; } nome2[13] = str4; nome2[14] = "
"; str13 = string.Concat(nome2); } ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable7 = variable9; string[] strArrays7 = new string[] { str371, "
"; variable7.html = string.Concat(strArrays7); } if (this.ObsCliente && this.ClienteVisibility && this.ObsClienteEnabled && !string.IsNullOrWhiteSpace(x.get_Observacao()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { x.set_Observacao(string.Concat("
", x.get_Observacao().Replace("\r\n", "
"))); ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals18 = variable9; string[] observacao = new string[] { str371, "
"; cSu0024u003cu003e8_locals18.html = string.Concat(observacao); } if (!string.IsNullOrWhiteSpace(x.get_Pasta()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable8 = variable9; string[] pasta = new string[] { str371, ""; variable8.html = string.Concat(pasta); } str371 = string.Concat(str371, "

CLIENTE: ", x.get_Nome(), "

CPF/CNPJ: ", x.get_Documento(), "

", str9, ": ", null, null }; DateTime? nascimento = x.get_Nascimento(); strArrays[20] = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); strArrays[21] = "

FALECIDO: "; cSu0024u003cu003e8_locals11[4] = (x.get_Falecido() ? "SIM" : "NÃO"); cSu0024u003cu003e8_locals11[5] = "

RAMO DE ATIVIDADE: "; nome[4] = x.get_Atividade().get_Nome(); nome[5] = "

ESTADO CIVIL: "; strArrays1[4] = (x.get_EstadoCivil().HasValue ? x.get_EstadoCivil().ToString().ToUpper() : "-"); strArrays1[5] = "

SEXO: "; strArrays1[8] = (x.get_Sexo().HasValue ? x.get_Sexo().ToString().ToUpper() : "-"); strArrays1[9] = "

HABILITAÇÃO: ", (!string.IsNullOrWhiteSpace(x.get_Habilitacao()) ? x.get_Habilitacao() : "-"), "

CATEGORIA: ", (!string.IsNullOrWhiteSpace(x.get_CategoriaHabilitacao()) ? x.get_CategoriaHabilitacao() : "-"), "

1ª HAB.: ", null, null, null, null, null, null }; nascimento = x.get_PrimeiraHabilitacao(); if (nascimento.HasValue) { nascimento = x.get_PrimeiraHabilitacao(); str6 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); } else { str6 = "-"; } strArrays3[12] = str6; strArrays3[13] = "

VENCIMENTO: "; nascimento = x.get_VencimentoHabilitacao(); if (nascimento.HasValue) { nascimento = x.get_VencimentoHabilitacao(); str7 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); } else { str7 = "-"; } strArrays3[16] = str7; strArrays3[17] = "

RG: ", (!string.IsNullOrWhiteSpace(x.get_Identidade()) ? x.get_Identidade() : "-"), "

ORGÃO EMISSOR: ", (!string.IsNullOrWhiteSpace(x.get_Emissor()) ? x.get_Emissor() : "-"), "

ESTADO EMISSOR: ", (!string.IsNullOrWhiteSpace(x.get_EstadoEmissor()) ? x.get_EstadoEmissor() : "-"), "

EXPEDIÇÃO: "; nascimento = x.get_Expedicao(); if (nascimento.HasValue) { nascimento = x.get_Expedicao(); str5 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); } else { str5 = "-"; } cSu0024u003cu003e8_locals14[16] = str5; cSu0024u003cu003e8_locals14[17] = "

BANCO: ", (x.get_Banco() != null ? x.get_Banco().get_Nome() : "-"), "

AGÊNCIA: ", (!string.IsNullOrWhiteSpace(x.get_Agencia()) ? x.get_Agencia() : "-"), "

CONTA: ", (!string.IsNullOrWhiteSpace(x.get_Conta()) ? x.get_Conta() : "-"), "

TIPO: "; strArrays4[16] = (!string.IsNullOrWhiteSpace(x.get_TipoConta()) ? x.get_TipoConta() : "-"); strArrays4[17] = "

CONTATOS: "; strArrays5[4] = str10; strArrays5[5] = "

EMAILS: "; cSu0024u003cu003e8_locals16[4] = str11; cSu0024u003cu003e8_locals16[5] = "

ENDEREÇOS: "; strArrays6[4] = str12; strArrays6[5] = "

PROFISSÃO: "; nome1[4] = x.get_Profissao().get_Nome(); nome1[5] = "

MAIS CONTATOS: "; strArrays7[4] = str13; strArrays7[5] = "

OBSERVAÇÕES: "; observacao[4] = x.get_Observacao(); observacao[5] = "

PASTA: "; pasta[4] = x.get_Pasta(); pasta[5] = "

"); str371 = string.Concat(str371, (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
")); } }); DateTime networkTime = Funcoes.GetNetworkTime(); string[] strArrays8 = new string[] { str371, "

", Recursos.Usuario.get_Nome(), " - ", null, null }; date = networkTime.Date; strArrays8[4] = date.ToShortDateString(); strArrays8[5] = "
"; str371 = string.Concat(strArrays8); string tempPath = Path.GetTempPath(); string str372 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoExtrato)0, networkTime); if (!pdf) { StreamWriter streamWriter = new StreamWriter(str372, true, Encoding.UTF8); streamWriter.Write(str371); streamWriter.Close(); } else { str372 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.pdf", tempPath, (TipoExtrato)0, networkTime); File.WriteAllBytes(str372, (new NRecoHtmlToPdfConverter()).GeneratePdf(str371)); } Process.Start(str372); ExtratosViewModel extratosViewModel = this; str368 = (this.ExtratoResumido ? " RESUMIDO" : ""); if (this.Clientes != null) { str369 = (this.Clientes.Count > 1 ? string.Format("DE {0} CLIENTES", this.Clientes.Count) : string.Concat("DO CLIENTE ", this.Clientes[0].get_Nome())); } else { str369 = ""; } string str373 = string.Concat("GEROU O EXTRATO", str368, " ", str369); long num11 = (long)0; TipoTela? nullable1 = new TipoTela?(23); List clientes = this.Clientes; extratosViewModel.RegistrarAcao(str373, num11, nullable1, string.Concat("NOMES DOS CLIENTES:\n", string.Join("\n", from x in clientes select x.get_Nome()), this.GerarOpcoes())); this.Documentos = null; this.Clientes = null; } else if ((this.Documentos != null || this.Prospeccoes != null) && this.Clientes == null) { str371 = ""; str370 = ""; switch (this.SelectedTipoExtrato) { case 0: { str14 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str14, " DO CLIENTE"); break; } case 1: { str364 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str364, " DA APÓLICE SELECIONADA"); if (!tipoRelatorio.HasValue || tipoRelatorio.GetValueOrDefault() != 4) { break; } str365 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str365, " DO RELATÓRIO DE RENOVAÇÕES"); break; } case 2: { str366 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str366, " DE RELAÇÃO DE APÓLICES"); break; } } str371 = string.Concat(str371, str370); str371 = string.Concat(str371, "
"); List nums = new List(); if (this.Documentos != null && this.Documentos.Count > 0) { List configuracoes = Recursos.Configuracoes; bool flag = configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 42); foreach (Documento documento1 in this.Documentos) { Documento documento2 = documento1; ObservableCollection observableCollection = await (new ParcelaServico()).BuscarParcelasAsync(documento1.get_Id()); documento2.set_Parcelas(observableCollection); documento2 = null; Controle controle = documento1.get_Controle(); Cliente cliente = await this._clienteServico.BuscarCliente(documento1.get_Controle().get_Cliente().get_Id()); controle.set_Cliente(cliente); controle = null; Cliente cliente1 = documento1.get_Controle().get_Cliente(); ObservableCollection observableCollection1 = await this._clienteServico.BuscarEnderecosAsync(documento1.get_Controle().get_Cliente().get_Id()); cliente1.set_Enderecos(observableCollection1); cliente1 = null; cliente1 = documento1.get_Controle().get_Cliente(); ObservableCollection observableCollection2 = await this._clienteServico.BuscarEmailsAsync(documento1.get_Controle().get_Cliente().get_Id()); cliente1.set_Emails(observableCollection2); cliente1 = null; cliente1 = documento1.get_Controle().get_Cliente(); ObservableCollection observableCollection3 = await this._clienteServico.BuscarTelefonesAsync(documento1.get_Controle().get_Cliente().get_Id()); cliente1.set_Telefones(observableCollection3); cliente1 = null; cliente1 = documento1.get_Controle().get_Cliente(); ObservableCollection observableCollection4 = await this._clienteServico.BuscarContatosAsync(documento1.get_Controle().get_Cliente().get_Id()); cliente1.set_Contatos(observableCollection4); cliente1 = null; } bool flag1 = true; foreach (Documento documento3 in this.Documentos) { List items1 = new List(); items = (!this.Endossos ? await (new ItemServico()).BuscarItens(documento3.get_Controle().get_Id(), 0).ToList() : await (new ItemServico()).BuscarItens(documento3.get_Id(), 2).ToList()); List items2 = items; if (this._itensSelecionados == null || this._itensSelecionados.Count <= 0) { items1.AddRange(items2); } else { items2.ForEach((Item x) => { if (this._itensSelecionados.Any((Item y) => y.get_Id() == x.get_Id())) { items1.Add(x); } }); } List perfils = await (new PerfilServico()).BuscarPerfis(documento3.get_Controle().get_Id()); long num12 = (long)0; num10 = 0; if (!flag1) { string str374 = str371; str363 = (this.ExtratoPorPagina ? "
" : ""); str371 = string.Concat(str374, str363); } if (num12 != documento3.get_Controle().get_Cliente().get_Id()) { string str375 = str371; str40 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled || this.ExtratoPorPagina ? "" : "
"); str371 = string.Concat(str375, str40); str371 = string.Concat(str371, "

"); switch (this.SelectedTipoExtrato) { case 0: { str41 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str41, " DO CLIENTE: ", documento3.get_Controle().get_Cliente().get_Nome()); break; } case 1: { str359 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str359, " DA APÓLICE SELECIONADA: ", documento3.get_Apolice()); if (tipoRelatorio.HasValue && tipoRelatorio.GetValueOrDefault() == 4) { str361 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str361, " DA APÓLICE: ", documento3.get_Apolice()); } if (!string.IsNullOrEmpty(documento3.get_Endosso()) && !documento3.get_Endosso().Equals("0")) { str370 = string.Concat(str370, " E DO ENDOSSO: ", documento3.get_Endosso()); } if (!this.SomenteEndossos) { break; } str360 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str360, " DO ENDOSSO: ", documento3.get_Endosso()); break; } case 2: { str362 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str362, " DE RELAÇÃO DE APÓLICES"); break; } } str371 = string.Concat(str371, str370, "


"); str371 = string.Concat(str371, ""); if (!this.ExtratoResumido) { if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any((long x) => x == this.documento.get_Controle().get_Id())) { str176 = (documento3.get_Controle().get_Cliente().get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); string str376 = str176; bool flag2 = documento3.get_Controle().get_Cliente().get_PessoaFisica(); string[] documento4 = new string[24]; documento4[0] = str371; documento4[1] = ""; str371 = string.Concat(strArrays9); } str371 = string.Concat(str371, ""); if (documento3.get_Controle().get_Cliente().get_Atividade() != null) { string[] strArrays10 = new string[] { str371, ""); if (documento3.get_Controle().get_Cliente().get_Profissao() == null || this.SelectedTipoExtrato == 2) { numeroParcela = num10; num10 = numeroParcela + 1; } else { string[] strArrays13 = new string[] { str371, ""; str371 = string.Concat(strArrays13); } str371 = string.Concat(str371, ""); } if (flag2) { string[] strArrays14 = new string[18]; strArrays14[0] = str371; strArrays14[1] = ""; str371 = string.Concat(strArrays14); } if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade())) { string[] strArrays15 = new string[18]; strArrays15[0] = str371; strArrays15[1] = ""; str371 = string.Concat(strArrays15); } if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { string[] strArrays16 = new string[18]; strArrays16[0] = str371; strArrays16[1] = ""; str371 = string.Concat(strArrays16); } if ((documento3.get_Controle().get_Cliente().get_Telefones() != null || documento3.get_Controle().get_Cliente().get_Emails() != null) && this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); if (documento3.get_Controle().get_Cliente().get_Telefones() != null) { string str378 = ""; foreach (ClienteTelefone clienteTelefone in documento3.get_Controle().get_Cliente().get_Telefones()) { string[] numero = new string[] { str378, "
", null, null, null, null, null, null, null, null }; nullable = clienteTelefone.get_Tipo(); if (nullable.HasValue) { tipoTelefone = nullable.GetValueOrDefault(); str208 = tipoTelefone.ToString().ToUpper(); } else { str208 = null; } numero[2] = str208; numero[3] = " ("; numero[4] = clienteTelefone.get_Prefixo(); numero[5] = ") "; numero[6] = clienteTelefone.get_Numero(); numero[7] = " ("; numero[8] = clienteTelefone.get_Observacao(); numero[9] = ") "; str378 = string.Concat(numero); } string[] strArrays17 = new string[] { str371, "
"; str371 = string.Concat(strArrays17); } if (documento3.get_Controle().get_Cliente().get_Emails() != null && !this.ExtratoResumido) { string str379 = ""; foreach (ClienteEmail clienteEmail in documento3.get_Controle().get_Cliente().get_Emails()) { str379 = string.Concat(str379, "
", clienteEmail.get_Email()); } string[] strArrays18 = new string[] { str371, "
"; str371 = string.Concat(strArrays18); } else if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && this.SelectedTipoExtrato != 2) { string str380 = ""; foreach (ClienteEndereco clienteEndereco in documento3.get_Controle().get_Cliente().get_Enderecos()) { string[] cidade = new string[] { str380, "
", clienteEndereco.get_Endereco(), ", ", clienteEndereco.get_Numero(), ", ", null, null, null, null, null, null, null, null }; str205 = (string.IsNullOrWhiteSpace(clienteEndereco.get_Complemento()) ? "" : string.Concat(clienteEndereco.get_Complemento(), ", ")); cidade[6] = str205; cidade[7] = clienteEndereco.get_Bairro(); cidade[8] = " - "; cidade[9] = clienteEndereco.get_Cidade(); cidade[10] = " - "; cidade[11] = clienteEndereco.get_Estado(); cidade[12] = " - "; cidade[13] = clienteEndereco.get_Cep(); str380 = string.Concat(cidade); } string[] strArrays19 = new string[] { str371, "
"; str371 = string.Concat(strArrays19); } numeroParcela = num10; num10 = numeroParcela + 1; str371 = string.Concat(str371, ""); } if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && this.SelectedTipoExtrato != 2 && documento3.get_Controle().get_Cliente().get_Emails() == null && this.ExtratoResumido) { string str381 = ""; foreach (ClienteEndereco clienteEndereco1 in documento3.get_Controle().get_Cliente().get_Enderecos()) { string[] estado = new string[] { str381, "
", clienteEndereco1.get_Endereco(), ", ", clienteEndereco1.get_Numero(), ", ", null, null, null, null, null, null, null, null }; str203 = (string.IsNullOrWhiteSpace(clienteEndereco1.get_Complemento()) ? "" : string.Concat(clienteEndereco1.get_Complemento(), ", ")); estado[6] = str203; estado[7] = clienteEndereco1.get_Bairro(); estado[8] = " - "; estado[9] = clienteEndereco1.get_Cidade(); estado[10] = " - "; estado[11] = clienteEndereco1.get_Estado(); estado[12] = " - "; estado[13] = clienteEndereco1.get_Cep(); str381 = string.Concat(estado); } string[] strArrays20 = new string[] { str371, "
"; str371 = string.Concat(strArrays20); } if (documento3.get_Controle().get_Cliente().get_Contatos() != null && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { string str382 = ""; foreach (MaisContato maisContato in documento3.get_Controle().get_Cliente().get_Contatos()) { string[] strArrays21 = new string[15]; strArrays21[0] = str382; strArrays21[1] = "
NOME: "; strArrays21[2] = maisContato.get_Nome(); str185 = (!string.IsNullOrWhiteSpace(maisContato.get_Documento()) ? string.Concat(", DOCUMENTO: ", maisContato.get_Documento()) : ""); strArrays21[3] = str185; clienteDesde = maisContato.get_Nascimento(); if (clienteDesde.HasValue) { clienteDesde = maisContato.get_Nascimento(); if (clienteDesde.HasValue) { shortDateString9 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString9 = null; } str186 = string.Concat(", NASCIMENTO: ", shortDateString9); } else { str186 = ""; } strArrays21[4] = str186; Parentesco? nullable2 = maisContato.get_Parentesco(); if (nullable2.HasValue) { nullable2 = maisContato.get_Parentesco(); if (nullable2.HasValue) { str187 = nullable2.GetValueOrDefault().ToString().ToUpper(); } else { str187 = null; } str188 = string.Concat(", PARENTESCO: ", str187); } else { str188 = ""; } strArrays21[5] = str188; str189 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) || !string.IsNullOrWhiteSpace(maisContato.get_Agencia()) || !string.IsNullOrWhiteSpace(maisContato.get_Conta()) ? "
" : ""); strArrays21[6] = str189; str190 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) ? string.Concat("BANCO: ", maisContato.get_Banco()) : ""); strArrays21[7] = str190; if (!string.IsNullOrWhiteSpace(maisContato.get_Agencia())) { str191 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) ? ", AGÊNCIA: " : "AGÊNCIA: "); str192 = string.Concat(str191, maisContato.get_Agencia()); } else { str192 = ""; } strArrays21[8] = str192; if (!string.IsNullOrWhiteSpace(maisContato.get_Conta())) { str193 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) || !string.IsNullOrWhiteSpace(maisContato.get_Agencia()) ? ", CONTA: " : "CONTA: "); str194 = string.Concat(str193, maisContato.get_Conta()); } else { str194 = ""; } strArrays21[9] = str194; nullable = maisContato.get_Tipo(); str195 = (nullable.HasValue || !string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) && !string.IsNullOrWhiteSpace(maisContato.get_Telefone()) || !string.IsNullOrWhiteSpace(maisContato.get_Email()) ? "
" : ""); strArrays21[10] = str195; nullable = maisContato.get_Tipo(); if (nullable.HasValue) { nullable = maisContato.get_Tipo(); if (nullable.HasValue) { tipoTelefone = nullable.GetValueOrDefault(); str196 = tipoTelefone.ToString().ToUpper(); } else { str196 = null; } str197 = string.Concat("TIPO DO TELEFONE: ", str196); } else { str197 = ""; } strArrays21[11] = str197; if (string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) || string.IsNullOrWhiteSpace(maisContato.get_Telefone())) { str198 = ""; } else { nullable = maisContato.get_Tipo(); str201 = (nullable.HasValue ? ", TELEFONE: (" : "TELEFONE: ("); str198 = string.Concat(str201, maisContato.get_Prefixo(), ") ", maisContato.get_Telefone()); } strArrays21[12] = str198; if (!string.IsNullOrWhiteSpace(maisContato.get_Email())) { nullable = maisContato.get_Tipo(); str199 = (nullable.HasValue || !string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) && !string.IsNullOrWhiteSpace(maisContato.get_Telefone()) ? ", EMAIL: " : "EMAIL: "); str200 = string.Concat(str199, maisContato.get_Email()); } else { str200 = ""; } strArrays21[13] = str200; strArrays21[14] = "
"; str382 = string.Concat(strArrays21); } string[] strArrays22 = new string[] { str371, "
"; str371 = string.Concat(strArrays22); } if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && !this.ExtratoResumido) { string str383 = ""; foreach (ClienteEndereco clienteEndereco2 in documento3.get_Controle().get_Cliente().get_Enderecos()) { string[] cep = new string[] { str383, "
", clienteEndereco2.get_Endereco(), ", ", clienteEndereco2.get_Numero(), ", ", null, null, null, null, null, null, null, null }; str183 = (string.IsNullOrWhiteSpace(clienteEndereco2.get_Complemento()) ? "" : string.Concat(clienteEndereco2.get_Complemento(), ", ")); cep[6] = str183; cep[7] = clienteEndereco2.get_Bairro(); cep[8] = " - "; cep[9] = clienteEndereco2.get_Cidade(); cep[10] = " - "; cep[11] = clienteEndereco2.get_Estado(); cep[12] = " - "; cep[13] = clienteEndereco2.get_Cep(); str383 = string.Concat(cep); } string[] strArrays23 = new string[] { str371, "
"; str371 = string.Concat(strArrays23); } if (this.ObsCliente && this.ClienteVisibility && this.ObsClienteEnabled && !string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Observacao()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { documento3.get_Controle().get_Cliente().set_Observacao(string.Concat("
", documento3.get_Controle().get_Cliente().get_Observacao().Replace("\r\n", "
"))); string[] strArrays24 = new string[] { str371, "
"; str371 = string.Concat(strArrays24); } if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Pasta()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { string[] strArrays25 = new string[] { str371, ""; str371 = string.Concat(strArrays25); } str371 = string.Concat(str371, "

FALECIDO: "; str239 = (documento3.get_Controle().get_Cliente().get_Falecido() ? "SIM" : "NÃO"); strArrays9[4] = str239; strArrays9[5] = "

ESTADO CIVIL: ", null, null, null, null, null, null, null, null }; if (documento3.get_Controle().get_Cliente().get_EstadoCivil().HasValue) { estadoCivil = documento3.get_Controle().get_Cliente().get_EstadoCivil(); str233 = estadoCivil.ToString().ToUpper(); } else { str233 = "-"; } strArrays12[2] = str233; strArrays12[3] = "

SEXO: "; if (documento3.get_Controle().get_Cliente().get_Sexo().HasValue) { sexo = documento3.get_Controle().get_Cliente().get_Sexo(); str235 = sexo.ToString().ToUpper(); } else { str235 = "-"; } strArrays12[6] = str235; strArrays12[7] = "

"; str371 = string.Concat(strArrays12); } string str377 = str371; clienteDesde = documento3.get_Controle().get_Cliente().get_ClienteDesde(); if (clienteDesde.HasValue) { clienteDesde = documento3.get_Controle().get_Cliente().get_ClienteDesde(); if (clienteDesde.HasValue) { shortDateString13 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString13 = null; } } else { shortDateString13 = "-"; } str371 = string.Concat(str377, "

CLIENTE DESDE: ", shortDateString13, "

PROFISSÃO: "; strArrays13[4] = documento3.get_Controle().get_Cliente().get_Profissao().get_Nome(); strArrays13[5] = "

HABILITAÇÃO: "; str226 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Habilitacao()) ? documento3.get_Controle().get_Cliente().get_Habilitacao() : "-"); strArrays14[4] = str226; strArrays14[5] = "

CATEGORIA: "; str228 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao()) ? documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao() : "-"); strArrays14[8] = str228; strArrays14[9] = "

1ª HAB.: "; clienteDesde = documento3.get_Controle().get_Cliente().get_PrimeiraHabilitacao(); if (clienteDesde.HasValue) { clienteDesde = documento3.get_Controle().get_Cliente().get_PrimeiraHabilitacao(); if (clienteDesde.HasValue) { shortDateString11 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString11 = null; } } else { shortDateString11 = "-"; } strArrays14[12] = shortDateString11; strArrays14[13] = "

VENCIMENTO: "; clienteDesde = documento3.get_Controle().get_Cliente().get_VencimentoHabilitacao(); if (clienteDesde.HasValue) { clienteDesde = documento3.get_Controle().get_Cliente().get_VencimentoHabilitacao(); if (clienteDesde.HasValue) { shortDateString12 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString12 = null; } } else { shortDateString12 = "-"; } strArrays14[16] = shortDateString12; strArrays14[17] = "

RG: "; str219 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); strArrays15[4] = str219; strArrays15[5] = "

ORGÃO EMISSOR: "; str221 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Emissor()) ? documento3.get_Controle().get_Cliente().get_Emissor() : "-"); strArrays15[8] = str221; strArrays15[9] = "

ESTADO EMISSOR: "; str223 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_EstadoEmissor()) ? documento3.get_Controle().get_Cliente().get_EstadoEmissor() : "-"); strArrays15[12] = str223; strArrays15[13] = "

EXPEDIÇÃO: "; clienteDesde = documento3.get_Controle().get_Cliente().get_Expedicao(); if (clienteDesde.HasValue) { clienteDesde = documento3.get_Controle().get_Cliente().get_Expedicao(); if (clienteDesde.HasValue) { shortDateString10 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString10 = null; } } else { shortDateString10 = "-"; } strArrays15[16] = shortDateString10; strArrays15[17] = "

BANCO: "; str211 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-"); strArrays16[4] = str211; strArrays16[5] = "

AGÊNCIA: "; str213 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-"); strArrays16[8] = str213; strArrays16[9] = "

CONTA: "; str215 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-"); strArrays16[12] = str215; strArrays16[13] = "

TIPO: "; str217 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-"); strArrays16[16] = str217; strArrays16[17] = "

CONTATOS: "; strArrays17[4] = str378; strArrays17[5] = "

EMAILS: "; strArrays18[4] = str379; strArrays18[5] = "

ENDEREÇOS: "; strArrays19[4] = str380; strArrays19[5] = "

ENDEREÇOS: "; strArrays20[4] = str381; strArrays20[5] = "

MAIS CONTATOS: "; strArrays22[4] = str382; strArrays22[5] = "

ENDEREÇOS: "; strArrays23[4] = str383; strArrays23[5] = "

OBSERVAÇÕES: "; strArrays24[4] = documento3.get_Controle().get_Cliente().get_Observacao(); strArrays24[5] = "

PASTA: "; strArrays25[4] = documento3.get_Controle().get_Cliente().get_Pasta(); strArrays25[5] = "

"); if (!flag1) { string str384 = str371; str180 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); str371 = string.Concat(str384, str180); } } else { string[] documento5 = new string[14]; documento5[0] = str371; documento5[1] = "

CLIENTE: "; documento5[4] = documento3.get_Controle().get_Cliente().get_Nome(); documento5[5] = "

RG: "; str44 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); documento5[8] = str44; documento5[9] = "

CPF/CNPJ: "; documento5[12] = documento3.get_Controle().get_Cliente().get_Documento(); documento5[13] = "

"; str371 = string.Concat(documento5); } if (this.SelectedTipoExtrato != null) { num10 = 0; string[] shortDateString18 = new string[58]; shortDateString18[0] = str371; shortDateString18[1] = "
"; str371 = string.Concat(shortDateString18); if (!documento3.get_NegocioCorretora().HasValue) { Documento documento6 = documento3; negocioCorretora = (documento3.get_Situacao() != 2 || !documento3.get_Negocio().HasValue || documento3.get_Negocio().GetValueOrDefault() != 1 ? 0 : 1); documento6.set_NegocioCorretora(new NegocioCorretora?(negocioCorretora)); } if (this.ComissaoDocumento && this.ComissaoDocumentoEnabled) { if (this.SelectedTipoExtrato == 2) { string[] strArrays26 = new string[] { str371, ""; str371 = string.Concat(strArrays26); } else { string[] description5 = new string[14]; description5[0] = str371; description5[1] = ""; str371 = string.Concat(description5); } } else if (this.SelectedTipoExtrato != 2) { string[] description6 = new string[] { str371, ""; str371 = string.Concat(description6); } string[] strArrays27 = new string[14]; strArrays27[0] = str371; strArrays27[1] = ""; str371 = string.Concat(strArrays27); if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) { str371 = string.Concat(str371, ""); string str385 = ""; if (documento3.get_Estipulante1() != null) { str385 = string.Concat(str385, documento3.get_Estipulante1().get_Nome(), ", "); } if (documento3.get_Estipulante2() != null) { str385 = string.Concat(str385, documento3.get_Estipulante2().get_Nome(), ", "); } if (documento3.get_Estipulante3() != null) { str385 = string.Concat(str385, documento3.get_Estipulante3().get_Nome(), ", "); } if (documento3.get_Estipulante4() != null) { str385 = string.Concat(str385, documento3.get_Estipulante4().get_Nome(), ", "); } if (documento3.get_Estipulante5() != null) { str385 = string.Concat(str385, documento3.get_Estipulante5().get_Nome(), ", "); } if (!string.IsNullOrWhiteSpace(str385)) { int num13 = str385.LastIndexOf(", ", StringComparison.Ordinal); str385 = str385.Remove(num13, 2).Insert(num13, "."); } string[] strArrays28 = new string[] { str371, ""; str371 = string.Concat(strArrays28); } if (this.SelectedTipoExtrato == 2) { string[] strArrays29 = new string[] { str371, ""; str371 = string.Concat(strArrays29); } else { string[] strArrays30 = new string[] { str371, ""; str371 = string.Concat(strArrays30); if (documento3.get_Controle().get_SeguradoraAnterior() != null && !this.ExtratoResumido) { string[] strArrays31 = new string[] { str371, ""; str371 = string.Concat(strArrays31); } } str371 = string.Concat(str371, "

RAMO: "; shortDateString18[4] = documento3.get_Controle().get_Ramo().get_Nome(); shortDateString18[5] = "

VIGÊNCIA INICIAL: "; date = documento3.get_Vigencia1(); shortDateString18[8] = date.ToShortDateString(); shortDateString18[9] = "

VIGÊNCIA FINAL: "; clienteDesde = documento3.get_Vigencia2(); if (!clienteDesde.HasValue) { shortDateString3 = "-"; } else { clienteDesde = documento3.get_Vigencia2(); if (clienteDesde.HasValue) { shortDateString3 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString3 = null; } } shortDateString18[12] = shortDateString3; shortDateString18[13] = "

CONTRATO: "; str50 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice()); shortDateString18[16] = str50; shortDateString18[17] = "

POSSUI ENDOSSO? "; str52 = (documento3.get_TemEndosso() ? "SIM" : "NÃO"); shortDateString18[20] = str52; shortDateString18[21] = "

ADITAMENTO: "; if (string.IsNullOrWhiteSpace(documento3.get_Endosso())) { if (flag) { IList documentos = documento3.get_Controle().get_Documentos(); if (documentos.Where((Documento x) => { if (x.get_Excluido()) { return false; } return x.get_Ordem() != 0; }).ToList().Count <= 0) { goto Label2; } IList documentos1 = documento3.get_Controle().get_Documentos(); endosso = documentos1.Last((Documento x) => { if (x.get_Excluido()) { return false; } return x.get_Ordem() != 0; }).get_Endosso(); goto Label1; } Label2: endosso = "-"; } else { endosso = documento3.get_Endosso(); } Label1: shortDateString18[24] = endosso; shortDateString18[25] = "

APÓLICE ANTERIOR: "; str55 = (string.IsNullOrWhiteSpace(documento3.get_ApoliceAnterior()) ? "-" : documento3.get_ApoliceAnterior()); shortDateString18[28] = str55; shortDateString18[29] = "

BANCO: "; str57 = (documento3.get_Banco() == null ? "-" : documento3.get_Banco().get_Nome()); shortDateString18[32] = str57; shortDateString18[33] = "

AGÊNCIA: "; str59 = (string.IsNullOrWhiteSpace(documento3.get_Agencia()) ? "-" : documento3.get_Agencia()); shortDateString18[36] = str59; shortDateString18[37] = "

CONTA: "; str61 = (string.IsNullOrWhiteSpace(documento3.get_Conta()) ? "-" : documento3.get_Conta()); shortDateString18[40] = str61; shortDateString18[41] = "

NUMERO CARTÃO: "; str63 = (string.IsNullOrWhiteSpace(documento3.get_NumeroCartao()) ? "-" : documento3.get_NumeroCartao()); shortDateString18[44] = str63; shortDateString18[45] = "

VENCIMENTO: "; str65 = (string.IsNullOrWhiteSpace(documento3.get_VencimentoCartao()) ? "-" : documento3.get_VencimentoCartao()); shortDateString18[48] = str65; shortDateString18[49] = "

BANDEIRA: "; str67 = (!documento3.get_Bandeira().HasValue ? "-" : ValidationHelper.GetDescription(documento3.get_Bandeira())); shortDateString18[52] = str67; shortDateString18[53] = "

TITULAR/PROPONENTE: "; str69 = (string.IsNullOrWhiteSpace(documento3.get_NomeProponente()) ? "-" : documento3.get_NomeProponente()); shortDateString18[56] = str69; shortDateString18[57] = "

COMISSÃO: "; strArrays26[4] = string.Format("{0}%", documento3.get_Comissao()); strArrays26[5] = "

NEGÓCIO CORRETORA: "; description5[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); description5[5] = "

STATUS DO SEGURO: "; description5[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); description5[9] = "

COMISSÃO: "; description5[12] = string.Format("{0}%", documento3.get_Comissao()); description5[13] = "

NEGÓCIO CORRETORA: "; description6[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); description6[5] = "

STATUS DO SEGURO: "; description6[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); description6[9] = "

VENDEDOR: "; str71 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome()); strArrays27[4] = str71; strArrays27[5] = "

REMESSA: "; clienteDesde = documento3.get_Remessa(); if (!clienteDesde.HasValue) { shortDateString4 = "-"; } else { clienteDesde = documento3.get_Remessa(); if (clienteDesde.HasValue) { shortDateString4 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString4 = null; } } strArrays27[8] = shortDateString4; strArrays27[9] = "

EMISSÃO: "; clienteDesde = documento3.get_Emissao(); if (!clienteDesde.HasValue) { shortDateString5 = "-"; } else { clienteDesde = documento3.get_Emissao(); if (clienteDesde.HasValue) { shortDateString5 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString5 = null; } } strArrays27[12] = shortDateString5; strArrays27[13] = "

ESTIPULANTE(S): "; str169 = (string.IsNullOrWhiteSpace(str385) ? "-" : str385); strArrays28[4] = str169; strArrays28[5] = "

SEGURADORA: "; strArrays29[4] = documento3.get_Controle().get_Seguradora().get_Nome(); strArrays29[5] = "

SEGURADORA: "; strArrays30[4] = documento3.get_Controle().get_Seguradora().get_Nome(); strArrays30[5] = "

APÓLICE SINISTRADA: "; str166 = (documento3.get_Sinistro() ? "SIM" : "NÃO"); strArrays30[8] = str166; strArrays30[9] = "

SEGURADORA ANTERIOR: "; strArrays31[4] = documento3.get_Controle().get_SeguradoraAnterior().get_Nome(); strArrays31[5] = "

"); if (!this.ExtratoResumido && (this.PremioParcela || this.ObsApoliceEnabled)) { str371 = string.Concat(str371, ""); if (this.PremioParcela) { string[] strArrays32 = new string[24]; strArrays32[0] = str371; strArrays32[1] = "

PRÊMIO LÍQUIDO:
"; premioLiquido = documento3.get_PremioLiquido(); strArrays32[4] = premioLiquido.ToString("c"); strArrays32[5] = "

ADICIONAL:
"; premioLiquido = documento3.get_PremioAdicional(); strArrays32[8] = premioLiquido.ToString("c"); strArrays32[9] = "

CUSTO APÓLICE:
"; premioLiquido = documento3.get_Custo(); strArrays32[12] = premioLiquido.ToString("c"); strArrays32[13] = "

I.O.F.:
"; premioLiquido = documento3.get_Iof(); strArrays32[16] = premioLiquido.ToString("c"); strArrays32[17] = "

"); str371 = string.Concat(str371, "

"); ObservableCollection parcelas = documento3.get_Parcelas(); if (parcelas != null) { count = parcelas.Count > 0; } else { count = false; } if (count) { str371 = string.Concat(str371, ""); foreach (Parcela parcela in documento3.get_Parcelas()) { string[] description7 = new string[] { str371, ""; str371 = string.Concat(description7); } } } if (this.ObsApolice && this.ObsApoliceEnabled) { string[] strArrays33 = new string[] { str371, ""; str371 = string.Concat(strArrays33); } str371 = string.Concat(str371, "

PARCELA

VENCIMENTO

VALOR

FORMA DE PAGAMENTO

", null, null, null, null, null, null, null, null }; numeroParcela = parcela.get_NumeroParcela(); description7[2] = numeroParcela.ToString(); description7[3] = "

"; date = parcela.get_Vencimento(); description7[4] = date.ToShortDateString(); description7[5] = "

"; description7[6] = string.Format("{0:c}", parcela.get_Valor()); description7[7] = "

"; description7[8] = ValidationHelper.GetDescription(documento3.get_FormaPagamento()); description7[9] = "

OBSERVAÇÕES: "; str157 = (string.IsNullOrWhiteSpace(documento3.get_Observacao()) ? "-" : documento3.get_Observacao()); strArrays33[4] = str157; strArrays33[5] = "

"); } if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled) { List list1 = perfils.ToList(); foreach (Perfil perfil in list1) { num10 = 0; if (string.IsNullOrEmpty(perfil.get_Nome())) { continue; } string[] description8 = new string[92]; description8[0] = str371; description8[1] = "

"; description8[4] = string.Format("CONDUTOR {0}: ", list1.IndexOf(perfil) + 1); description8[5] = ""; description8[6] = perfil.get_Nome(); description8[7] = "

CPF: "; str117 = (string.IsNullOrWhiteSpace(perfil.get_Cpf()) ? "-" : perfil.get_Cpf()); description8[10] = str117; description8[11] = "

NASCIMENTO: "; clienteDesde = perfil.get_Nascimento(); if (!clienteDesde.HasValue) { shortDateString7 = "-"; } else { clienteDesde = perfil.get_Nascimento(); if (clienteDesde.HasValue) { shortDateString7 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString7 = null; } } description8[14] = shortDateString7; description8[15] = "

ESTADO CIVIL: "; str120 = (!perfil.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_EstadoCivil())); description8[18] = str120; description8[19] = "

SEXO: "; str122 = (!perfil.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Sexo())); description8[22] = str122; description8[23] = "

RELAÇÃO SEGURADO/CONDUTOR: "; description8[26] = ValidationHelper.GetDescription(perfil.get_Relacao()); description8[27] = "

HABILITAÇÃO: "; str125 = (string.IsNullOrWhiteSpace(perfil.get_Habilitacao()) ? "-" : perfil.get_Habilitacao()); description8[30] = str125; description8[31] = "

TEMPO DE HABILITAÇÃO: "; str127 = (!perfil.get_TempoHabilitacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TempoHabilitacao())); description8[34] = str127; description8[35] = "

QUATIDADE DE VEÍCULOS: "; if (!perfil.get_VeiculoResidencia().HasValue) { str129 = "-"; } else { numeroParcela = perfil.get_VeiculoResidencia().Value; str129 = numeroParcela.ToString(); } description8[38] = str129; description8[39] = "

GARAGEM NA RESIDÊNCIA: "; str131 = (!perfil.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemResidencia())); description8[42] = str131; description8[43] = "

GARAGEM NO TRABALHO: "; str133 = (!perfil.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemTrabalho())); description8[46] = str133; description8[47] = "

GARAGEM NO ESTUDO: "; str135 = (!perfil.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemEstudo())); description8[50] = str135; description8[51] = "

TIPO DE RESIDÊNCIA: "; str137 = (!perfil.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TipoResidencia())); description8[54] = str137; description8[55] = "

QUILOMETRAGEM MENSAL: "; str139 = (string.IsNullOrWhiteSpace(perfil.get_KmMensal()) ? "-" : perfil.get_KmMensal()); description8[58] = str139; description8[59] = "

DISTÂNCIA ATÉ O TRABALHO: "; str141 = (!perfil.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_DistanciaResidenciaTrabalho())); description8[62] = str141; description8[63] = "

USO PROFISSIONAL: "; str143 = (!perfil.get_UsoProfissional().HasValue || !perfil.get_UsoProfissional().Value ? "NÃO" : "SIM"); description8[66] = str143; description8[67] = "

USO POR DEPENDENTES: "; str145 = (!perfil.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_UsoDependentes())); description8[70] = str145; description8[71] = "

OCUPAÇÃO: "; str147 = (!perfil.get_Ocupacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Ocupacao())); description8[74] = str147; description8[75] = "

SEGURO VIDA: "; str149 = (!perfil.get_SeguroVida().HasValue || !perfil.get_SeguroVida().Value ? "NÃO" : "SIM"); description8[78] = str149; description8[79] = "

ISENÇÃO DE IMPOSTOS: "; str151 = (!perfil.get_Isencao().HasValue || !perfil.get_Isencao().Value ? "NÃO" : "SIM"); description8[82] = str151; description8[83] = "

ANTIFURTO: "; str153 = (perfil.get_AntiFurto().HasValue ? ValidationHelper.GetDescription(perfil.get_AntiFurto()) : ""); description8[86] = str153; description8[87] = "

COBERTURA ESTENDIDA PARA RESIDENTES HABILITADOS: "; str155 = (!perfil.get_EstenderCobertura().HasValue || !perfil.get_EstenderCobertura().Value ? "NÃO" : "SIM"); description8[90] = str155; description8[91] = "

"; str371 = string.Concat(description8); } } list = items1.ToList(); if (list.Count != 0) { num10 = 0; foreach (Item item in list) { if (item.get_Sinistros().Count > 0) { item1 = item; controleSinistros = await (new SinistroServico()).BuscarControles(item.get_Id()); item1.set_Sinistros(controleSinistros); item1 = null; } string str386 = str371; str75 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); str371 = string.Concat(str386, str75); string str387 = str371; str76 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item) == 0 ? "
" : ""); str371 = string.Concat(str387, str76); str371 = string.Concat(str371, ""); str371 = string.Concat(str371, ""); str371 = string.Concat(str371, ""); if (this.SelectedTipoExtrato != 2) { id = documento3.get_Controle().get_Ramo().get_Id(); if (id > (long)5) { if (id == (long)15 || id == (long)18) { goto Label5; } if (id == (long)37) { goto Label3; } goto Label4; } else { if (id - (long)1 <= (long)2) { goto Label5; } if (id == (long)5) { goto Label3; } goto Label4; } Label5: item1 = item; patrimonial = await (new ItemServico()).BuscaPatrimonial(item.get_Id()); item1.set_Patrimonial(patrimonial); item1 = null; string[] numero1 = new string[19]; numero1[0] = str371; numero1[1] = ""; str371 = string.Concat(numero1); } else { string[] descricao2 = new string[] { str371, ""; str371 = string.Concat(descricao2); } Label9: if (item.get_Sinistros().Count > 0) { Item item2 = item; if (item2 != null) { IList sinistros = item2.get_Sinistros(); if (sinistros != null) { ControleSinistro controleSinistro = sinistros.LastOrDefault(); if (controleSinistro != null) { List sinistros1 = controleSinistro.get_Sinistros(); if (sinistros1 != null) { Sinistro sinistro = sinistros1.LastOrDefault(); if (sinistro != null) { dataReclamacao = sinistro.get_DataReclamacao(); } else { clienteDesde = null; dataReclamacao = clienteDesde; } } else { clienteDesde = null; dataReclamacao = clienteDesde; } } else { clienteDesde = null; dataReclamacao = clienteDesde; } } else { clienteDesde = null; dataReclamacao = clienteDesde; } } else { clienteDesde = null; dataReclamacao = clienteDesde; } DateTime? nullable3 = dataReclamacao; if (nullable3.HasValue) { date = nullable3.Value; shortDateString6 = date.ToShortDateString(); } else { shortDateString6 = "-"; } string str388 = shortDateString6; string[] strArrays34 = new string[18]; strArrays34[0] = str371; strArrays34[1] = ""; str371 = string.Concat(strArrays34); } str371 = string.Concat(str371, ""); if (this.SelectedTipoExtrato != 2) { string[] strArrays35 = new string[] { str371, ""; str371 = string.Concat(strArrays35); id = documento3.get_Controle().get_Ramo().get_Id(); long num14 = id - (long)1; if (num14 <= (long)58) { switch ((uint)num14) { case 0: case 1: case 2: case 14: case 17: { if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays36 = new string[] { str371, ""; str371 = string.Concat(strArrays36); break; } case 3: case 7: case 15: case 16: case 18: case 22: case 23: case 25: case 27: case 30: case 32: case 38: case 40: case 43: case 48: case 58: { item1 = item; riscosDiverso = await (new ItemServico()).BuscaRiscosDiversos(item.get_Id()); item1.set_RiscosDiversos(riscosDiverso); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays37 = new string[] { str371, ""; str371 = string.Concat(strArrays37); break; } case 4: case 36: { if (this.ObsItem && this.ObsItemEnabled) { string[] strArrays38 = new string[] { str371, ""; str371 = string.Concat(strArrays38); } string[] strArrays39 = new string[30]; strArrays39[0] = str371; strArrays39[1] = ""; str371 = string.Concat(strArrays39); break; } case 5: case 6: case 8: case 9: case 52: { item1 = item; vida = await (new ItemServico()).BuscaVida(item.get_Id()); item1.set_Vida(vida); item1 = null; if (!item.get_Sinistrado() || !this.BeneficiariosItens || !this.BeneficiariosItensEnabled) { break; } string str389 = str371; str102 = (num10 % 2 == 0 ? "WhiteSmoke" : "White"); str371 = string.Concat(str389, ""); break; } case 12: { item1 = item; aeronautico = await (new ItemServico()).BuscaAeronautico(item.get_Id()); item1.set_Aeronautico(aeronautico); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays40 = new string[] { str371, ""; str371 = string.Concat(strArrays40); break; } case 19: { item1 = item; granizo = await (new ItemServico()).BuscaGranizo(item.get_Id()); item1.set_Granizo(granizo); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays41 = new string[] { str371, ""; str371 = string.Concat(strArrays41); break; } } } else { } } str371 = string.Concat(str371, "

"; numero1[4] = string.Format("ITEM {0}: ", item.get_Ordem()); numero1[5] = ""; numero1[6] = item.get_Patrimonial().get_Endereco(); numero1[7] = ", "; numero1[8] = item.get_Patrimonial().get_Numero(); numero1[9] = ", "; str78 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Complemento()) ? "" : string.Concat(item.get_Patrimonial().get_Complemento(), ", ")); numero1[10] = str78; numero1[11] = item.get_Patrimonial().get_Bairro(); numero1[12] = " - "; numero1[13] = item.get_Patrimonial().get_Cidade(); numero1[14] = " - "; numero1[15] = item.get_Patrimonial().get_Estado(); numero1[16] = " - "; numero1[17] = item.get_Patrimonial().get_Cep(); numero1[18] = "

"; descricao2[4] = string.Format("ITEM {0}: ", item.get_Ordem()); descricao2[5] = ""; descricao2[6] = item.get_Descricao(); descricao2[7] = "

SINISTRO STATUS: "; Item item3 = item; if (item3 != null) { IList controleSinistros1 = item3.get_Sinistros(); if (controleSinistros1 != null) { ControleSinistro controleSinistro1 = controleSinistros1.LastOrDefault(); if (controleSinistro1 != null) { List sinistros2 = controleSinistro1.get_Sinistros(); if (sinistros2 != null) { Sinistro sinistro1 = sinistros2.LastOrDefault(); if (sinistro1 != null) { description2 = ValidationHelper.GetDescription(sinistro1.get_StatusSinistro()); } else { description2 = null; } } else { description2 = null; } } else { description2 = null; } } else { description2 = null; } } else { description2 = null; } strArrays34[4] = description2; strArrays34[5] = "

DATA: "; strArrays34[8] = str388; strArrays34[9] = "

VALOR: "; Item item4 = item; if (item4 != null) { IList controleSinistros2 = item4.get_Sinistros(); if (controleSinistros2 != null) { ControleSinistro controleSinistro2 = controleSinistros2.LastOrDefault(); if (controleSinistro2 != null) { List sinistros3 = controleSinistro2.get_Sinistros(); if (sinistros3 != null) { Sinistro sinistro2 = sinistros3.LastOrDefault(); if (sinistro2 != null) { currency = ValidationHelper.ToCurrency(sinistro2.get_Valor(), "pt-BR"); } else { currency = null; } } else { currency = null; } } else { currency = null; } } else { currency = null; } } else { currency = null; } strArrays34[12] = currency; strArrays34[13] = "

QTDE SINISTRO(S): "; numeroParcela = item.get_Sinistros().Count; strArrays34[16] = numeroParcela.ToString(); strArrays34[17] = "

STATUS: "; str81 = (string.IsNullOrWhiteSpace(item.get_Status()) ? item.get_StatusInclusao() : item.get_Status()); strArrays35[4] = str81; strArrays35[5] = "

ATIVO: "; str83 = (!item.get_Substituido().HasValue ? "SIM" : "NÃO"); strArrays35[8] = str83; strArrays35[9] = "

OBSERVAÇÕES: "; str85 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Item().get_Observacao()) ? "-" : item.get_Patrimonial().get_Item().get_Observacao()); strArrays36[4] = str85; strArrays36[5] = "

BENS E INFORMAÇÕES: "; str87 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Bens()) ? "-" : item.get_Patrimonial().get_Bens()); strArrays36[8] = str87; strArrays36[9] = "

OBSERVAÇÕES: "; str89 = (string.IsNullOrWhiteSpace(item.get_RiscosDiversos().get_Observacao()) ? "-" : item.get_RiscosDiversos().get_Observacao()); strArrays37[4] = str89; strArrays37[5] = "

OBSERVAÇÕES: "; str101 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Observacao()) ? "-" : item.get_Auto().get_Observacao()); strArrays38[4] = str101; strArrays38[5] = "

COBERTURA PADRÃO: "; tipoCobertura = item.get_Auto().get_TipoCobertura(); if (tipoCobertura.HasValue) { description = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault()); } else { description = null; } strArrays39[4] = description; strArrays39[5] = "

BÔNUS: "; bonus = item.get_Auto().get_Bonus(); strArrays39[8] = bonus.ToString(); strArrays39[9] = "

REGIÃO DE CIRCULAÇÃO: "; str93 = (string.IsNullOrWhiteSpace(item.get_Auto().get_RegiaoCirculacao()) ? "-" : item.get_Auto().get_RegiaoCirculacao()); strArrays39[12] = str93; strArrays39[13] = "

TABELA DE REFERÊNCIA: "; tabelaReferencia = item.get_Auto().get_TabelaReferencia(); if (tabelaReferencia.HasValue) { description1 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault()); } else { description1 = null; } strArrays39[16] = description1; strArrays39[17] = "

% DE REFERÊNCIA: "; strArrays39[20] = string.Format("{0}%", item.get_Auto().get_PorcentagemReferencia()); strArrays39[21] = "

CÓDIGO FIPE: "; str97 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Fipe()) ? "-" : item.get_Auto().get_Fipe()); strArrays39[24] = str97; strArrays39[25] = "

COR DO VEÍCULO: "; str99 = (!item.get_Auto().get_Cor().HasValue ? "-" : ValidationHelper.GetDescription(item.get_Auto().get_Cor())); strArrays39[28] = str99; strArrays39[29] = "

BENEFICIÁRIOS: "); string str390 = ""; foreach (ControleSinistro sinistro3 in item.get_Sinistros()) { if (sinistro3.get_Sinistros() == null) { continue; } foreach (Sinistro sinistro4 in sinistro3.get_Sinistros()) { if (string.IsNullOrWhiteSpace(sinistro4.get_SinistroVida().get_Beneficiario())) { continue; } str390 = string.Concat(str390, sinistro4.get_SinistroVida().get_Beneficiario(), ", "); } } if (!string.IsNullOrWhiteSpace(str390)) { int num15 = str390.LastIndexOf(", ", StringComparison.Ordinal); str390 = str390.Remove(num15, 2).Insert(num15, "."); } str371 = string.Concat(str371, str390, "

OBSERVAÇÕES: "; str104 = (string.IsNullOrWhiteSpace(item.get_Aeronautico().get_Observacao()) ? "-" : item.get_Aeronautico().get_Observacao()); strArrays40[4] = str104; strArrays40[5] = "

OBSERVAÇÕES: "; str106 = (string.IsNullOrWhiteSpace(item.get_Granizo().get_Observacao()) ? "-" : item.get_Granizo().get_Observacao()); strArrays41[4] = str106; strArrays41[5] = "

"); if (this.SelectedTipoExtrato != 2) { ObservableCollection observableCollection5 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item.get_Id()); if (observableCollection5.Count > 0 && this.Coberturas) { str371 = string.Concat(str371, "
"); foreach (Cobertura cobertura in observableCollection5) { string[] strArrays42 = new string[] { str371, "" }; str371 = string.Concat(strArrays42); } str371 = string.Concat(str371, "

COBERTURA

FRANQUIA

L.M.I.

PRÊMIO

", cobertura.get_Observacao(), "

", string.Format("{0:c}", cobertura.get_Franquia()), "

", string.Format("{0:c}", cobertura.get_Lmi()), "

", string.Format("{0:c}", cobertura.get_Premio()), "

"); } string str391 = str371; str79 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); str371 = string.Concat(str391, str79); } if (this.SelectedTipoExtrato != 2) { num10 = 0; } } } else { str371 = string.Concat(str371, "

ESTA APÓLICE NÃO POSSUI ITENS

"); } list = null; } else { variable9 = null; return; } } else { bool flag3 = documento3.get_Controle().get_Cliente().get_PessoaFisica(); if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any((long x) => x == this.documento.get_Controle().get_Id())) { string[] strArrays43 = new string[] { str371, ""; str371 = string.Concat(strArrays44); } string[] documento7 = new string[] { str371, ""; str371 = string.Concat(documento7); if (this.SelectedTipoExtrato != 2) { str351 = (documento3.get_Controle().get_Cliente().get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); string str392 = str351; string[] strArrays45 = new string[] { str371, ""; str371 = string.Concat(strArrays46); } } if (this.SelectedTipoExtrato != 2) { string[] strArrays47 = new string[18]; strArrays47[0] = str371; strArrays47[1] = ""; str371 = string.Concat(strArrays47); } if (this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); string str393 = ""; if (documento3.get_Controle().get_Cliente().get_Telefones() != null) { foreach (ClienteTelefone clienteTelefone1 in documento3.get_Controle().get_Cliente().get_Telefones()) { string[] numero2 = new string[] { str393, "
", null, null, null, null, null }; nullable = clienteTelefone1.get_Tipo(); if (nullable.HasValue) { tipoTelefone = nullable.GetValueOrDefault(); str342 = tipoTelefone.ToString().ToUpper(); } else { str342 = null; } numero2[2] = str342; numero2[3] = " ("; numero2[4] = clienteTelefone1.get_Prefixo(); numero2[5] = ") "; numero2[6] = clienteTelefone1.get_Numero(); str393 = string.Concat(numero2); } } string[] strArrays48 = new string[] { str371, "
"; str371 = string.Concat(strArrays48); string str394 = ""; if (documento3.get_Controle().get_Cliente().get_Emails() != null) { foreach (ClienteEmail clienteEmail1 in documento3.get_Controle().get_Cliente().get_Emails()) { str394 = string.Concat(str394, "
", clienteEmail1.get_Email()); } } string[] strArrays49 = new string[] { str371, "
"; str371 = string.Concat(strArrays49); string str395 = ""; if (documento3.get_Controle().get_Cliente().get_Enderecos() != null) { foreach (ClienteEndereco clienteEndereco3 in documento3.get_Controle().get_Cliente().get_Enderecos()) { string[] cidade1 = new string[] { str395, "
", clienteEndereco3.get_Endereco(), ", ", clienteEndereco3.get_Numero(), ", ", null, null, null, null, null, null, null, null }; str341 = (string.IsNullOrWhiteSpace(clienteEndereco3.get_Complemento()) ? "" : string.Concat(clienteEndereco3.get_Complemento(), ", ")); cidade1[6] = str341; cidade1[7] = clienteEndereco3.get_Bairro(); cidade1[8] = " - "; cidade1[9] = clienteEndereco3.get_Cidade(); cidade1[10] = " - "; cidade1[11] = clienteEndereco3.get_Estado(); cidade1[12] = " - "; cidade1[13] = clienteEndereco3.get_Cep(); str395 = string.Concat(cidade1); } } string[] strArrays50 = new string[] { str371, "
"; str371 = string.Concat(strArrays50); str371 = string.Concat(str371, ""); } str371 = string.Concat(str371, "

RG: "; str358 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); strArrays44[4] = str358; strArrays44[5] = "

CPF/CNPJ: "; documento7[4] = documento3.get_Controle().get_Cliente().get_Documento(); documento7[5] = "

ESTADO CIVIL: "; if (documento3.get_Controle().get_Cliente().get_EstadoCivil().HasValue) { estadoCivil = documento3.get_Controle().get_Cliente().get_EstadoCivil(); str354 = estadoCivil.ToString().ToUpper(); } else { str354 = "-"; } strArrays46[4] = str354; strArrays46[5] = "

SEXO: "; if (documento3.get_Controle().get_Cliente().get_Sexo().HasValue) { sexo = documento3.get_Controle().get_Cliente().get_Sexo(); str356 = sexo.ToString().ToUpper(); } else { str356 = "-"; } strArrays46[8] = str356; strArrays46[9] = "

BANCO: "; str344 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-"); strArrays47[4] = str344; strArrays47[5] = "

AGÊNCIA: "; str346 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-"); strArrays47[8] = str346; strArrays47[9] = "

CONTA: "; str348 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-"); strArrays47[12] = str348; strArrays47[13] = "

TIPO: "; str350 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-"); strArrays47[16] = str350; strArrays47[17] = "

CONTATOS: "; str336 = (string.IsNullOrEmpty(str393) ? "-" : str393); strArrays48[4] = str336; strArrays48[5] = "

EMAILS: "; str338 = (string.IsNullOrEmpty(str394) ? "-" : str394); strArrays49[4] = str338; strArrays49[5] = "

ENDEREÇOS: "; str340 = (string.IsNullOrEmpty(str395) ? "-" : str395); strArrays50[4] = str340; strArrays50[5] = "

"); string str396 = str371; str334 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); str371 = string.Concat(str396, str334); } else { string[] documento8 = new string[14]; documento8[0] = str371; documento8[1] = "

CLIENTE: "; documento8[4] = documento3.get_Controle().get_Cliente().get_Nome(); documento8[5] = "

RG: "; str242 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); documento8[8] = str242; documento8[9] = "

CPF/CNPJ: "; documento8[12] = documento3.get_Controle().get_Cliente().get_Documento(); documento8[13] = "

"; str371 = string.Concat(documento8); } if (this.SelectedTipoExtrato != null) { num10 = 0; IList documentos2 = documento3.get_Controle().get_Documentos(); if (documentos2 != null) { documento = documentos2.LastOrDefault((Documento x) => { if (x.get_Excluido()) { return false; } return x.get_Ordem() != 0; }); } else { documento = null; } Documento documento9 = documento; string[] shortDateString19 = new string[26]; shortDateString19[0] = str371; shortDateString19[1] = "
"; str371 = string.Concat(shortDateString19); if (!documento3.get_NegocioCorretora().HasValue) { Documento documento10 = documento3; negocioCorretora1 = (documento3.get_Situacao() != 2 || !documento3.get_Negocio().HasValue || documento3.get_Negocio().GetValueOrDefault() != 1 ? 0 : 1); documento10.set_NegocioCorretora(new NegocioCorretora?(negocioCorretora1)); } if (this.SelectedTipoExtrato != 2) { string[] description9 = new string[] { str371, ""; str371 = string.Concat(description9); } string[] strArrays51 = new string[] { str371, ""; str371 = string.Concat(strArrays51); if (this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); string str397 = ""; if (documento3.get_Estipulante1() != null) { str397 = string.Concat(str397, documento3.get_Estipulante1().get_Nome(), ", "); } if (documento3.get_Estipulante2() != null) { str397 = string.Concat(str397, documento3.get_Estipulante2().get_Nome(), ", "); } if (documento3.get_Estipulante3() != null) { str397 = string.Concat(str397, documento3.get_Estipulante3().get_Nome(), ", "); } if (documento3.get_Estipulante4() != null) { str397 = string.Concat(str397, documento3.get_Estipulante4().get_Nome(), ", "); } if (documento3.get_Estipulante5() != null) { str397 = string.Concat(str397, documento3.get_Estipulante5().get_Nome(), ", "); } if (!string.IsNullOrWhiteSpace(str397)) { int num16 = str397.LastIndexOf(", ", StringComparison.Ordinal); str397 = str397.Remove(num16, 2).Insert(num16, "."); } string[] strArrays52 = new string[] { str371, ""; str371 = string.Concat(strArrays52); } if (this.SelectedTipoExtrato == 2) { string[] strArrays53 = new string[] { str371, ""; str371 = string.Concat(strArrays53); } else { string[] strArrays54 = new string[] { str371, ""; str371 = string.Concat(strArrays54); } string[] description10 = new string[] { str371, ""; str371 = string.Concat(description10); str371 = string.Concat(str371, "

RAMO: "; shortDateString19[4] = documento3.get_Controle().get_Ramo().get_Nome(); shortDateString19[5] = "

VIGÊNCIA INICIAL: "; date = documento3.get_Vigencia1(); shortDateString19[8] = date.ToShortDateString(); shortDateString19[9] = "

VIGÊNCIA FINAL: "; clienteDesde = documento3.get_Vigencia2(); if (!clienteDesde.HasValue) { shortDateString14 = "-"; } else { clienteDesde = documento3.get_Vigencia2(); if (clienteDesde.HasValue) { shortDateString14 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString14 = null; } } shortDateString19[12] = shortDateString14; shortDateString19[13] = "

CONTRATO: "; str248 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice()); shortDateString19[16] = str248; shortDateString19[17] = "

POSSUI ENDOSSO? "; str250 = (documento3.get_TemEndosso() ? "SIM" : "NÃO"); shortDateString19[20] = str250; shortDateString19[21] = "

ADITAMENTO: "; if (string.IsNullOrWhiteSpace(documento3.get_Endosso())) { endosso1 = (!flag || documento9 == null ? "-" : documento9.get_Endosso()); } else { endosso1 = documento3.get_Endosso(); } shortDateString19[24] = endosso1; shortDateString19[25] = "

NEGÓCIO CORRETORA: "; description9[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); description9[5] = "

STATUS DO SEGURO: "; description9[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); description9[9] = "

VENDEDOR: "; str253 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome()); strArrays51[4] = str253; strArrays51[5] = "

ESTIPULANTE(S): "; str329 = (string.IsNullOrWhiteSpace(str397) ? "-" : str397); strArrays52[4] = str329; strArrays52[5] = "

SEGURADORA: "; strArrays53[4] = documento3.get_Controle().get_Seguradora().get_Nome(); strArrays53[5] = "

SEGURADORA: "; strArrays54[4] = documento3.get_Controle().get_Seguradora().get_Nome(); strArrays54[5] = "

APÓLICE SINISTRADA: "; str327 = (documento3.get_Sinistro() ? "SIM" : "NÃO"); strArrays54[8] = str327; strArrays54[9] = "

FORMA PAGAMENTO: "; description10[4] = ValidationHelper.GetDescription(documento3.get_FormaPagamento()); description10[5] = "

"); if (this.PremioParcela || this.ExtratoResumido) { str371 = string.Concat(str371, ""); if (this.ComissaoDocumento && this.ComissaoDocumentoEnabled || this.ExtratoResumido) { string[] strArrays55 = new string[] { str371, ""; str371 = string.Concat(strArrays55); } string[] strArrays56 = new string[26]; strArrays56[0] = str371; strArrays56[1] = ""; str371 = string.Concat(strArrays56); str371 = string.Concat(str371, "

COMISSÃO: "; strArrays55[4] = string.Format("{0:n2}%", Math.Round(documento3.get_Comissao(), 2)); strArrays55[5] = "

PRÊMIO LÍQUIDO: "; strArrays56[4] = string.Format("{0:c}", Math.Round(documento3.get_PremioLiquido(), 2)); strArrays56[5] = "

ADICIONAL: "; strArrays56[8] = string.Format("{0:c}", Math.Round(documento3.get_PremioAdicional(), 2)); strArrays56[9] = "

CUSTO APÓLICE: "; strArrays56[12] = string.Format("{0:c}", Math.Round(documento3.get_Custo(), 2)); strArrays56[13] = "

I.O.F.: "; strArrays56[16] = string.Format("{0:c}", Math.Round(documento3.get_Iof(), 2)); strArrays56[17] = "

PRÊMIO TOTAL: "; strArrays56[20] = string.Format("{0:c}", Math.Round(documento3.get_PremioTotal(), 2)); strArrays56[21] = "

Nº PARCELAS: "; premioLiquido = documento3.get_NumeroParcelas(); strArrays56[24] = premioLiquido.ToString(); strArrays56[25] = "

"); } if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled) { List perfils1 = perfils.ToList(); foreach (Perfil perfil1 in perfils1) { num10 = 0; if (string.IsNullOrEmpty(perfil1.get_Nome())) { continue; } string[] description11 = new string[60]; description11[0] = str371; description11[1] = "

"; description11[4] = string.Format("CONDUTOR {0}: ", perfils1.IndexOf(perfil1) + 1); description11[5] = ""; description11[6] = perfil1.get_Nome(); description11[7] = "

CPF: "; str301 = (string.IsNullOrWhiteSpace(perfil1.get_Cpf()) ? "-" : perfil1.get_Cpf()); description11[10] = str301; description11[11] = "

NASCIMENTO: "; clienteDesde = perfil1.get_Nascimento(); if (!clienteDesde.HasValue) { shortDateString16 = "-"; } else { clienteDesde = perfil1.get_Nascimento(); if (clienteDesde.HasValue) { shortDateString16 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString16 = null; } } description11[14] = shortDateString16; description11[15] = "

ESTADO CIVIL: "; str304 = (!perfil1.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_EstadoCivil())); description11[18] = str304; description11[19] = "

SEXO: "; str306 = (!perfil1.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_Sexo())); description11[22] = str306; description11[23] = "

RELAÇÃO SEGURADO/CONDUTOR: "; description11[26] = ValidationHelper.GetDescription(perfil1.get_Relacao()); description11[27] = "

GARAGEM NA RESIDÊNCIA: "; str309 = (!perfil1.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemResidencia())); description11[30] = str309; description11[31] = "

GARAGEM NO TRABALHO: "; str311 = (!perfil1.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemTrabalho())); description11[34] = str311; description11[35] = "

GARAGEM NO ESTUDO: "; str313 = (!perfil1.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemEstudo())); description11[38] = str313; description11[39] = "

TIPO DE RESIDÊNCIA: "; str315 = (!perfil1.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_TipoResidencia())); description11[42] = str315; description11[43] = "

DISTÂNCIA ATÉ O TRABALHO: "; str317 = (!perfil1.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_DistanciaResidenciaTrabalho())); description11[46] = str317; description11[47] = "

USO PROFISSIONAL: "; str319 = (!perfil1.get_UsoProfissional().HasValue || !perfil1.get_UsoProfissional().Value ? "NÃO" : "SIM"); description11[50] = str319; description11[51] = "

USO POR DEPENDENTES: "; str321 = (!perfil1.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_UsoDependentes())); description11[54] = str321; description11[55] = "

ISENÇÃO DE IMPOSTOS: "; str323 = (!perfil1.get_Isencao().HasValue || !perfil1.get_Isencao().Value ? "NÃO" : "SIM"); description11[58] = str323; description11[59] = "

"; str371 = string.Concat(description11); } } list = items1.ToList(); if (list.Count != 0) { num10 = 0; foreach (Item item5 in list) { if (item5.get_Sinistros().Count > 0) { item1 = item5; controleSinistros = await (new SinistroServico()).BuscarControles(item5.get_Id()); item1.set_Sinistros(controleSinistros); item1 = null; } string str398 = str371; str262 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); str371 = string.Concat(str398, str262); string str399 = str371; str263 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item5) == 0 ? "
" : ""); str371 = string.Concat(str399, str263); str371 = string.Concat(str371, ""); str371 = string.Concat(str371, ""); str371 = string.Concat(str371, ""); if (this.SelectedTipoExtrato != 2) { id = documento3.get_Controle().get_Ramo().get_Id(); if (id > (long)5) { if (id == (long)15 || id == (long)18) { goto Label8; } if (id == (long)37) { goto Label6; } goto Label7; } else { if (id - (long)1 <= (long)2) { goto Label8; } if (id == (long)5) { goto Label6; } goto Label7; } Label8: item1 = item5; patrimonial = await (new ItemServico()).BuscaPatrimonial(item5.get_Id()); item1.set_Patrimonial(patrimonial); item1 = null; string[] estado1 = new string[19]; estado1[0] = str371; estado1[1] = ""; str371 = string.Concat(estado1); } else { string[] descricao3 = new string[] { str371, ""; str371 = string.Concat(descricao3); } Label10: if (item5.get_Sinistros().Count > 0) { Item item6 = item5; if (item6 != null) { IList controleSinistros3 = item6.get_Sinistros(); if (controleSinistros3 != null) { ControleSinistro controleSinistro3 = controleSinistros3.LastOrDefault(); if (controleSinistro3 != null) { List sinistros4 = controleSinistro3.get_Sinistros(); if (sinistros4 != null) { Sinistro sinistro5 = sinistros4.LastOrDefault(); if (sinistro5 != null) { dataReclamacao1 = sinistro5.get_DataReclamacao(); } else { clienteDesde = null; dataReclamacao1 = clienteDesde; } } else { clienteDesde = null; dataReclamacao1 = clienteDesde; } } else { clienteDesde = null; dataReclamacao1 = clienteDesde; } } else { clienteDesde = null; dataReclamacao1 = clienteDesde; } } else { clienteDesde = null; dataReclamacao1 = clienteDesde; } DateTime? nullable4 = dataReclamacao1; if (nullable4.HasValue) { date = nullable4.Value; shortDateString15 = date.ToShortDateString(); } else { shortDateString15 = "-"; } string str400 = shortDateString15; string[] currency1 = new string[14]; currency1[0] = str371; currency1[1] = ""; str371 = string.Concat(currency1); } str371 = string.Concat(str371, ""); if (this.SelectedTipoExtrato != 2) { string[] strArrays57 = new string[] { str371, ""; str371 = string.Concat(strArrays57); id = documento3.get_Controle().get_Ramo().get_Id(); long num17 = id - (long)1; if (num17 <= (long)58) { switch ((uint)num17) { case 0: case 1: case 2: case 14: case 17: { if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays58 = new string[] { str371, ""; str371 = string.Concat(strArrays58); break; } case 3: case 7: case 15: case 16: case 18: case 22: case 23: case 25: case 27: case 30: case 32: case 38: case 40: case 43: case 48: case 58: { item1 = item5; riscosDiverso = await (new ItemServico()).BuscaRiscosDiversos(item5.get_Id()); item1.set_RiscosDiversos(riscosDiverso); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays59 = new string[] { str371, ""; str371 = string.Concat(strArrays59); break; } case 4: case 36: { if (this.ObsItem && this.ObsItemEnabled) { string[] strArrays60 = new string[] { str371, ""; str371 = string.Concat(strArrays60); } string[] strArrays61 = new string[26]; strArrays61[0] = str371; strArrays61[1] = ""; str371 = string.Concat(strArrays61); break; } case 5: case 6: case 8: case 9: case 52: { item1 = item5; vida = await (new ItemServico()).BuscaVida(item5.get_Id()); item1.set_Vida(vida); item1 = null; if (!item5.get_Sinistrado() || !this.BeneficiariosItens || !this.BeneficiariosItensEnabled) { break; } string str401 = str371; str287 = (num10 % 2 == 0 ? "WhiteSmoke" : "White"); str371 = string.Concat(str401, ""); break; } case 12: { item1 = item5; aeronautico = await (new ItemServico()).BuscaAeronautico(item5.get_Id()); item1.set_Aeronautico(aeronautico); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays62 = new string[] { str371, ""; str371 = string.Concat(strArrays62); break; } case 19: { item1 = item5; granizo = await (new ItemServico()).BuscaGranizo(item5.get_Id()); item1.set_Granizo(granizo); item1 = null; if (!this.ObsItem || !this.ObsItemEnabled) { break; } string[] strArrays63 = new string[] { str371, ""; str371 = string.Concat(strArrays63); break; } } } else { } } str371 = string.Concat(str371, "

"; estado1[4] = string.Format("ITEM {0}: ", item5.get_Ordem()); estado1[5] = ""; estado1[6] = item5.get_Patrimonial().get_Endereco(); estado1[7] = ", "; estado1[8] = item5.get_Patrimonial().get_Numero(); estado1[9] = ", "; str265 = (string.IsNullOrWhiteSpace(item5.get_Patrimonial().get_Complemento()) ? "" : string.Concat(item5.get_Patrimonial().get_Complemento(), ", ")); estado1[10] = str265; estado1[11] = item5.get_Patrimonial().get_Bairro(); estado1[12] = " - "; estado1[13] = item5.get_Patrimonial().get_Cidade(); estado1[14] = " - "; estado1[15] = item5.get_Patrimonial().get_Estado(); estado1[16] = " - "; estado1[17] = item5.get_Patrimonial().get_Cep(); estado1[18] = "

"; descricao3[4] = string.Format("ITEM {0}: ", item5.get_Ordem()); descricao3[5] = ""; descricao3[6] = item5.get_Descricao(); descricao3[7] = "

SINISTRO STATUS: "; currency1[4] = ValidationHelper.GetDescription(item5.get_Sinistros().LastOrDefault().get_Sinistros().LastOrDefault().get_StatusSinistro()); currency1[5] = "

DATA: "; currency1[8] = str400; currency1[9] = "

VALOR: "; currency1[12] = ValidationHelper.ToCurrency(item5.get_Sinistros().LastOrDefault().get_Sinistros().LastOrDefault().get_Valor(), "pt-BR"); currency1[13] = "

ATIVO: "; str272 = (!item5.get_Substituido().HasValue ? "SIM" : "NÃO"); strArrays57[4] = str272; strArrays57[5] = "

OBSERVAÇÕES: "; str274 = (string.IsNullOrWhiteSpace(item5.get_Patrimonial().get_Bens()) ? "-" : item5.get_Patrimonial().get_Bens()); strArrays58[4] = str274; strArrays58[5] = "

OBSERVAÇÕES: "; str276 = (string.IsNullOrWhiteSpace(item5.get_RiscosDiversos().get_Observacao()) ? "-" : item5.get_RiscosDiversos().get_Observacao()); strArrays59[4] = str276; strArrays59[5] = "

OBSERVAÇÕES: "; str286 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Observacao()) ? "-" : item5.get_Auto().get_Observacao()); strArrays60[4] = str286; strArrays60[5] = "

COBERTURA PADRÃO: "; tipoCobertura = item5.get_Auto().get_TipoCobertura(); if (tipoCobertura.HasValue) { description3 = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault()); } else { description3 = null; } strArrays61[4] = description3; strArrays61[5] = "

BÔNUS: "; bonus = item5.get_Auto().get_Bonus(); strArrays61[8] = bonus.ToString(); strArrays61[9] = "

REGIÃO DE CIRCULAÇÃO: "; str280 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_RegiaoCirculacao()) ? "-" : item5.get_Auto().get_RegiaoCirculacao()); strArrays61[12] = str280; strArrays61[13] = "

TABELA DE REFERÊNCIA: "; tabelaReferencia = item5.get_Auto().get_TabelaReferencia(); if (tabelaReferencia.HasValue) { description4 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault()); } else { description4 = null; } strArrays61[16] = description4; strArrays61[17] = "

FIPE: "; str283 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Fipe()) ? "-" : item5.get_Auto().get_Fipe()); strArrays61[20] = str283; strArrays61[21] = "

% DE REFERÊNCIA: "; strArrays61[24] = string.Format("{0}%", item5.get_Auto().get_PorcentagemReferencia()); strArrays61[25] = "

BENEFICIÁRIOS: "); string str402 = ""; foreach (ControleSinistro controleSinistro4 in item5.get_Sinistros()) { if (controleSinistro4.get_Sinistros() == null) { continue; } foreach (Sinistro sinistro6 in controleSinistro4.get_Sinistros()) { if (string.IsNullOrWhiteSpace(sinistro6.get_SinistroVida().get_Beneficiario())) { continue; } str402 = string.Concat(str402, sinistro6.get_SinistroVida().get_Beneficiario(), ", "); } } if (!string.IsNullOrWhiteSpace(str402)) { int num18 = str402.LastIndexOf(", ", StringComparison.Ordinal); str402 = str402.Remove(num18, 2).Insert(num18, "."); } str371 = string.Concat(str371, str402, "

OBSERVAÇÕES: "; str289 = (string.IsNullOrWhiteSpace(item5.get_Aeronautico().get_Observacao()) ? "-" : item5.get_Aeronautico().get_Observacao()); strArrays62[4] = str289; strArrays62[5] = "

OBSERVAÇÕES: "; str291 = (string.IsNullOrWhiteSpace(item5.get_Granizo().get_Observacao()) ? "-" : item5.get_Granizo().get_Observacao()); strArrays63[4] = str291; strArrays63[5] = "

"); if (this.SelectedTipoExtrato != 2) { ObservableCollection observableCollection6 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item5.get_Id()); if (observableCollection6.Count > 0 && this.Coberturas) { str371 = string.Concat(str371, "
"); foreach (Cobertura cobertura1 in observableCollection6) { numeroParcela = num10; num10 = numeroParcela + 1; string[] strArrays64 = new string[18]; strArrays64[0] = str371; strArrays64[1] = "

COBERTURA

FRANQUIA

LMI

PRÊMIO

"; strArrays64[4] = cobertura1.get_Observacao(); strArrays64[5] = "

"); } string str403 = str371; str266 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); str371 = string.Concat(str403, str266); } if (this.SelectedTipoExtrato != 2) { num10 = 0; } } } else { str371 = string.Concat(str371, "

ESTA APÓLICE NÃO POSSUI ITENS

"); } list = null; } else { variable9 = null; return; } } } nums.Add(documento3.get_Controle().get_Id()); flag1 = false; } } if (this.Prospeccoes != null && this.Prospeccoes.Count > 0) { foreach (Prospeccao prospecco in this.Prospeccoes) { int num19 = 0; string str404 = str371; str19 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); str371 = string.Concat(str404, str19); str371 = string.Concat(str371, "

"); if (this.SelectedTipoExtrato == null) { str39 = (this.ExtratoResumido ? " RESUMIDO" : ""); str370 = string.Concat("EXTRATO", str39, " DO CLIENTE: ", prospecco.get_Nome()); } str371 = string.Concat(str371, str370, "


"); str371 = string.Concat(str371, ""); if (!this.ExtratoResumido) { string str405 = "NASCIMENTO"; string[] documento11 = new string[16]; documento11[0] = str371; documento11[1] = ""; str371 = string.Concat(documento11); if ((prospecco.get_Telefone1() != null || prospecco.get_Email() != null) && this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); if (prospecco.get_Telefone1() != null) { string str406 = ""; string[] prefixo1 = new string[] { str406, "
(", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() }; str406 = string.Concat(prefixo1); if (prospecco.get_Telefone2() != null) { string[] prefixo2 = new string[] { str406, "
(", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() }; str406 = string.Concat(prefixo2); } string[] strArrays65 = new string[] { str371, "
"; str371 = string.Concat(strArrays65); } if (prospecco.get_Email() != null && !this.ExtratoResumido) { string str407 = ""; str407 = string.Concat(str407, "
", prospecco.get_Email()); string[] strArrays66 = new string[] { str371, "
"; str371 = string.Concat(strArrays66); } num19++; str371 = string.Concat(str371, ""); } string str408 = str371; str23 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : ""); str371 = string.Concat(str408, str23); if (this.SelectedTipoExtrato != null) { num19 = 0; string[] strArrays67 = new string[] { str371, "

CLIENTE: "; documento11[4] = prospecco.get_Nome(); documento11[5] = "

CPF/CNPJ: "; documento11[8] = prospecco.get_Documento(); documento11[9] = "

"; documento11[12] = str405; documento11[13] = ": "; clienteDesde = prospecco.get_Nascimento(); if (clienteDesde.HasValue) { shortDateString = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString = null; } documento11[14] = shortDateString; documento11[15] = "

CONTATOS: "; strArrays65[4] = str406; strArrays65[5] = "

EMAILS: "; strArrays66[4] = str407; strArrays66[5] = "

"; str371 = string.Concat(strArrays67); string[] strArrays68 = new string[] { str371, ""; str371 = string.Concat(strArrays68); str371 = string.Concat(str371, "

VIGÊNCIA FINAL: "; clienteDesde = prospecco.get_VigenciaFinal(); if (!clienteDesde.HasValue) { shortDateString1 = "-"; } else { clienteDesde = prospecco.get_VigenciaFinal(); if (clienteDesde.HasValue) { shortDateString1 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString1 = null; } } strArrays67[4] = shortDateString1; strArrays67[5] = "

VENDEDOR: "; str26 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome()); strArrays68[4] = str26; strArrays68[5] = "

"); } else { variable9 = null; return; } } else { string[] documento12 = new string[] { str371, ""; str371 = string.Concat(documento12); if (this.SelectedTipoExtrato != 2) { str371 = string.Concat(str371, ""); string str409 = ""; if (prospecco.get_Telefone1() != null) { string[] prefixo11 = new string[] { str409, "
(", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() }; str409 = string.Concat(prefixo11); } if (prospecco.get_Telefone2() != null) { string[] prefixo21 = new string[] { str409, "
(", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() }; str409 = string.Concat(prefixo21); } string[] strArrays69 = new string[] { str371, "
"; str371 = string.Concat(strArrays69); string str410 = ""; if (prospecco.get_Email() != null) { str410 = string.Concat("
", prospecco.get_Email()); } string[] strArrays70 = new string[] { str371, "
"; str371 = string.Concat(strArrays70); } str371 = string.Concat(str371, "

CLIENTE: "; documento12[4] = prospecco.get_Nome(); documento12[5] = "

CPF/CNPJ: "; documento12[8] = prospecco.get_Documento(); documento12[9] = "

CONTATOS: "; str36 = (string.IsNullOrEmpty(str409) ? "-" : str409); strArrays69[4] = str36; strArrays69[5] = "

EMAILS: "; str38 = (string.IsNullOrEmpty(str410) ? "-" : str410); strArrays70[4] = str38; strArrays70[5] = "

"); string str411 = str371; str31 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); str371 = string.Concat(str411, str31); if (this.SelectedTipoExtrato != null) { num19 = 0; string[] strArrays71 = new string[] { str371, "
"; str371 = string.Concat(strArrays71); string[] strArrays72 = new string[] { str371, ""; str371 = string.Concat(strArrays72); str371 = string.Concat(str371, "

VIGÊNCIA FINAL: "; clienteDesde = prospecco.get_VigenciaFinal(); if (!clienteDesde.HasValue) { shortDateString2 = "-"; } else { clienteDesde = prospecco.get_VigenciaFinal(); if (clienteDesde.HasValue) { shortDateString2 = clienteDesde.GetValueOrDefault().ToShortDateString(); } else { shortDateString2 = null; } } strArrays71[4] = shortDateString2; strArrays71[5] = "

VENDEDOR: "; str34 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome()); strArrays72[4] = str34; strArrays72[5] = "

"); } else { variable9 = null; return; } } } } DateTime dateTime = Funcoes.GetNetworkTime(); string[] shortDateString20 = new string[] { str371, "

", Recursos.Usuario.get_Nome(), " - ", null, null }; date = dateTime.Date; shortDateString20[4] = date.ToShortDateString(); shortDateString20[5] = "
"; str371 = string.Concat(shortDateString20); string tempPath1 = Path.GetTempPath(); string str412 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath1, (TipoExtrato)0, dateTime); if (!pdf) { StreamWriter streamWriter1 = new StreamWriter(str412, true, Encoding.UTF8); streamWriter1.Write(str371); streamWriter1.Close(); } else { str412 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.pdf", tempPath1, (TipoExtrato)0, dateTime); File.WriteAllBytes(str412, (new NRecoHtmlToPdfConverter()).GeneratePdf(str371)); } Process.Start(str412); if (this.Documentos != null && this.Documentos.Count > 1) { ExtratosViewModel extratosViewModel1 = this; str17 = (this.ExtratoResumido ? " RESUMIDO" : ""); if (this.Documentos != null) { str18 = (this.Documentos.Count > 1 ? string.Format("DE {0} DOCUMENTOS", this.Documentos.Count) : string.Format("DO DOCUMENTO {0}", this.Documentos[0].get_Id())); } else { str18 = ""; } string str413 = string.Concat("GEROU O EXTRATO", str17, " ", str18); long num24 = (long)0; TipoTela? nullable5 = new TipoTela?(23); List documentos3 = this.Documentos; extratosViewModel1.RegistrarAcao(str413, num24, nullable5, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join("\n", from x in documentos3 select x.get_Id()), this.GerarOpcoes())); } if (this.Prospeccoes != null && this.Prospeccoes.Count > 1) { ExtratosViewModel extratosViewModel2 = this; str15 = (this.ExtratoResumido ? " RESUMIDO" : ""); if (this.Prospeccoes != null) { str16 = (this.Prospeccoes.Count > 1 ? string.Format("DE {0} PROSPECÇÕES", this.Prospeccoes.Count) : string.Format("DA PROSPÇÃO{0}", this.Prospeccoes[0].get_Id())); } else { str16 = ""; } string str414 = string.Concat("GEROU O EXTRATO", str15, " ", str16); long num25 = (long)0; TipoTela? nullable6 = new TipoTela?(23); List prospeccoes = this.Prospeccoes; extratosViewModel2.RegistrarAcao(str414, num25, nullable6, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join("\n", from x in prospeccoes select x.get_Id()), this.GerarOpcoes())); } this.Documentos = null; this.Clientes = null; this.Prospeccoes = null; nums = null; } variable9 = null; return; Label3: item1 = item; auto = await (new ItemServico()).BuscaAuto(item.get_Id()); item1.set_Auto(auto); item1 = null; string[] modelo = new string[26]; modelo[0] = str371; modelo[1] = "

"; modelo[4] = string.Format("ITEM {0}: ", item.get_Ordem()); modelo[5] = "
"; Fabricante fabricante = item.get_Auto().get_Fabricante(); if (fabricante != null) { descricao = fabricante.get_Descricao(); } else { descricao = null; } modelo[6] = descricao; modelo[7] = " "; modelo[8] = item.get_Auto().get_Modelo(); modelo[9] = " ("; modelo[10] = item.get_Auto().get_AnoFabricacao(); modelo[11] = "/"; modelo[12] = item.get_Auto().get_AnoModelo(); modelo[13] = ")
PLACA: "; modelo[14] = item.get_Auto().get_Placa(); modelo[15] = ", CHASSI: "; modelo[16] = item.get_Auto().get_Chassi(); modelo[17] = "
C.I.: "; modelo[18] = item.get_Auto().get_Ci(); modelo[19] = ", RENAVAM: "; modelo[20] = item.get_Auto().get_Renavam(); modelo[21] = ", CEP PERNOITE: "; modelo[22] = item.get_Auto().get_CepPernoite(); modelo[23] = "
FINANCIADO: "; str112 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO"); modelo[24] = str112; modelo[25] = "

"; str371 = string.Concat(modelo); goto Label9; Label4: string[] descricao4 = new string[] { str371, "

"; descricao4[4] = string.Format("ITEM {0}: ", item.get_Ordem()); descricao4[5] = ""; descricao4[6] = item.get_Descricao(); descricao4[7] = "

QTDE SINISTRO(S): "; numeroParcela = item.get_Sinistros().Count; descricao4[8] = numeroParcela.ToString(); descricao4[9] = "

"; str371 = string.Concat(descricao4); goto Label9; Label6: item1 = item; auto = await (new ItemServico()).BuscaAuto(item.get_Id()); item1.set_Auto(auto); item1 = null; string[] anoFabricacao = new string[26]; anoFabricacao[0] = str371; anoFabricacao[1] = "

"; anoFabricacao[4] = string.Format("ITEM {0}: ", item.get_Ordem()); anoFabricacao[5] = "
"; Fabricante fabricante1 = item.get_Auto().get_Fabricante(); if (fabricante1 != null) { descricao1 = fabricante1.get_Descricao(); } else { descricao1 = null; } anoFabricacao[6] = descricao1; anoFabricacao[7] = " "; anoFabricacao[8] = item.get_Auto().get_Modelo(); anoFabricacao[9] = " ("; anoFabricacao[10] = item.get_Auto().get_AnoFabricacao(); anoFabricacao[11] = "/"; anoFabricacao[12] = item.get_Auto().get_AnoModelo(); anoFabricacao[13] = ")
PLACA: "; anoFabricacao[14] = item.get_Auto().get_Placa(); anoFabricacao[15] = ", CHASSI: "; anoFabricacao[16] = item.get_Auto().get_Chassi(); anoFabricacao[17] = "
C.I.: "; anoFabricacao[18] = item.get_Auto().get_Ci(); anoFabricacao[19] = ", RENAVAM: "; anoFabricacao[20] = item.get_Auto().get_Renavam(); anoFabricacao[21] = ", CEP PERNOITE: "; anoFabricacao[22] = item.get_Auto().get_CepPernoite(); anoFabricacao[23] = "
FINANCIADO: "; str296 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO"); anoFabricacao[24] = str296; anoFabricacao[25] = "

"; str371 = string.Concat(anoFabricacao); goto Label10; Label7: string[] descricao5 = new string[] { str371, "

"; descricao5[4] = string.Format("ITEM {0}: ", item.get_Ordem()); descricao5[5] = ""; descricao5[6] = item.get_Descricao(); descricao5[7] = "

"; str371 = string.Concat(descricao5); goto Label10; } public string GerarOpcoes() { string str = ""; if (this.ClienteVisibility && this.ObsCliente && this.ObsClienteEnabled) { str = string.Concat(str, "\nOBSERVAÇÕES DO CLIENTE"); } if (this.ClientePorPaginaVisibility == Visibility.Visible && this.ClientePorPagina && this.ClientePorPaginaEnabled) { str = string.Concat(str, "\nSEPARAR CLIENTES POR PÁGINA"); } if (this.DocumentoVisibility) { if (this.ComissaoDocumentoEnabled && this.ComissaoDocumento) { str = string.Concat(str, "\nCOMISSÕES DO DOCUMENTO"); } if (this.ObsApoliceEnabled && this.ObsApolice) { str = string.Concat(str, "\nOBSERVAÇÕES DA APÓLICE"); } if (this.SegurosVigentesVisibility == Visibility.Visible && this.SegurosVigentes) { str = string.Concat(str, "\nAPENAS SEGUROS VIGENTES"); } } if (this.ItemVisibility) { if (this.SelecionarItensVisibility == Visibility.Visible && this.SelecionarItens) { str = string.Concat(str, "\nSELECIONAR ITENS"); } if (this.BeneficiariosItensEnabled && this.BeneficiariosItens) { str = string.Concat(str, "\nBENEFICIÁRIOS DOS ITENS"); } if (this.ObsItemEnabled && this.ObsItem) { str = string.Concat(str, "\nOBSERVAÇÕES DO ITEM"); } if (this.SepararPaginaEnabled && this.SepararPagina) { str = string.Concat(str, "\nSEPARAR ITENS POR PÁGINA"); } } if (this.PerfilCondutor && this.PerfilVisibility && this.PerfilCondutorEnabled) { str = string.Concat(str, "\nPERFIL DO CONDUTOR"); } if (string.IsNullOrWhiteSpace(str)) { return ""; } return string.Concat("\n\nOPÇÕES:", str); } public async Task PrepararExtrato(List clientes, List documentos, List prospeccoes, Relatorio? tipoRelatorio = null, List selecionadosDoc = null, List selecionadosPros = null, bool pdf = false) { ObservableCollection observableCollection; ObservableCollection observableCollection1; ObservableCollection observableCollection2; ObservableCollection observableCollection3; ObservableCollection observableCollection4; bool count; List documentos1; bool flag; List clientes1; Cliente cliente; Cliente cliente1; List documentos2; this.Carregando = true; Relatorio? nullable = tipoRelatorio; if (nullable.GetValueOrDefault() != 0 | !nullable.HasValue && tipoRelatorio.GetValueOrDefault() != 1) { if ((documentos == null || documentos.Count == 0) && (prospeccoes == null || prospeccoes.Count == 0)) { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO", "OK", "", false); this.Carregando = false; return; } else { List documentos3 = documentos; if (documentos3 != null) { count = documentos3.Count > 200; } else { count = false; } if (!count) { List prospeccaos = prospeccoes; if (prospeccaos != null) { flag = prospeccaos.Count > 200; } else { flag = false; } if (!flag) { goto Label1; } } if (!await base.ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO", false)) { this.Carregando = false; return; } Label1: switch (this.SelectedTipoExtrato) { case 0: { if (selecionadosDoc == null || selecionadosDoc.Count == 0) { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO", "OK", "", false); this.Carregando = false; return; } else { clientes1 = new List(); foreach (Documento documento in documentos) { cliente = await (new ClienteServico()).BuscarCliente(documento.get_Controle().get_Cliente().get_Id()); cliente1 = cliente; observableCollection = await this._clienteServico.BuscarEnderecosAsync(cliente.get_Id()); cliente1.set_Enderecos(observableCollection); cliente1 = null; cliente1 = cliente; observableCollection1 = await this._clienteServico.BuscarEmailsAsync(cliente.get_Id()); cliente1.set_Emails(observableCollection1); cliente1 = null; cliente1 = cliente; observableCollection2 = await this._clienteServico.BuscarTelefonesAsync(cliente.get_Id()); cliente1.set_Telefones(observableCollection2); cliente1 = null; cliente1 = cliente; observableCollection3 = await this._clienteServico.BuscarContatosAsync(cliente.get_Id()); cliente1.set_Contatos(observableCollection3); cliente1 = null; cliente1 = cliente; observableCollection4 = await this._clienteServico.BuscarVinculosAsync(cliente.get_Id()); cliente1.set_Vinculos(observableCollection4); cliente1 = null; clientes1.Add(cliente); cliente = null; } this.Clientes = clientes1; this.Prospeccoes = prospeccoes; break; } } case 1: { if ((selecionadosDoc == null || selecionadosDoc.Count == 0) && (selecionadosPros == null || selecionadosPros.Count == 0)) { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO", "OK", "", false); this.Carregando = false; return; } else { this.Documentos = new List(); this.Prospeccoes = new List(); if (selecionadosDoc != null) { foreach (long num in selecionadosDoc) { Documento documento1 = await (new ApoliceServico()).BuscarApoliceAsync(num, false, true); Documento documento2 = documento1; documentos1 = (!this.SomenteEndossos || documento2.get_Ordem() == 1 ? new List() { documento2 } : new List()); List documentos4 = documentos1; if (this.SomenteEndossos) { IEnumerable documentos5 = documento2.get_Controle().get_Documentos().Where((Documento x) => { if (x.get_Excluido() || x.get_Ordem() == 0) { return false; } return !documentos4.Any((Documento y) => y.get_Id() == x.get_Id()); }); foreach (Documento documento3 in documentos5) { documento3.set_Sinistro(documento2.get_Sinistro()); } documentos4.AddRange(documentos5); } else if (this.Endossos) { IEnumerable documentos6 = documento2.get_Controle().get_Documentos().Where((Documento x) => { if (x.get_Id() == documento2.get_Id()) { return false; } return !x.get_Excluido(); }); foreach (Documento documento4 in documentos6) { documento4.set_Sinistro(documento2.get_Sinistro()); } documentos4.AddRange(documentos6); } if (documento2.get_Controle().get_Documentos().Any((Documento x) => { if (x.get_Id() == documento2.get_Id() || x.get_Excluido()) { return false; } return x.get_Ordem() > documento2.get_Ordem(); })) { documento2.set_TemEndosso(true); } List configuracoes = Recursos.Configuracoes; if (configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 31) && documento2.get_TemEndosso()) { Documento documento5 = documento2; IList documentos7 = documento2.get_Controle().get_Documentos(); IEnumerable excluido = from x in documentos7 where !x.get_Excluido() select x; documento5.set_PremioTotal(excluido.Sum((Documento x) => x.get_PremioTotal())); Documento documento6 = documento2; IList documentos8 = documento2.get_Controle().get_Documentos(); IEnumerable excluido1 = from x in documentos8 where !x.get_Excluido() select x; documento6.set_Iof(excluido1.Sum((Documento x) => x.get_Iof())); Documento documento7 = documento2; IList documentos9 = documento2.get_Controle().get_Documentos(); IEnumerable excluido2 = from x in documentos9 where !x.get_Excluido() select x; documento7.set_Custo(excluido2.Sum((Documento x) => x.get_Custo())); Documento documento8 = documento2; IList documentos10 = documento2.get_Controle().get_Documentos(); IEnumerable excluido3 = from x in documentos10 where !x.get_Excluido() select x; documento8.set_PremioLiquido(excluido3.Sum((Documento x) => x.get_PremioLiquido())); Documento documento9 = documento2; IList documentos11 = documento2.get_Controle().get_Documentos(); IEnumerable excluido4 = from x in documentos11 where !x.get_Excluido() select x; documento9.set_PremioAdicional(excluido4.Sum((Documento x) => x.get_PremioAdicional())); } List documentos12 = this.Documentos; List documentos13 = documentos4; documentos12.AddRange(( from x in documentos13 orderby x.get_Ordem() select x).ToList()); } } if (selecionadosPros != null) { foreach (long selecionadosPro in selecionadosPros) { Prospeccao prospeccao = await (new ProspeccaoServico()).BuscarProspeccao(selecionadosPro); this.Prospeccoes.Add(prospeccao); } } if (this.SelecionarItensVisibility == Visibility.Visible && this.SelecionarItens && this.Documentos != null && this.Documentos.Count > 0) { ObservableCollection observableCollection5 = await base.ShowSelecionarItensDialog(this.Documentos.First().get_Controle().get_Id()); ExtratosViewModel list = this; ObservableCollection observableCollection6 = observableCollection5; list._itensSelecionados = ( from x in observableCollection6 where x.get_Selecionado() select x).ToList(); } if (this.Documentos != null && this.Documentos.Count != 0 || this.Prospeccoes != null && this.Prospeccoes.Count != 0) { break; } if (!this.SomenteEndossos) { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO SELECIONADO", "OK", "", false); } else { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM ENDOSSO OU PROSPECÇÃO SELECIONADO", "OK", "", false); } this.Carregando = false; return; } } case 2: { documentos2 = new List(); ApoliceServico apoliceServico = new ApoliceServico(); long id = documentos.First().get_Controle().get_Cliente().get_Id(); FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado; List vendedorUsuarios = await base.VerificaVinculoVendedor(Recursos.Usuario); ObservableCollection observableCollection7 = await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, vendedorUsuarios); apoliceServico = null; this.Documentos = new List(observableCollection7); foreach (Documento documento10 in this.Documentos) { foreach (Documento documento11 in documento10.get_Controle().get_Documentos()) { if (documento11.get_Tipo() != 1) { continue; } documentos2.Add(documento11); documento10.set_TemEndosso(true); } } this.Documentos.AddRange(documentos2); break; } } documentos2 = null; clientes1 = null; } } else if (clientes == null || clientes.Count == 0) { await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM CLIENTE", "OK", "", false); this.Carregando = false; return; } else { if (clientes.Count > 200) { if (!await base.ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO", false)) { this.Carregando = false; return; } } clientes1 = new List(); List clientesAtivosInativos = clientes; foreach (ClientesAtivosInativos clientesAtivosInativo in from x in clientesAtivosInativos where x.get_Selecionado() select x) { cliente = await (new ClienteServico()).BuscarCliente(clientesAtivosInativo.get_Id()); cliente1 = cliente; observableCollection = await this._clienteServico.BuscarEnderecosAsync(cliente.get_Id()); cliente1.set_Enderecos(observableCollection); cliente1 = null; cliente1 = cliente; observableCollection1 = await this._clienteServico.BuscarEmailsAsync(cliente.get_Id()); cliente1.set_Emails(observableCollection1); cliente1 = null; cliente1 = cliente; observableCollection2 = await this._clienteServico.BuscarTelefonesAsync(cliente.get_Id()); cliente1.set_Telefones(observableCollection2); cliente1 = null; cliente1 = cliente; observableCollection3 = await this._clienteServico.BuscarContatosAsync(cliente.get_Id()); cliente1.set_Contatos(observableCollection3); cliente1 = null; cliente1 = cliente; observableCollection4 = await this._clienteServico.BuscarVinculosAsync(cliente.get_Id()); cliente1.set_Vinculos(observableCollection4); cliente1 = null; clientes1.Add(cliente); cliente = null; } this.Clientes = clientes1; clientes1 = null; } if (this.SegurosVigentesVisibility == Visibility.Visible && this.SegurosVigentes) { ExtratosViewModel extratosViewModel = this; List documentos14 = this.Documentos; extratosViewModel.Documentos = documentos14.Where((Documento x) => { DateTime? vigencia2 = x.get_Vigencia2(); DateTime dateTime = Funcoes.GetNetworkTime().Date.AddDays(-5); if ((vigencia2.HasValue ? vigencia2.GetValueOrDefault() <= dateTime : true)) { vigencia2 = x.get_Vigencia2(); if (vigencia2.HasValue) { return false; } } return x.get_Situacao() != 7; }).ToList(); } await this.Gerar(tipoRelatorio, pdf); this.Carregando = false; } private void RelacaoApolices() { this.SetAllFalse(); this.ComissaoDocumentoEnabled = true; this.PerfilCondutorEnabled = true; } private void SetAllFalse() { this.ObsClienteEnabled = false; this.ClientePorPaginaEnabled = false; this.ComissaoDocumentoEnabled = false; this.ObsApoliceEnabled = false; this.BeneficiariosItensEnabled = false; this.ObsItemEnabled = false; this.SepararPaginaEnabled = false; this.CoberturasEnabled = false; this.PerfilCondutorEnabled = false; this.EndossoEnabled = false; } } }