From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Gestor.Infrastructure.Helpers/Auxiliar.cs | 2068 -------------------- 1 file changed, 2068 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Helpers/Auxiliar.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Helpers/Auxiliar.cs') diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Helpers/Auxiliar.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Helpers/Auxiliar.cs deleted file mode 100644 index 79dbd5f..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Helpers/Auxiliar.cs +++ /dev/null @@ -1,2068 +0,0 @@ -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Data.SqlClient; -using System.Linq; -using System.Runtime.CompilerServices; - -namespace Gestor.Infrastructure.Helpers -{ - public static class Auxiliar - { - public static List Banco - { - get; - set; - } - - public static List CategoriaTarefa - { - get; - set; - } - - public static List CoberturasPadrao - { - get; - set; - } - - public static List Empresas - { - get; - set; - } - - public static List Estipulantes - { - get; - set; - } - - public static List Parceiros - { - get; - set; - } - - public static List Produtos - { - get; - set; - } - - public static List Profissoes - { - get; - set; - } - - public static List Ramos - { - get; - set; - } - - public static List Repasses - { - get; - set; - } - - public static List Seguradoras - { - get; - set; - } - - public static List StatusApolice - { - get; - set; - } - - public static List StatusProspeccao - { - get; - set; - } - - public static List TiposTarefa - { - get; - set; - } - - public static List TipoVendedores - { - get; - set; - } - - public static List Usuarios - { - get; - set; - } - - public static List Vendedores - { - get; - set; - } - - public static void CriarAuxiliar(SqlCommand sqlCommand, bool force = false) - { - DataTable dataTable = new DataTable(); - if (force || Auxiliar.Empresas == null) - { - sqlCommand.CommandText = "SELECT DISTINCT idempresa as id, nome, NomeSocial, cgccpf FROM empresa;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.Empresas = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Empresas.Add(new Empresa() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - NomeSocial = a.Field("NomeSocial") ?? a.Field("nome"), - Documento = a.Field("cgccpf") - })); - } - if (force || Auxiliar.Seguradoras == null) - { - Auxiliar.LoadSeguradoras(sqlCommand); - } - if (force || Auxiliar.Ramos == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idramo as id, nome, ativo, iof FROM ramo;"; - using (SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter()) - { - sqlDataAdapter1.SelectCommand = sqlCommand; - sqlDataAdapter1.Fill(dataTable); - } - Auxiliar.Ramos = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Ramos.Add(new Ramo() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - Iof = a.Field("iof").GetValueOrDefault(), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1") - })); - } - if (force || Auxiliar.Banco == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT IDCODIGOBANCO as id, NOMEBANCO as nome FROM codigobanco;"; - using (SqlDataAdapter sqlDataAdapter2 = new SqlDataAdapter()) - { - sqlDataAdapter2.SelectCommand = sqlCommand; - sqlDataAdapter2.Fill(dataTable); - } - Auxiliar.Banco = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Banco.Add(new Gestor.Model.Domain.Common.Banco() - { - Id = a.Field("id"), - Nome = a.Field("nome") - })); - } - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idestipulante as id, nome, ativo FROM estipulante;"; - using (SqlDataAdapter sqlDataAdapter3 = new SqlDataAdapter()) - { - sqlDataAdapter3.SelectCommand = sqlCommand; - sqlDataAdapter3.Fill(dataTable); - } - Auxiliar.Estipulantes = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Estipulantes.Add(new Estipulante() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1") - })); - if (force || Auxiliar.Vendedores == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idvendedor as id, nome, cpfcnpj, corretora, tipoincidenciadesconto, desconto, ativo, idempresa, idcodigobanco, agencia, conta FROM vendedor;"; - using (SqlDataAdapter sqlDataAdapter4 = new SqlDataAdapter()) - { - sqlDataAdapter4.SelectCommand = sqlCommand; - sqlDataAdapter4.Fill(dataTable); - } - Auxiliar.Vendedores = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Vendedores.Add(new Vendedor() - { - IdEmpresa = a.Field("idempresa").GetValueOrDefault((long)1), - Id = a.Field("id"), - Nome = a.Field("nome"), - Documento = a.Field("cpfcnpj"), - Corretora = (string.IsNullOrEmpty(a.Field("corretora")) ? false : a.Field("corretora") == "1"), - TipoIncidenciaDesconto = (a.Field("tipoincidenciadesconto") == null ? TipoIncidenciaDesconto.Ambos : a.Field("tipoincidenciadesconto")), - Desconto = new decimal?((a.Field("desconto") == null ? decimal.Zero : a.Field("desconto") * new decimal(1, 0, 0, false, 2))), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1"), - Banco = (a.Field("idcodigobanco") == null ? null : Auxiliar.Banco.FirstOrDefault((Gestor.Model.Domain.Common.Banco p) => p.Id == a.Field("idcodigobanco"))), - Agencia = a.Field("agencia"), - Conta = a.Field("conta") - })); - } - if (force || Auxiliar.Repasses == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT * FROM repasse;"; - using (SqlDataAdapter sqlDataAdapter5 = new SqlDataAdapter()) - { - sqlDataAdapter5.SelectCommand = sqlCommand; - sqlDataAdapter5.Fill(dataTable); - } - Auxiliar.Repasses = dataTable.AsEnumerable().Select((DataRow x) => { - Repasse repasse = new Repasse() - { - Id = x.Field("idrepasse"), - Vendedor = Auxiliar.Vendedores.Find((Vendedor v) => v.Id == x.Field("idvendedor")), - Ramo = (x.Field("idramo") != null ? Auxiliar.Ramos.Find((Ramo r) => r.Id == x.Field("idramo")) : null), - Ativo = (x.Field("ativo") == null ? true : x.Field("ativo").ToString() == "1"), - Tipo = (x.Field("tipo") != null ? new TipoRepasse?((TipoRepasse)int.Parse(x.Field("tipo").ToString())) : null), - Incidencia = (x.Field("incidencia") != null ? new TipoIncidencia?((TipoIncidencia)int.Parse(x.Field("incidencia").ToString())) : null), - Forma = (x.Field("forma") != null ? new FormaRepasse?((FormaRepasse)int.Parse(x.Field("forma").ToString())) : null), - Base = (x.Field("base") != null ? new BaseRepasse?((BaseRepasse)int.Parse(x.Field("base").ToString())) : null) - }; - decimal? nullable = x.Field("vlrnovo"); - repasse.ValorNovo = nullable.GetValueOrDefault(); - nullable = x.Field("vlrrenovacao"); - repasse.ValorRenovacao = nullable.GetValueOrDefault(); - return repasse; - }).ToList(); - } - if (force || Auxiliar.Produtos == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idproduto as id, nome, ativo FROM produto;"; - using (SqlDataAdapter sqlDataAdapter6 = new SqlDataAdapter()) - { - sqlDataAdapter6.SelectCommand = sqlCommand; - sqlDataAdapter6.Fill(dataTable); - } - Auxiliar.Produtos = new List(); - dataTable.AsEnumerable().OrderBy((DataRow x) => x.Field("nome")).ToList().ForEach((DataRow a) => Auxiliar.Produtos.Add(new Produto() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - Ativo = a.Field("ativo").GetValueOrDefault(true) - })); - } - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idstatus as id, nome, ativo FROM status;"; - using (SqlDataAdapter sqlDataAdapter7 = new SqlDataAdapter()) - { - sqlDataAdapter7.SelectCommand = sqlCommand; - sqlDataAdapter7.Fill(dataTable); - } - Auxiliar.StatusApolice = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.StatusApolice.Add(new Status() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - Ativo = a.Field("ativo").GetValueOrDefault(true) - })); - if (force || Auxiliar.TipoVendedores == null) - { - Auxiliar.LoadTipoVendedor(sqlCommand); - } - if (force || Auxiliar.Usuarios == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idusuario as id, idpermissao, nome, removido, inativo, idempresa, identif, Visita FROM usuario;"; - using (SqlDataAdapter sqlDataAdapter8 = new SqlDataAdapter()) - { - sqlDataAdapter8.SelectCommand = sqlCommand; - sqlDataAdapter8.Fill(dataTable); - } - Auxiliar.Usuarios = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Usuarios.Add(new Usuario() - { - IdEmpresa = a.Field("idempresa").GetValueOrDefault((long)1), - Id = a.Field("id"), - Nome = a.Field("nome"), - Login = a.Field("identif"), - Visita = a.Field("Visita"), - Excluido = a.Field("removido").GetValueOrDefault(), - PermissaoAggilizador = a.Field("idpermissao") - })); - } - if (force || Auxiliar.Parceiros == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idparceiro as id, nome FROM parceiro;"; - using (SqlDataAdapter sqlDataAdapter9 = new SqlDataAdapter()) - { - sqlDataAdapter9.SelectCommand = sqlCommand; - sqlDataAdapter9.Fill(dataTable); - } - Auxiliar.Parceiros = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Parceiros.Add(new Parceiro() - { - Id = a.Field("id"), - Nome = a.Field("nome") - })); - } - if (force || Auxiliar.Profissoes == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idprofissao AS id, nome FROM profissao;"; - using (SqlDataAdapter sqlDataAdapter10 = new SqlDataAdapter()) - { - sqlDataAdapter10.SelectCommand = sqlCommand; - sqlDataAdapter10.Fill(dataTable); - } - Auxiliar.Profissoes = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Profissoes.Add(new Profissao() - { - Id = a.Field("id"), - Nome = a.Field("nome") - })); - } - if (force || Auxiliar.TiposTarefa == null) - { - Auxiliar.LoadTipoTarefa(sqlCommand); - } - if (force || Auxiliar.StatusProspeccao == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT * FROM StatusProspeccao;"; - using (SqlDataAdapter sqlDataAdapter11 = new SqlDataAdapter()) - { - sqlDataAdapter11.SelectCommand = sqlCommand; - sqlDataAdapter11.Fill(dataTable); - } - Auxiliar.StatusProspeccao = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.StatusProspeccao.Add(new StatusDeProspeccao() - { - Id = a.Field("Id"), - Nome = a.Field("Nome"), - Descricao = a.Field("Descricao"), - Ativo = a.Field("Ativo"), - Excluido = a.Field("Excluido") - })); - } - if (force || Auxiliar.CategoriaTarefa == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT * FROM CategoriaTarefa;"; - using (SqlDataAdapter sqlDataAdapter12 = new SqlDataAdapter()) - { - sqlDataAdapter12.SelectCommand = sqlCommand; - sqlDataAdapter12.Fill(dataTable); - } - Auxiliar.CategoriaTarefa = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.CategoriaTarefa.Add(new Gestor.Model.Domain.Ferramentas.CategoriaTarefa() - { - Id = a.Field("Id"), - Descricao = a.Field("Descricao") - })); - } - if (force || Auxiliar.CoberturasPadrao == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT * FROM coberturapadrao;"; - using (SqlDataAdapter sqlDataAdapter13 = new SqlDataAdapter()) - { - sqlDataAdapter13.SelectCommand = sqlCommand; - sqlDataAdapter13.Fill(dataTable); - } - Auxiliar.CoberturasPadrao = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.CoberturasPadrao.Add(new CoberturaPadrao() - { - Id = a.Field("idcoberturapadrao"), - IdRamo = a.Field("idramo"), - Descricao = a.Field("Descricao"), - Padrao = a.Field("padrao") == "1" - })); - } - } - - public static void CriarAuxiliarUsuario(SqlCommand sqlCommand) - { - if (Auxiliar.Usuarios != null) - { - return; - } - DataTable dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idusuario as id, nome, idpermissao, removido, inativo, idempresa, identif, Visita FROM usuario;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.Usuarios = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Usuarios.Add(new Usuario() - { - IdEmpresa = a.Field("idempresa").GetValueOrDefault((long)1), - Id = a.Field("id"), - Nome = a.Field("nome"), - Login = a.Field("identif"), - Excluido = a.Field("removido").GetValueOrDefault(), - Visita = a.Field("Visita"), - PermissaoAggilizador = a.Field("idpermissao") - })); - } - - public static void CriarVendedor(SqlCommand sqlCommand, bool force = false) - { - DataTable dataTable = new DataTable(); - if (force || Auxiliar.Vendedores == null) - { - sqlCommand.CommandText = "SELECT DISTINCT idvendedor as id, nome, corretora, desconto, tipoincidenciadesconto, ativo, idempresa FROM vendedor;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.Vendedores = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Vendedores.Add(new Vendedor() - { - IdEmpresa = a.Field("idempresa").GetValueOrDefault((long)1), - Id = a.Field("id"), - Nome = a.Field("nome"), - Corretora = (string.IsNullOrEmpty(a.Field("corretora")) ? false : a.Field("corretora") == "1"), - Desconto = new decimal?((a.Field("desconto") == null ? decimal.Zero : a.Field("desconto") * new decimal(1, 0, 0, false, 2))), - TipoIncidenciaDesconto = (a.Field("tipoincidenciadesconto") == null ? TipoIncidenciaDesconto.Ambos : a.Field("tipoincidenciadesconto")), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1") - })); - } - if (force || Auxiliar.Ramos == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idramo as id, nome, ativo, iof FROM ramo;"; - using (SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter()) - { - sqlDataAdapter1.SelectCommand = sqlCommand; - sqlDataAdapter1.Fill(dataTable); - } - Auxiliar.Ramos = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.Ramos.Add(new Ramo() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - Iof = a.Field("iof").GetValueOrDefault(), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1") - })); - } - if (force || Auxiliar.Repasses == null) - { - dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT * FROM repasse;"; - using (SqlDataAdapter sqlDataAdapter2 = new SqlDataAdapter()) - { - sqlDataAdapter2.SelectCommand = sqlCommand; - sqlDataAdapter2.Fill(dataTable); - } - Auxiliar.Repasses = dataTable.AsEnumerable().Select((DataRow x) => { - Repasse repasse = new Repasse() - { - Id = x.Field("idrepasse"), - Vendedor = Auxiliar.Vendedores.Find((Vendedor v) => v.Id == x.Field("idvendedor")), - Ramo = (x.Field("idramo") != null ? Auxiliar.Ramos.Find((Ramo r) => r.Id == x.Field("idramo")) : null), - Ativo = (x.Field("ativo") == null ? true : x.Field("ativo").ToString() == "1"), - Tipo = (x.Field("tipo") != null ? new TipoRepasse?((TipoRepasse)int.Parse(x.Field("tipo").ToString())) : null), - Incidencia = (x.Field("incidencia") != null ? new TipoIncidencia?((TipoIncidencia)int.Parse(x.Field("incidencia").ToString())) : null), - Forma = (x.Field("forma") != null ? new FormaRepasse?((FormaRepasse)int.Parse(x.Field("forma").ToString())) : null), - Base = (x.Field("base") != null ? new BaseRepasse?((BaseRepasse)int.Parse(x.Field("base").ToString())) : null) - }; - decimal? nullable = x.Field("vlrnovo"); - repasse.ValorNovo = nullable.GetValueOrDefault(); - nullable = x.Field("vlrrenovacao"); - repasse.ValorRenovacao = nullable.GetValueOrDefault(); - return repasse; - }).ToList(); - } - } - - public static void LoadSeguradoras(SqlCommand sqlCommand) - { - DataTable dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idciaseg as id, nome, nomesocial, tolerancia, ativo, id as idaggilizador, LinkAppAndroid, LinkAppIos, cgccpf FROM ciaseg;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.Seguradoras = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => { - long id; - Seguradora seguradora = new Seguradora() - { - Id = a.Field("id"), - Nome = a.Field("nome"), - NomeSocial = a.Field("nomesocial"), - Tolerancia = new decimal?((a.Field("tolerancia") == null ? decimal.Zero : Math.Abs(a.Field("tolerancia")))), - Ativo = (a.Field("ativo") == null ? true : a.Field("ativo").ToString() == "1"), - IdAggilizador = a.Field("idaggilizador"), - LinkAppAndroid = a.Field("LinkAppAndroid"), - LinkAppIos = a.Field("LinkAppIos"), - Documento = (a.Field("cgccpf") == null || a.Field("cgccpf") == "" ? "" : a.Field("cgccpf")) - }; - if (string.IsNullOrWhiteSpace(seguradora.NomeSocial)) - { - id = seguradora.Id; - if (id <= (long)694) - { - if (id <= (long)678) - { - long num = id - (long)1; - if (num <= (long)606) - { - switch ((uint)num) - { - case 0: - { - seguradora.NomeSocial = "ABSOLUTA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 1: - case 2: - case 3: - case 4: - { - seguradora.NomeSocial = "ACE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 5: - case 6: - case 7: - case 19: - case 20: - case 21: - case 22: - case 23: - case 28: - case 29: - case 30: - case 31: - case 35: - case 36: - case 37: - case 38: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 49: - case 50: - case 51: - case 57: - case 58: - case 61: - case 62: - case 66: - case 67: - case 68: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 87: - case 97: - case 101: - case 102: - case 103: - case 104: - case 109: - case 110: - case 113: - case 114: - case 118: - case 121: - case 122: - case 123: - case 124: - case 127: - case 131: - case 132: - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - case 141: - case 142: - case 143: - case 146: - case 147: - case 148: - case 149: - case 150: - case 153: - case 154: - case 155: - case 156: - case 157: - case 158: - case 159: - case 162: - case 163: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: - case 170: - case 171: - case 172: - case 173: - case 174: - case 175: - case 179: - case 182: - case 183: - case 186: - case 187: - case 189: - case 190: - case 191: - case 192: - case 193: - case 194: - case 195: - case 198: - case 199: - case 202: - case 203: - case 204: - case 207: - case 208: - case 209: - case 210: - case 211: - case 214: - case 219: - case 220: - case 223: - case 224: - case 227: - case 228: - case 229: - case 233: - case 234: - case 237: - case 238: - case 239: - case 240: - case 244: - case 245: - case 246: - case 247: - case 250: - case 252: - case 253: - case 256: - case 261: - case 262: - case 263: - case 270: - case 276: - case 277: - case 278: - case 279: - case 280: - case 281: - case 282: - case 286: - case 287: - case 288: - case 300: - case 301: - case 302: - case 303: - case 304: - case 305: - case 306: - case 312: - case 313: - case 314: - case 315: - case 316: - case 329: - case 331: - case 332: - case 333: - case 334: - case 335: - case 338: - case 339: - case 341: - case 342: - case 343: - case 344: - case 350: - case 357: - case 358: - case 359: - case 360: - case 361: - case 362: - case 363: - case 366: - case 367: - case 368: - case 369: - case 370: - case 371: - case 373: - case 376: - case 377: - case 381: - case 382: - case 383: - case 388: - case 389: - case 390: - case 391: - case 392: - case 393: - case 396: - case 397: - case 402: - case 403: - case 404: - case 405: - case 406: - case 407: - case 408: - case 409: - case 410: - case 413: - case 414: - case 415: - case 419: - case 420: - case 421: - case 422: - case 425: - case 433: - case 434: - case 442: - case 443: - case 444: - case 451: - case 452: - case 453: - case 454: - case 457: - case 460: - case 461: - case 462: - case 463: - case 464: - case 467: - case 468: - case 469: - case 470: - case 472: - case 473: - case 488: - case 495: - case 496: - case 502: - case 504: - case 505: - case 506: - case 510: - case 511: - case 512: - case 519: - case 524: - case 525: - case 526: - case 529: - case 530: - case 531: - case 532: - case 533: - case 534: - case 535: - case 536: - case 552: - case 555: - case 562: - case 563: - case 564: - case 565: - case 566: - case 567: - case 568: - case 575: - case 576: - case 577: - case 578: - case 580: - case 585: - case 586: - case 587: - case 588: - case 589: - case 592: - case 596: - case 598: - case 599: - case 600: - case 601: - { - goto Label6; - } - case 8: - case 9: - case 517: - case 518: - { - seguradora.NomeSocial = "AIG"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 10: - { - seguradora.NomeSocial = "AJAX"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 11: - case 12: - case 13: - { - seguradora.NomeSocial = "ALFA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 14: - case 15: - case 16: - case 176: - case 177: - { - seguradora.NomeSocial = "ALIANÇA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 17: - case 18: - { - seguradora.NomeSocial = "ALLIANZ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 24: - case 25: - case 26: - case 180: - { - seguradora.NomeSocial = "ALLSEG"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 27: - case 590: - case 591: - case 593: - { - seguradora.NomeSocial = "AMIL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 32: - case 33: - case 34: - { - seguradora.NomeSocial = "APLUB"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 39: - case 40: - { - seguradora.NomeSocial = "ARCH"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 41: - { - seguradora.NomeSocial = "ARGO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 48: - case 243: - { - seguradora.NomeSocial = "GENERALI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 52: - case 53: - case 54: - case 55: - case 56: - { - seguradora.NomeSocial = "ATLANTICA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 59: - case 60: - { - seguradora.NomeSocial = "AUSTRAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 63: - case 64: - case 65: - case 602: - { - seguradora.NomeSocial = "AXA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 69: - { - seguradora.NomeSocial = "AZUL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 88: - case 89: - case 90: - case 91: - case 92: - case 583: - { - seguradora.NomeSocial = "BRADESCO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 93: - { - seguradora.NomeSocial = "BRASIL LIBANO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 94: - { - seguradora.NomeSocial = "BRASILCAP"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 95: - case 96: - { - seguradora.NomeSocial = "BRASILPREV"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 98: - case 100: - { - seguradora.NomeSocial = "BRASILUSITANA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 99: - { - seguradora.NomeSocial = "BRASIL VEÍCULOS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 105: - case 106: - case 107: - case 108: - case 372: - { - seguradora.NomeSocial = "CAIXA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 111: - case 112: - { - seguradora.NomeSocial = "CAPEMISA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 115: - case 116: - case 117: - { - seguradora.NomeSocial = "CARDIF"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 119: - case 120: - { - seguradora.NomeSocial = "CASTELLO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 125: - case 126: - { - seguradora.NomeSocial = "CESCEBRASIL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 128: - case 129: - { - seguradora.NomeSocial = "CHARTIS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 130: - { - seguradora.NomeSocial = "CHUBB"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 144: - case 184: - case 185: - { - seguradora.NomeSocial = "INTERNACIONAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 145: - case 289: - case 292: - case 293: - case 294: - { - seguradora.NomeSocial = "ITAÉ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 151: - case 152: - case 188: - case 416: - case 417: - case 418: - { - seguradora.NomeSocial = "REAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 160: - case 161: - { - seguradora.NomeSocial = "URBANIA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 178: - case 251: - { - seguradora.NomeSocial = "GRALHA AZUL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 181: - { - seguradora.NomeSocial = "EXCELSIOR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 196: - case 197: - { - seguradora.NomeSocial = "CREDITO Y CAUCIAN"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 200: - case 201: - { - seguradora.NomeSocial = "CRUZEIRO DO SUL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 205: - case 206: - { - seguradora.NomeSocial = "ECC"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 212: - case 213: - { - seguradora.NomeSocial = "EQUITATIVA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 215: - { - seguradora.NomeSocial = "ESSOR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 216: - case 217: - case 218: - { - seguradora.NomeSocial = "EULER HERMES"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 221: - case 222: - { - seguradora.NomeSocial = "EVEREST"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 225: - case 226: - { - seguradora.NomeSocial = "FACTORY"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 230: - case 231: - case 232: - { - seguradora.NomeSocial = "FEDERAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 235: - case 236: - { - seguradora.NomeSocial = "FINANCIAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 241: - case 242: - { - seguradora.NomeSocial = "GENERAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 248: - case 249: - { - seguradora.NomeSocial = "GNPP"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 254: - case 255: - { - seguradora.NomeSocial = "HANNOVER"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 257: - case 258: - case 259: - case 260: - case 569: - case 597: - { - seguradora.NomeSocial = "HDI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 264: - case 265: - case 266: - case 267: - case 268: - case 269: - { - seguradora.NomeSocial = "HSBC"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 271: - case 272: - { - seguradora.NomeSocial = "ICATU"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 273: - case 274: - { - seguradora.NomeSocial = "IF P&C INSURANCE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 275: - { - seguradora.NomeSocial = "INDIANA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 283: - case 284: - case 285: - case 603: - { - seguradora.NomeSocial = "KOVR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 290: - case 291: - case 295: - case 296: - { - seguradora.NomeSocial = "ITAÚ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 297: - case 298: - case 299: - { - seguradora.NomeSocial = "J. MALUCELLI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 307: - case 308: - case 309: - { - seguradora.NomeSocial = "YELUM"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 310: - case 311: - { - seguradora.NomeSocial = "LIDERANÇA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 317: - case 318: - case 319: - case 320: - case 321: - case 322: - case 323: - case 324: - case 325: - case 326: - case 327: - case 328: - { - seguradora.NomeSocial = "MAPFRE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 330: - case 542: - case 561: - { - seguradora.NomeSocial = "YASUDA MARITIMA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 336: - case 337: - { - seguradora.NomeSocial = "MBM"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 340: - { - seguradora.NomeSocial = "METLIFE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 345: - case 346: - case 347: - { - seguradora.NomeSocial = "MITSUI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 348: - case 349: - { - seguradora.NomeSocial = "MONGERAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 351: - case 352: - case 353: - case 354: - case 355: - case 356: - { - seguradora.NomeSocial = "MONTEPIO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 364: - case 365: - case 380: - { - seguradora.NomeSocial = "NATIONAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 374: - case 375: - { - seguradora.NomeSocial = "NOVA YORK"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 378: - case 379: - { - seguradora.NomeSocial = "ODYSSEY"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 384: - case 385: - { - seguradora.NomeSocial = "PARANÁ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 386: - case 387: - { - seguradora.NomeSocial = "PARIS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 394: - case 395: - { - seguradora.NomeSocial = "PLANALTO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 398: - case 399: - case 400: - case 401: - case 553: - case 554: - case 573: - { - seguradora.NomeSocial = "PORTO SEGURO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 411: - case 412: - { - seguradora.NomeSocial = "PRUDENTIAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 423: - case 424: - { - seguradora.NomeSocial = "ROYAL & SUN ALLIANCE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 426: - case 427: - case 428: - { - seguradora.NomeSocial = "SABEMI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 429: - case 430: - case 431: - case 432: - { - seguradora.NomeSocial = "SAFRA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 435: - case 436: - case 437: - { - seguradora.NomeSocial = "SANTANDER"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 438: - case 439: - { - seguradora.NomeSocial = "SANTOS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 440: - case 441: - { - seguradora.NomeSocial = "SANTOS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 445: - case 446: - case 447: - case 448: - { - seguradora.NomeSocial = "SCOR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 449: - case 450: - { - seguradora.NomeSocial = "SDB"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 455: - case 456: - { - seguradora.NomeSocial = "MINEIRA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 458: - case 459: - { - seguradora.NomeSocial = "PONTUAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 465: - case 466: - { - seguradora.NomeSocial = "SIRIUS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 471: - case 594: - { - seguradora.NomeSocial = "SOMPO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 474: - case 475: - case 476: - case 477: - case 478: - case 479: - case 480: - case 481: - case 482: - case 483: - case 484: - case 485: - case 486: - case 487: - case 557: - case 579: - { - seguradora.NomeSocial = "SULAMERICA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 489: - case 490: - case 491: - case 492: - case 493: - case 494: - { - seguradora.NomeSocial = "SWISS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 497: - case 498: - case 499: - case 500: - case 501: - { - seguradora.NomeSocial = "TOKIO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 503: - { - seguradora.NomeSocial = "TOTAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 507: - case 508: - case 509: - { - seguradora.NomeSocial = "TREVO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 513: - case 514: - case 515: - case 516: - { - seguradora.NomeSocial = "UNIÃO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 520: - case 521: - case 584: - case 595: - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 522: - case 523: - { - seguradora.NomeSocial = "UNIVERSAL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 527: - case 528: - { - seguradora.NomeSocial = "VALOR CAPITALIZAÇÃO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 537: - case 538: - case 539: - case 540: - case 541: - { - seguradora.NomeSocial = "XL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 543: - case 544: - case 545: - case 546: - case 547: - case 548: - case 549: - case 550: - case 551: - { - seguradora.NomeSocial = "ZURICH"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 556: - { - seguradora.NomeSocial = "SUHAI"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 558: - { - seguradora.NomeSocial = "SANCOR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 559: - { - seguradora.NomeSocial = "AGROBRASIL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 560: - case 570: - { - seguradora.NomeSocial = "SURA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 571: - case 572: - case 574: - case 605: - case 606: - { - seguradora.NomeSocial = "SÃO FRANCISCO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 581: - { - seguradora.NomeSocial = "SANTA CASA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 582: - { - seguradora.NomeSocial = "AMEX"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 604: - { - seguradora.NomeSocial = "BANCO DO BRASIL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - } - } - else - { - } - long num1 = id - (long)621; - if (num1 <= (long)57) - { - switch ((uint)num1) - { - case 0: - case 3: - case 24: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 41: - case 42: - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 9: - case 18: - { - seguradora.NomeSocial = "ALIRO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 10: - { - break; - } - case 11: - { - seguradora.NomeSocial = "VR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 14: - { - seguradora.NomeSocial = "ALLIANZ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 15: - { - seguradora.NomeSocial = "HS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 20: - case 22: - case 53: - { - seguradora.NomeSocial = "PORTO SEGURO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 21: - { - seguradora.NomeSocial = "SURA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 28: - { - seguradora.NomeSocial = "AMIL"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 29: - { - seguradora.NomeSocial = "YELUM"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 43: - { - seguradora.NomeSocial = "SULAMERICA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 45: - { - seguradora.NomeSocial = "AFFINITY"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 46: - { - seguradora.NomeSocial = "BR"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 52: - { - seguradora.NomeSocial = "YAMAHA"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 55: - { - seguradora.NomeSocial = "SÃO FRANCISCO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 56: - { - seguradora.NomeSocial = "EMBRACON"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 57: - { - seguradora.NomeSocial = "MAPFRE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - default: - { - goto Label6; - } - } - } - else - { - goto Label6; - } - seguradora.NomeSocial = "METLIFE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - else if (id != (long)683) - { - long num2 = id - (long)687; - if (num2 <= (long)3) - { - switch ((uint)num2) - { - case 0: - { - seguradora.NomeSocial = "ITAÚ"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 1: - { - goto Label6; - } - case 2: - { - seguradora.NomeSocial = "SÃO LUCAS"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 3: - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - } - } - else - { - } - if (id == (long)694) - { - seguradora.NomeSocial = "PORTO SEGURO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - goto Label6; - } - else - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - seguradora.NomeSocial = "PORTO SEGURO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - else if (id > (long)716) - { - if (id == (long)717) - { - seguradora.NomeSocial = "CHUBB"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - if (id != (long)734) - { - goto Label5; - } - seguradora.NomeSocial = "RC"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - else - { - long num3 = id - (long)703; - if (num3 <= (long)8) - { - switch ((uint)num3) - { - case 0: - case 6: - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 1: - case 4: - case 8: - { - seguradora.NomeSocial = "MAPFRE"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - case 2: - case 3: - case 5: - case 7: - { - goto Label6; - } - } - } - else - { - } - if (id == (long)716) - { - seguradora.NomeSocial = "UNIMED"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - } - Label6: - seguradora.NomeSocial = seguradora.Nome; - } - Auxiliar.Seguradoras.Add(seguradora); - return; - Label5: - if (id == (long)741) - { - seguradora.NomeSocial = "SOMPO"; - Auxiliar.Seguradoras.Add(seguradora); - return; - } - else - { - goto Label6; - } - }); - } - - public static void LoadTipoTarefa(SqlCommand sqlCommand) - { - DataTable dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT * FROM TipoTarefa;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.TiposTarefa = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.TiposTarefa.Add(new TipoDeTarefa() - { - Id = a.Field("Id"), - Nome = a.Field("Nome"), - Descricao = a.Field("Descricao"), - Ativo = a.Field("Ativo"), - Excluido = a.Field("Excluido") - })); - } - - public static void LoadTipoVendedor(SqlCommand sqlCommand) - { - DataTable dataTable = new DataTable(); - sqlCommand.CommandText = "SELECT DISTINCT idtipovendedor as id, descricao, ativo FROM tipovendedor;"; - using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter()) - { - sqlDataAdapter.SelectCommand = sqlCommand; - sqlDataAdapter.Fill(dataTable); - } - Auxiliar.TipoVendedores = new List(); - dataTable.AsEnumerable().ToList().ForEach((DataRow a) => Auxiliar.TipoVendedores.Add(new TipoVendedor() - { - Id = a.Field("id"), - Descricao = a.Field("descricao"), - Ativo = new bool?(a.Field("ativo").GetValueOrDefault(true)) - })); - } - - public static List PesquisaAvancada(FiltroStatusDocumento status, DataTable documentos, DataTable itens, List controles) - { - DateTime date = Funcoes.GetNetworkTime().Date; - switch (status) - { - case FiltroStatusDocumento.Vencidos: - { - return documentos.AsEnumerable().Where((DataRow x) => { - if (controles == null || controles.Contains(x.Field("idcontrole")) && (TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field("situacao").ToString()) == TipoSeguro.Renovado) - { - return true; - } - return x.Field("vigencia2") < date.AddDays(-5); - }).Select((DataRow x) => new PesquisaAvancada() - { - IdCliente = x.Field("idcliente"), - IdDocumento = x.Field("iddocumento"), - IdItem = itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("iditem"), - Nome = x.Field("cliente"), - Pesquisa = (x.Field("tipo") == 0 ? string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta") }) : string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta"), " - NÚMERO DO ENDOSSO: ", x.Field("endosso") })) - }).ToList(); - } - case FiltroStatusDocumento.Cancelados: - { - return documentos.AsEnumerable().Where((DataRow x) => { - if (controles == null) - { - return true; - } - if (!controles.Contains(x.Field("idcontrole"))) - { - return false; - } - return (TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field("situacao").ToString()) == TipoSeguro.Cancelado; - }).Select((DataRow x) => new PesquisaAvancada() - { - IdCliente = x.Field("idcliente"), - IdDocumento = x.Field("iddocumento"), - IdItem = itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("iditem"), - Nome = x.Field("cliente"), - Pesquisa = (x.Field("tipo") == 0 ? string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta") }) : string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta"), " - NÚMERO DO ENDOSSO: ", x.Field("endosso") })) - }).ToList(); - } - case FiltroStatusDocumento.Recusados: - { - return documentos.AsEnumerable().Where((DataRow x) => { - if (controles == null) - { - return true; - } - if (!controles.Contains(x.Field("idcontrole"))) - { - return false; - } - return (TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field("situacao").ToString()) == TipoSeguro.Recusado; - }).Select((DataRow x) => new PesquisaAvancada() - { - IdCliente = x.Field("idcliente"), - IdDocumento = x.Field("iddocumento"), - IdItem = itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("iditem"), - Nome = x.Field("cliente"), - Pesquisa = (x.Field("tipo") == 0 ? string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta") }) : string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta"), " - NÚMERO DO ENDOSSO: ", x.Field("endosso") })) - }).ToList(); - } - case FiltroStatusDocumento.Todos: - { - return documentos.AsEnumerable().Where((DataRow x) => { - if (controles == null) - { - return true; - } - return controles.Contains(x.Field("idcontrole")); - }).Select((DataRow x) => new PesquisaAvancada() - { - IdCliente = x.Field("idcliente"), - IdDocumento = x.Field("iddocumento"), - IdItem = itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("iditem"), - Nome = x.Field("cliente"), - Pesquisa = (x.Field("tipo") == 0 ? string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta") }) : string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta"), " - NÚMERO DO ENDOSSO: ", x.Field("endosso") })) - }).ToList(); - } - default: - { - return documentos.AsEnumerable().Where((DataRow x) => { - if (controles == null) - { - return true; - } - if (!controles.Contains(x.Field("idcontrole")) || (TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field("situacao").ToString()) != TipoSeguro.Novo && (TipoSeguro)Enum.Parse(typeof(TipoSeguro), x.Field("situacao").ToString()) != TipoSeguro.Renovacao) - { - return false; - } - return x.Field("vigencia2") >= date.AddDays(-5); - }).Select((DataRow x) => new PesquisaAvancada() - { - IdCliente = x.Field("idcliente"), - IdDocumento = x.Field("iddocumento"), - IdItem = itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("iditem"), - Nome = x.Field("cliente"), - Pesquisa = (x.Field("tipo") == 0 ? string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta") }) : string.Concat(new string[] { "ITEM: ", itens.AsEnumerable().First((DataRow i) => i.Field("id") == x.Field("iddocumento")).Field("descricao"), " - NÚMERO DA APÓLICE: ", x.Field("apolice"), " - NÚMERO DA PROPOSTA: ", x.Field("proposta"), " - NÚMERO DO ENDOSSO: ", x.Field("endosso") })) - }).ToList(); - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3