public int InserirPlanoProtecaoFuneral(TPlanoProtecaoVO tplanoprotecaovo) { var banco = new SINAF_WebEntities(); var query = new TPlanoProtecaoFuneral { Categoria = tplanoprotecaovo.FuneralCategoria, Codigo = tplanoprotecaovo.FuneralCodigo, Ate_20 = tplanoprotecaovo.FuneralAte_20, De_21_40 = tplanoprotecaovo.FuneralDe_21_40, De_41_50 = tplanoprotecaovo.FuneralDe_41_50, De_51_60 = tplanoprotecaovo.FuneralDe_51_60, De_61_65 = tplanoprotecaovo.FuneralDe_61_65, De_66_70 = tplanoprotecaovo.FuneralDe_66_70, De_71_75 = tplanoprotecaovo.FuneralDe_71_75, De_76_80 = tplanoprotecaovo.FuneralDe_76_80, }; banco.AddToTPlanoProtecaoFuneral(query); banco.SaveChanges(); tplanoprotecaovo.IDPlanoProtecaoFuneral = query.IDPlanoProtecaoFuneral; return(query.IDPlanoProtecaoFuneral); }
public int InserirPlanoProtecaoRenda(TPlanoProtecaoVO tplanoprotecaovo) { var banco = new SINAF_WebEntities(); var query = new TPlanoProtecaoRenda { RendaPeriodo = tplanoprotecaovo.RendaPeriodo, CoberturaRendaMensal = tplanoprotecaovo.RendaCoberturaRendaMensal, CoberturaCapitalTotal = tplanoprotecaovo.RendaCoberturaCapitalTotal, Premio_18_30 = tplanoprotecaovo.RendaPremio_18_30, Premio_31_40 = tplanoprotecaovo.RendaPremio_31_40, Premio_41_45 = tplanoprotecaovo.RendaPremio_41_45, Premio_46_50 = tplanoprotecaovo.RendaPremio_46_50, Premio_51_55 = tplanoprotecaovo.RendaPremio_51_55, Premio_56_60 = tplanoprotecaovo.RendaPremio_56_60, Premio_61_65 = tplanoprotecaovo.RendaPremio_61_65, }; banco.AddToTPlanoProtecaoRenda(query); banco.SaveChanges(); tplanoprotecaovo.IDPlanoProtecaoRenda = query.IDPlanoProtecaoRenda; return(query.IDPlanoProtecaoRenda); }
public int InserirPlanoProtecao(TPlanoProtecaoVO tplanoprotecaovo) { var banco = new SINAF_WebEntities(); var query = new TPlanoProtecao { Codigo = tplanoprotecaovo.Codigo, NomePlano = tplanoprotecaovo.NomePlano, CoberturaMorte = tplanoprotecaovo.CoberturaMorte, CoberturaAcidente = tplanoprotecaovo.CoberturaAcidente, CoberturaEmergencia = tplanoprotecaovo.CoberturaEmergencia, Premio_18_30 = tplanoprotecaovo.Premio_18_30, Premio_31_40 = tplanoprotecaovo.Premio_31_40, Premio_41_45 = tplanoprotecaovo.Premio_41_45, Premio_46_50 = tplanoprotecaovo.Premio_46_50, Premio_51_55 = tplanoprotecaovo.Premio_51_55, Premio_56_60 = tplanoprotecaovo.Premio_56_60, Premio_61_65 = tplanoprotecaovo.Premio_61_65, }; banco.AddToTPlanoProtecao(query); banco.SaveChanges(); tplanoprotecaovo.IDPlanoProtecao = query.IDPlanoProtecao; return(query.IDPlanoProtecao); }
public TPlanoProtecaoVO CalcularPremioFuneral(decimal valorMorteNovo, decimal valorIPANovo, decimal valorAssistenciaNovo, int valorCategoriaNovo, int idadeBase) { try { TPlanoProtecaoVO planoFuneral = TPlanoProtecaoBLL.SelecionarPlanoProtecaoFuneral(valorMorteNovo, valorIPANovo, valorAssistenciaNovo, valorCategoriaNovo); if (planoFuneral == null) { return(new TPlanoProtecaoVO()); } switch (idadeBase) { case (int)FaixaEtaria.PREMIO_18_30: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_18_30; break; case (int)FaixaEtaria.PREMIO_31_40: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_31_40; break; case (int)FaixaEtaria.PREMIO_41_45: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_41_45; break; case (int)FaixaEtaria.PREMIO_46_50: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_46_50; break; case (int)FaixaEtaria.PREMIO_51_55: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_51_55; break; case (int)FaixaEtaria.PREMIO_56_60: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_56_60; break; case (int)FaixaEtaria.PREMIO_61_65: planoFuneral.ValorPremioIdadeBase = planoFuneral.Premio_61_65; break; default: break; } return(planoFuneral); } catch (CABTECException) { throw new CABTECException("Erro ao Calcular Prêmio do Funeral."); } catch (Exception) { throw new CABTECException("Erro ao Calcular Prêmio do Funeral."); } }
private void LimparPlanos() { PlanoProtecaoVO = new TPlanoProtecaoVO(); PlanoCasalVO = new TPlanoCasalVO(); PlanoSeniorVO = new TPlanoSeniorVO(); PlanoProtecaoFuneralNovoVO = new TPlanoProtecaoVO(); PlanoProtecaoRendaNovoVO = new TPlanoProtecaoVO(); PlanoCasalFuneralNovoVO = new TPlanoCasalVO(); PlanoSeniorFuneralNovoVO = new TPlanoSeniorVO(); ListaAgregadoVONovo = new List <TAgregadoVO>(); ListaAgregadoVOTemp = new List <TAgregadoVO>(); }
public TPlanoProtecaoVO CalcularPremioRenda(string periodoNovo, decimal valorRendaNovo, int idadeBase) { try { TPlanoProtecaoVO planoRenda = TPlanoProtecaoBLL.SelecionarPlanoProtecaoRenda(periodoNovo, valorRendaNovo); switch (idadeBase) { case (int)FaixaEtaria.PREMIO_18_30: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_18_30; break; case (int)FaixaEtaria.PREMIO_31_40: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_31_40; break; case (int)FaixaEtaria.PREMIO_41_45: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_41_45; break; case (int)FaixaEtaria.PREMIO_46_50: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_46_50; break; case (int)FaixaEtaria.PREMIO_51_55: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_51_55; break; case (int)FaixaEtaria.PREMIO_56_60: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_56_60; break; case (int)FaixaEtaria.PREMIO_61_65: planoRenda.RendaValorPremioIdadeBase = planoRenda.RendaPremio_61_65; break; default: break; } return(planoRenda); } catch (CABTECException) { throw new CABTECException("Erro ao Calcular Prêmio da Renda."); } catch (Exception) { throw new CABTECException("Erro ao Calcular Prêmio da Renda."); } }
public decimal CalcularPremioAgregado(int grauParentesco, int idade, string valorCategoria) { try { TPlanoProtecaoVO planoAgregado = new TPlanoProtecaoVO(); if (grauParentesco == (int)GrauParentesco.CONJUGE) { return(0); } if (grauParentesco == (int)GrauParentesco.FILHO && idade < 25) { return(0); } if (idade <= 40) { planoAgregado = TPlanoProtecaoBLL.SelecionarPlanoPremioAgregado(valorCategoria, 1); if (idade <= 20) { return(planoAgregado.FuneralAte_20.GetValueOrDefault()); } else { return(planoAgregado.FuneralDe_21_40.GetValueOrDefault()); } } else { if (idade <= 60) { planoAgregado = TPlanoProtecaoBLL.SelecionarPlanoPremioAgregado(valorCategoria, 2); if (idade <= 50) { return(planoAgregado.FuneralDe_41_50.GetValueOrDefault()); } else { return(planoAgregado.FuneralDe_51_60.GetValueOrDefault()); } } else { if (idade <= 70) { planoAgregado = TPlanoProtecaoBLL.SelecionarPlanoPremioAgregado(valorCategoria, 3); if (idade <= 65) { return(planoAgregado.FuneralDe_61_65.GetValueOrDefault()); } else { return(planoAgregado.FuneralDe_66_70.GetValueOrDefault()); } } else { planoAgregado = TPlanoProtecaoBLL.SelecionarPlanoPremioAgregado(valorCategoria, 4); if (idade <= 75) { return(planoAgregado.FuneralDe_71_75.GetValueOrDefault()); } else { return(planoAgregado.FuneralDe_76_80.GetValueOrDefault()); } } } } } catch (CABTECException) { throw new CABTECException("Erro ao Calcular Prêmio do Agregado."); } catch (Exception) { throw new CABTECException("Erro ao Calcular Prêmio do Agregado."); } }
public void ImportarArquivo(string keyNomeDiretorio, string nomeArquivo) { try { Decimal?DecimalNulo = null; string urlRepositorioArquivos = WebConfigurationManager.AppSettings[keyNomeDiretorio]; string path = HttpContext.Current.Server.MapPath(urlRepositorioArquivos + "\\" + nomeArquivo); OleDbConnection connection = new OleDbConnection(WebConfigurationManager.AppSettings["ExcelCONNECT"].Replace("[path]", path).ToString()); //OleDbConnection connection = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + path + "';Extended Properties=Excel 12.0;"); #region [ Importar Tabela TPlanoProtecao ] DataSet dadosExcelTPlanoProtecao = new DataSet(); using (OleDbDataAdapter command = new OleDbDataAdapter("select * from [Plano$]", connection)) { command.Fill(dadosExcelTPlanoProtecao); } if (dadosExcelTPlanoProtecao != null) { if (dadosExcelTPlanoProtecao.Tables.Count > 0) { if (dadosExcelTPlanoProtecao.Tables[0].Rows.Count > 0) { Int32 verificaExisteRegistro = string.IsNullOrEmpty(dadosExcelTPlanoProtecao.Tables[0].Rows[0]["Código Plano"].ToString()) ? 0 : Convert.ToInt32(dadosExcelTPlanoProtecao.Tables[0].Rows[0]["Código Plano"].ToString().Replace(".", ",")); if (verificaExisteRegistro != 0) { //Excluir TPlanoProtecao TPlanoProtecaoBLL.ExcluirTodosPlanoProtecao(); foreach (DataRow item in dadosExcelTPlanoProtecao.Tables[0].Rows) { TPlanoProtecaoVO dadosVO = new TPlanoProtecaoVO(); dadosVO.Codigo = string.IsNullOrEmpty(item["Código Plano"].ToString()) ? 0 : Convert.ToInt32(item["Código Plano"].ToString().Replace(".", ",")); dadosVO.NomePlano = item["Nome Plano"].ToString(); dadosVO.CoberturaMorte = Convert.ToDecimal(item["Cobertura Morte Acidental"].ToString().Replace(".", ",")); dadosVO.CoberturaAcidente = Convert.ToDecimal(item["Cobertura Invalidez por Acidente"].ToString().Replace(".", ",")); dadosVO.CoberturaEmergencia = Convert.ToDecimal(item["Cobertura Assistência Emergencial"].ToString().Replace(".", ",")); dadosVO.Premio_18_30 = string.IsNullOrEmpty(item["Prêmio 18-30"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 18-30"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_31_40 = string.IsNullOrEmpty(item["Prêmio 31-40"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 31-40"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_41_45 = string.IsNullOrEmpty(item["Prêmio 41-45"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 41-45"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_46_50 = string.IsNullOrEmpty(item["Prêmio 46-50"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 46-50"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_51_55 = string.IsNullOrEmpty(item["Prêmio 51-55"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 51-55"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_56_60 = string.IsNullOrEmpty(item["Prêmio 56-60"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 56-60"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosVO.Premio_61_65 = string.IsNullOrEmpty(item["Prêmio 61-65"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 61-65"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); if (dadosVO.Codigo != 0) { TPlanoProtecaoBLL.InserirPlanoProtecao(dadosVO); } } } } } } #endregion #region [ Importar Tabela TPlanoProtecaoFuneral ] DataSet dadosExcelTPlanoProtecaoFuneral = new DataSet(); using (OleDbDataAdapter command = new OleDbDataAdapter("select * from [Funeral$]", connection)) { command.Fill(dadosExcelTPlanoProtecaoFuneral); } if (dadosExcelTPlanoProtecaoFuneral != null) { if (dadosExcelTPlanoProtecaoFuneral.Tables.Count > 0) { if (dadosExcelTPlanoProtecaoFuneral.Tables[0].Rows.Count > 0) { Int32 verificaExisteRegistroFuneral = string.IsNullOrEmpty(dadosExcelTPlanoProtecaoFuneral.Tables[0].Rows[0]["Código"].ToString()) ? 0 : Convert.ToInt32(dadosExcelTPlanoProtecaoFuneral.Tables[0].Rows[0]["Código"].ToString().Replace(".", ",")); if (verificaExisteRegistroFuneral != 0) { //Excluir TPlanoProtecaoFuneral TPlanoProtecaoBLL.ExcluirTodosPlanoProtecaoFuneral(); foreach (DataRow item in dadosExcelTPlanoProtecaoFuneral.Tables[0].Rows) { TPlanoProtecaoVO dadosFuneralVO = new TPlanoProtecaoVO(); dadosFuneralVO.FuneralCodigo = string.IsNullOrEmpty(item["Código"].ToString()) ? 0 : Convert.ToInt32(item["Código"].ToString().Replace(".", ",")); dadosFuneralVO.FuneralCategoria = item["Categoria"].ToString(); dadosFuneralVO.FuneralAte_20 = string.IsNullOrEmpty(item["Até 20"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Até 20"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_21_40 = string.IsNullOrEmpty(item["21-40"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["21-40"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_41_50 = string.IsNullOrEmpty(item["41-50"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["41-50"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_51_60 = string.IsNullOrEmpty(item["51-60"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["51-60"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_61_65 = string.IsNullOrEmpty(item["61-65"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["61-65"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_66_70 = string.IsNullOrEmpty(item["66-70"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["66-70"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_71_75 = string.IsNullOrEmpty(item["71-75"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["71-75"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosFuneralVO.FuneralDe_76_80 = string.IsNullOrEmpty(item["76-80"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["76-80"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); if (dadosFuneralVO.FuneralCodigo != 0) { TPlanoProtecaoBLL.InserirPlanoProtecaoFuneral(dadosFuneralVO); } } } } } } #endregion #region [ Importar Tabela TPlanoProtecaoRenda ] DataSet dadosExcelTPlanoProtecaoRenda = new DataSet(); using (OleDbDataAdapter command = new OleDbDataAdapter("select * from [Renda$]", connection)) { command.Fill(dadosExcelTPlanoProtecaoRenda); } if (dadosExcelTPlanoProtecaoRenda != null) { if (dadosExcelTPlanoProtecaoRenda.Tables.Count > 0) { if (dadosExcelTPlanoProtecaoRenda.Tables[0].Rows.Count > 0) { string verificaExisteRegistroRenda = dadosExcelTPlanoProtecaoRenda.Tables[0].Rows[0]["Renda Período"].ToString(); if (!string.IsNullOrEmpty(verificaExisteRegistroRenda)) { //Excluir TPlanoProtecaoRenda TPlanoProtecaoBLL.ExcluirTodosPlanoProtecaoRenda(); foreach (DataRow item in dadosExcelTPlanoProtecaoRenda.Tables[0].Rows) { TPlanoProtecaoVO dadosRendaVO = new TPlanoProtecaoVO(); dadosRendaVO.RendaPeriodo = item["Renda Período"].ToString(); dadosRendaVO.RendaCoberturaRendaMensal = Convert.ToDecimal(item["Cobertura Morte Renda Mensal"].ToString().Replace(".", ",")); dadosRendaVO.RendaCoberturaCapitalTotal = Convert.ToDecimal(item["Cobertura Morte Capital Total"].ToString().Replace(".", ",")); dadosRendaVO.RendaPremio_18_30 = string.IsNullOrEmpty(item["Prêmio 18-30"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 18-30"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_31_40 = string.IsNullOrEmpty(item["Prêmio 31-40"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 31-40"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_41_45 = string.IsNullOrEmpty(item["Prêmio 41-45"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 41-45"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_46_50 = string.IsNullOrEmpty(item["Prêmio 46-50"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 46-50"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_51_55 = string.IsNullOrEmpty(item["Prêmio 51-55"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 51-55"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_56_60 = string.IsNullOrEmpty(item["Prêmio 56-60"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 56-60"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); dadosRendaVO.RendaPremio_61_65 = string.IsNullOrEmpty(item["Prêmio 61-65"].ToString()) ? DecimalNulo : Convert.ToDecimal(item["Prêmio 61-65"].ToString().Replace(".", ","), new CultureInfo("pt-BR")); if (!string.IsNullOrEmpty(dadosRendaVO.RendaPeriodo)) { TPlanoProtecaoBLL.InserirPlanoProtecaoRenda(dadosRendaVO); } } } } } } #endregion } catch (CABTECException) { throw new CABTECException("Erro ao Importar Arquivo Plano Proteção Familia."); } catch (Exception) { throw new CABTECException("Erro ao Importar Arquivo Plano Proteção Familia."); } }