private void PopularSimuladorAbaTabelasComboPlanoSenior() { lblAba5Sub5Sub2Produto.Text = ProdutoPrincipal.PLANOSENIOR.GetStringValue(); lblAba5Sub5Sub3Produto.Text = ProdutoPrincipal.PLANOSENIOR.GetStringValue(); lblAba5Sub5Sub4Produto.Text = ProdutoPrincipal.PLANOSENIOR.GetStringValue(); cmbAba5Sub5Sub2Morte.DataSource = new BindingSource(ControllerPlanoSenior.ListarTodosFuneralPrincipal(true, Convert.ToInt32(cmbAba5Sub5Sub1FaixaBase.SelectedValue)), null); cmbAba5Sub5Sub2Morte.ValueMember = "Key"; cmbAba5Sub5Sub2Morte.DisplayMember = "Value"; DadosCmbAba5Sub5Sub2Morte = ControllerPlanoSenior.ListarTodosFuneralPrincipal(true, Convert.ToInt32(cmbAba5Sub5Sub1FaixaBase.SelectedValue)); TextoCmbAba5Sub5Sub2Morte = string.Empty; cmbAba5Sub5Sub2Funeral.DataSource = new BindingSource(ControllerPlanoSenior.ListarTodosFuneralCategoria(true), null); cmbAba5Sub5Sub2Funeral.ValueMember = "Key"; cmbAba5Sub5Sub2Funeral.DisplayMember = "Value"; DadosCmbAba5Sub5Sub2Funeral = ControllerPlanoSenior.ListarTodosFuneralCategoria(true); TextoCmbAba5Sub5Sub2Funeral = string.Empty; lblAba5Sub5Sub2AssistOUConj.Visible = false; lblAba5Sub5Sub2AssistOUConjValor.Visible = false; lblAba5Sub5Sub2AssistOUConj.Width = 200; lblAba5Sub5Sub2IPA.Visible = false; lblAba5Sub5Sub2IPAValor.Visible = false; }
private void PreencherSimuladorAbaTabelasSubPlano() { if (Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue) == (int)ProdutoPrincipal.PLANOPROTECAO && cmbAba5Sub5Sub2Morte.SelectedIndex > 0 && cmbAba5Sub5Sub2Funeral.SelectedIndex > 0) { TPlanoProtecaoDOMINIO registro = ControllerPlanoProtecao.CalcularPremioFuneral(Convert.ToDecimal(cmbAba5Sub5Sub2Morte.SelectedValue), 0, 0, Convert.ToInt32(cmbAba5Sub5Sub2Funeral.SelectedValue), Convert.ToInt32(cmbAba5Sub5Sub1FaixaBase.SelectedValue)); lblAba5Sub5Sub2AssistOUConjValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.CoberturaAcidente); lblAba5Sub5Sub2IPAValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.CoberturaEmergencia); lblAba5Sub5Sub2PremioPlanoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.ValorPremioIdadeBase.GetValueOrDefault()); } if (Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue) == (int)ProdutoPrincipal.PLANOSENIOR && cmbAba5Sub5Sub2Morte.SelectedIndex > 0 && cmbAba5Sub5Sub2Funeral.SelectedIndex > 0) { TPlanoSeniorDOMINIO registro = ControllerPlanoSenior.CalcularPremioFuneral(Convert.ToDecimal(cmbAba5Sub5Sub2Morte.SelectedValue), Convert.ToInt32(cmbAba5Sub5Sub2Funeral.SelectedValue), Convert.ToInt32(cmbAba5Sub5Sub1FaixaBase.SelectedValue)); lblAba5Sub5Sub2PremioPlanoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.ValorPremioIdadeBase.GetValueOrDefault()); } if (Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue) == (int)ProdutoPrincipal.PLANOCASAL && cmbAba5Sub5Sub2Morte.SelectedIndex > 0 && cmbAba5Sub5Sub2Funeral.SelectedIndex > 0) { TPlanoCasalDOMINIO registro = ControllerPlanoCasal.CalcularPremioFuneral(Convert.ToDecimal(cmbAba5Sub5Sub2Morte.SelectedValue), 0, Convert.ToInt32(cmbAba5Sub5Sub2Funeral.SelectedValue), Convert.ToInt32(cmbAba5Sub5Sub1FaixaBase.SelectedValue)); lblAba5Sub5Sub2AssistOUConjValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.CoberturaConjuge); lblAba5Sub5Sub2PremioPlanoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", registro.ValorPremioIdadeBase.GetValueOrDefault()); } }
private void PopularPlanoSeniorFuneralPrincipal() { ddlPlanoSeniorFuneralPrincipalNovo.DataValueField = "Key"; ddlPlanoSeniorFuneralPrincipalNovo.DataTextField = "Value"; ddlPlanoSeniorFuneralPrincipalNovo.DataSource = ControllerPlanoSenior.ListarTodosFuneralPrincipal(true, FaixaBase); ddlPlanoSeniorFuneralPrincipalNovo.DataBind(); }
private void PopularPlanoSeniorFuneralCategoria() { ddlPlanoSeniorFuneralCategoriaNovo.DataValueField = "Key"; ddlPlanoSeniorFuneralCategoriaNovo.DataTextField = "Value"; ddlPlanoSeniorFuneralCategoriaNovo.DataSource = ControllerPlanoSenior.ListarTodosFuneralCategoria(true); ddlPlanoSeniorFuneralCategoriaNovo.DataBind(); }
private void VerificaPlanoSeniorFuneral() { if (ddlPlanoSeniorFuneralPrincipalNovo.SelectedIndex > 0 && ddlPlanoSeniorFuneralCategoriaNovo.SelectedIndex > 0) { PlanoSeniorFuneralNovoVO = ControllerPlanoSenior.CalcularPremioFuneral(Convert.ToDecimal(ddlPlanoSeniorFuneralPrincipalNovo.SelectedValue), Convert.ToInt32(ddlPlanoSeniorFuneralCategoriaNovo.SelectedValue), FaixaBase); txtPlanoSeniorFuneralPremioNovo.Text = PlanoSeniorFuneralNovoVO.ValorPremioIdadeBase.GetValueOrDefault().ToString(); } }
protected void imgPlanoProtecaoAgregadosNovo_Click(object sender, ImageClickEventArgs e) { if (ddlPlanoProtecaoAgregadosGrauNovo.SelectedIndex > 0 && !string.IsNullOrEmpty(txtPlanoProtecaoAgregadosIdadeNovo.Text)) { if (Convert.ToInt32(txtPlanoProtecaoAgregadosIdadeNovo.Text) <= 80) { if ((FaixaBase >= 7) && (txtProdutoDefinido.Text.Equals(ProdutoPrincipal.PLANOSENIOR.GetStringValue())) && (Convert.ToInt32(ddlPlanoProtecaoAgregadosGrauNovo.SelectedValue) == (int)GrauParentesco.CONJUGE) && (Convert.ToInt32(txtPlanoProtecaoAgregadosIdadeNovo.Text) <= 61)) { RequiredFieldValidator required = new RequiredFieldValidator(); required.ValidationGroup = "PlanoProtecaoAgregadosNovo"; required.ErrorMessage = "O titular não poderá informar o cônjuge como agregado."; required.IsValid = false; required.ControlToValidate = ddlPlanoProtecaoAgregadosGrauNovo.ID; ValidationSummary2.Controls.Add(required); } else { List <TAgregadoVO> ListaTemp = ListaAgregadoVOTemp; TAgregadoVO temporario = new TAgregadoVO(); temporario.Identificador = ListaTemp.Count() + 1; temporario.GrauParentesco = ddlPlanoProtecaoAgregadosGrauNovo.SelectedItem.Text; temporario.Idade = Convert.ToInt32(txtPlanoProtecaoAgregadosIdadeNovo.Text); if (PlanoProtecaoVO.IDPlanoProtecao > 0) { temporario.Premio = ControllerPlanoProtecao.CalcularPremioAgregado(Convert.ToInt32(ddlPlanoProtecaoAgregadosGrauNovo.SelectedValue), temporario.Idade, PlanoProtecaoVO.NomePlano); } if (PlanoCasalVO.IDPlanoCasal > 0) { temporario.Premio = ControllerPlanoCasal.CalcularPremioAgregado(Convert.ToInt32(ddlPlanoProtecaoAgregadosGrauNovo.SelectedValue), temporario.Idade, PlanoCasalVO.NomePlano); } if (PlanoSeniorVO.IDPlanoSenior > 0) { temporario.Premio = ControllerPlanoSenior.CalcularPremioAgregado(Convert.ToInt32(ddlPlanoProtecaoAgregadosGrauNovo.SelectedValue), temporario.Idade, PlanoSeniorVO.NomePlano); } ListaTemp.Add(temporario); ListaAgregadoVOTemp = ListaTemp; grdPlanoProtecaoAgregadosNovo.DataSource = ListaAgregadoVOTemp; grdPlanoProtecaoAgregadosNovo.DataBind(); txtPlanoProtecaoAgregadosPremioNovo.Text = ListaAgregadoVOTemp.Sum(registro => registro.Premio).ToString(); ddlPlanoProtecaoAgregadosGrauNovo.SelectedIndex = 0; txtPlanoProtecaoAgregadosIdadeNovo.Text = string.Empty; } } } ModalPopupExtender1.Show(); }
private void PopularComboPlanoSenior() { cmbAba5Sub1SeniorMorte.DataSource = new BindingSource(ControllerPlanoSenior.ListarTodosFuneralPrincipal(false, FaixaBase), null); cmbAba5Sub1SeniorMorte.ValueMember = "Key"; cmbAba5Sub1SeniorMorte.DisplayMember = "Value"; DadosCmbAba5Sub1SeniorMorte = ControllerPlanoSenior.ListarTodosFuneralPrincipal(false, FaixaBase); TextoCmbAba5Sub1SeniorMorte = string.Empty; cmbAba5Sub1SeniorFuneral.DataSource = new BindingSource(ControllerPlanoSenior.ListarTodosFuneralCategoria(false), null); cmbAba5Sub1SeniorFuneral.ValueMember = "Key"; cmbAba5Sub1SeniorFuneral.DisplayMember = "Value"; DadosCmbAba5Sub1SeniorFuneral = ControllerPlanoSenior.ListarTodosFuneralCategoria(false); TextoCmbAba5Sub1SeniorFuneral = string.Empty; }
private void VerificaPlanoSeniorFuneral() { try { Decimal morte = Convert.ToDecimal(cmbAba5Sub1SeniorMorte.SelectedValue); Int32 funeral = Convert.ToInt32(cmbAba5Sub1SeniorFuneral.SelectedValue); if (!string.IsNullOrEmpty(cmbAba5Sub1SeniorMorte.Text) && !string.IsNullOrEmpty(cmbAba5Sub1SeniorFuneral.Text)) { DadosTPlanoSeniorNovo = ControllerPlanoSenior.CalcularPremioFuneral(Convert.ToDecimal(cmbAba5Sub1SeniorMorte.SelectedValue), Convert.ToInt32(cmbAba5Sub1SeniorFuneral.SelectedValue), FaixaBase); PremioPlano = DadosTPlanoSeniorNovo.ValorPremioIdadeBase.GetValueOrDefault(); lblAba5Sub1PremioPlanoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", DadosTPlanoSeniorNovo.ValorPremioIdadeBase.GetValueOrDefault()); lblAba5Sub1PremioAgregadoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", PremioAgregado); lblAba5Sub1PremioRendaValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", PremioRenda); lblAba5Sub1PremioTotalValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", DadosTPlanoSeniorNovo.ValorPremioIdadeBase.GetValueOrDefault() + PremioAgregado + PremioRenda); } } catch { } }
protected void imgUploadAS_Click(object sender, ImageClickEventArgs e) { if (fupUploadAS.HasFile) { lblMSGUploadAS.Text = "Inicio do Processo."; try { Util.Util.VerificarTamanhoArquivo(fupUploadAS.PostedFile.ContentLength); if (string.IsNullOrEmpty(WebConfigurationManager.AppSettings["ExcelUPLOAD"])) { throw new CABTECException("O valor para chave ExcelUPLOAD não foi infomado no web.config"); } string caminhoArquivosExcel = WebConfigurationManager.AppSettings["ExcelUPLOAD"]; caminhoArquivosExcel = HttpContext.Current.Server.MapPath(caminhoArquivosExcel + "\\" + fupUploadAS.FileName); Util.Util.SalvarArquivo("ExcelUPLOAD", fupUploadAS); ControllerPlanoSenior.ImportarArquivo("ExcelUPLOAD", fupUploadAS.FileName); lblMSGUploadAS.Text = "Processo realizado com sucesso."; } catch (CABTECException exception) { MostrarMensagem(exception.Message); } catch (Exception ex) { MostrarMensagem(ex.Message); } finally { Util.Util.ExcluirArquivo("ExcelUPLOAD", fupUploadAS.FileName); } } }
//private void cmbAba5Sub5Sub3Funeral_KeyPress(object sender, KeyPressEventArgs e) //{ // if (e.KeyChar == 42 || e.KeyChar == 9 || e.KeyChar == 13) // { // TextoCmbAba5Sub5Sub3Funeral = string.Empty; // e.Handled = true; // return; // } // string atual = TextoCmbAba5Sub5Sub3Funeral; // if (e.KeyChar != 13) // TextoCmbAba5Sub5Sub3Funeral += e.KeyChar.ToString(); // else // { // e.Handled = true; return; // } // Dictionary<int, string> verificaCombo = DadosCmbAba5Sub5Sub3Funeral.Where(registro => registro.Value.Contains(TextoCmbAba5Sub5Sub3Funeral)).ToDictionary(registro => registro.Key, registro => registro.Value); // if (verificaCombo.Count > 0) // { // ((ComboBox)sender).SelectedValue = verificaCombo.FirstOrDefault().Key; // } // else // { // TextoCmbAba5Sub5Sub3Funeral = atual; // } // e.Handled = true; //} private void btnAba5Sub5Sub3Adicionar_Click(object sender, EventArgs e) { if (cmbAba5Sub5Sub3Parentesco.SelectedIndex > 0 && cmbAba5Sub5Sub3Funeral.SelectedIndex > 0 && !string.IsNullOrEmpty(txtAba5Sub5Sub3Idade.Text)) { if ((Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue) == (int)ProdutoPrincipal.PLANOSENIOR) && (Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue) == (int)GrauParentesco.CONJUGE) && (Convert.ToInt32(txtAba5Sub5Sub3Idade.Text) >= 61)) { Util.CaixaMensagem.ExibirOk("O titular não poderá informar o cônjuge maior de 61 anos como agregado."); return; } else if ((Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue) == (int)ProdutoPrincipal.PLANOPROTECAO) && ((Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue) == (int)GrauParentesco.FILHO) || (Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue) == (int)GrauParentesco.ENTEADO)) && (Convert.ToInt32(txtAba5Sub5Sub3Idade.Text) <= 24)) { Util.CaixaMensagem.ExibirOk("O titular não poderá informar o filho/enteado menor de 25 anos como agregado."); return; } else if (Convert.ToInt32(txtAba5Sub5Sub3Idade.Text) > 80) { Util.CaixaMensagem.ExibirOk("O titular não poderá informar um agregado maior que 80 anos."); return; } else { TAgregadoDOMINIO temporario = new TAgregadoDOMINIO(); //PremioAgregadoTabelas = new List<decimal>(); temporario.GrauParentesco = cmbAba5Sub5Sub3Parentesco.Text; temporario.Idade = Convert.ToInt32(txtAba5Sub5Sub3Idade.Text); temporario.Funeral = cmbAba5Sub5Sub3Funeral.Text; switch (Convert.ToInt32(cmbAba5Sub5Sub1Produto.SelectedValue)) { case (int)ProdutoPrincipal.PLANOPROTECAO: temporario.Premio = ControllerPlanoProtecao.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); cmbAba5Sub5Sub3Funeral.Text = DadosTPlanoProtecao.NomePlano; break; case (int)ProdutoPrincipal.PLANOSENIOR: temporario.Premio = ControllerPlanoSenior.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); cmbAba5Sub5Sub3Funeral.Text = DadosTPlanoSenior.NomePlano; break; case (int)ProdutoPrincipal.PLANOCASAL: temporario.Premio = ControllerPlanoCasal.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub5Sub3Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); cmbAba5Sub5Sub3Funeral.Text = DadosTPlanoCasal.NomePlano; break; default: break; } lstAba5Sub5Sub3Agregado.Items.Add(temporario.GrauParentesco.Trim() + " - " + temporario.Idade + " - " + String.Format(new CultureInfo("pt-BR"), "{0:C}", temporario.Premio) + " - " + temporario.Funeral); PremioAgregadoTabelas.Add(temporario.Premio); cmbAba5Sub5Sub3Parentesco.SelectedIndex = 0; txtAba5Sub5Sub3Idade.Text = string.Empty; decimal valorTotal = 0; foreach (decimal item in PremioAgregadoTabelas) { valorTotal += item; } lblAba5Sub5Sub3PremioAgregadoValor.Text = String.Format(new CultureInfo("pt-BR"), "{0:C}", valorTotal); lblAba5Sub5Sub3QuantidadeValor.Text = lstAba5Sub5Sub3Agregado.Items.Count.ToString(); cmbAba5Sub5Sub3Parentesco.Focus(); } } }
private void PreencherDominoAbaSimuladorSubAgregados(bool alterar) { lstAba5Sub2Agregado.Items.Clear(); lstAba5Sub2Dependente.Items.Clear(); PremioAgregadoTemp = new List <decimal>(); PremioAgregado = 0; PopularCombosAbaSimuladorSubAgregado(); DataTable tableAgregados = ControllerSimuladorSubAgregado.SelecioneSimuladorSubAgregado(DadosTSimuladorProduto.IDSimuladorProduto); if (tableAgregados.Rows.Count > 0 && !alterar) { foreach (DataRow agregadoRow in tableAgregados.Rows) { TAgregadoDOMINIO temporario = new TAgregadoDOMINIO(); temporario.GrauParentesco = agregadoRow["GrauParentesco"].ToString(); temporario.Idade = Convert.ToInt32(agregadoRow["Idade"]); cmbAba5Sub2Parentesco.SelectedText = temporario.GrauParentesco; switch (ProdutoCalculo) { case (int)ProdutoPrincipal.PLANOPROTECAO: temporario.Funeral = DadosTPlanoProtecao.NomePlano; temporario.Premio = ControllerPlanoProtecao.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; case (int)ProdutoPrincipal.PLANOSENIOR: temporario.Funeral = DadosTPlanoSenior.NomePlano; temporario.Premio = ControllerPlanoSenior.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; case (int)ProdutoPrincipal.PLANOCASAL: temporario.Funeral = DadosTPlanoCasal.NomePlano; temporario.Premio = ControllerPlanoCasal.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; default: break; } if ((temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade <= 65) || (temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOCASAL) || ((temporario.GrauParentesco.Contains(GrauParentesco.FILHO.GetStringValue()) || temporario.GrauParentesco.Contains(GrauParentesco.ENTEADO.GetStringValue())) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade <= 24)) { lstAba5Sub2Dependente.Items.Add(temporario.GrauParentesco + " - " + temporario.Idade); } else { if (!(temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade > 65) && !(temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOSENIOR && temporario.Idade >= 61) && (temporario.Idade <= 80)) { lstAba5Sub2Agregado.Items.Add(temporario.GrauParentesco + " - " + temporario.Idade + " - " + String.Format(new CultureInfo("pt-BR"), "{0:C}", temporario.Premio)); PremioAgregadoTemp.Add(temporario.Premio); PremioAgregado += temporario.Premio; } } } } else { foreach (String agregadoPergunta in lstAba2Sub1Parentes.Items) { String[] separacao = agregadoPergunta.Split('-'); if (separacao.Length > 2) { TAgregadoDOMINIO temporario = new TAgregadoDOMINIO(); temporario.GrauParentesco = separacao[0]; temporario.Idade = Convert.ToInt32(separacao[1]); cmbAba5Sub2Parentesco.SelectedText = temporario.GrauParentesco; if (!temporario.GrauParentesco.Contains(GrauParentesco.AVOM.GetStringValue()) && !temporario.GrauParentesco.Contains(GrauParentesco.AVOF.GetStringValue()) && !temporario.GrauParentesco.Contains(GrauParentesco.OUTRO.GetStringValue())) { switch (ProdutoCalculo) { case (int)ProdutoPrincipal.PLANOPROTECAO: temporario.Funeral = DadosTPlanoProtecao.NomePlano; temporario.Premio = ControllerPlanoProtecao.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, DadosTPlanoProtecao.NomePlano); break; case (int)ProdutoPrincipal.PLANOSENIOR: temporario.Funeral = DadosTPlanoSenior.NomePlano; temporario.Premio = ControllerPlanoSenior.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, DadosTPlanoSenior.NomePlano); break; case (int)ProdutoPrincipal.PLANOCASAL: temporario.Funeral = DadosTPlanoCasal.NomePlano; temporario.Premio = ControllerPlanoCasal.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, DadosTPlanoCasal.NomePlano); break; default: break; } if ((temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade <= 65) || (temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOCASAL) || ((temporario.GrauParentesco.Contains(GrauParentesco.FILHO.GetStringValue()) || temporario.GrauParentesco.Contains(GrauParentesco.ENTEADO.GetStringValue())) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade <= 24)) { lstAba5Sub2Dependente.Items.Add(temporario.GrauParentesco + " - " + temporario.Idade); } else { if (!(temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO && temporario.Idade > 65) && !(temporario.GrauParentesco.Contains(GrauParentesco.CONJUGE.GetStringValue()) && ProdutoCalculo == (int)ProdutoPrincipal.PLANOSENIOR && temporario.Idade >= 61) && (temporario.Idade <= 80)) { lstAba5Sub2Agregado.Items.Add(temporario.GrauParentesco + " - " + temporario.Idade + " - " + String.Format(new CultureInfo("pt-BR"), "{0:C}", temporario.Premio)); PremioAgregadoTemp.Add(temporario.Premio); PremioAgregado += temporario.Premio; } } } } } } lblAba5Sub2QuantidadeValor.Text = lstAba5Sub2Agregado.Items.Count.ToString(); lblAba5Sub2QtdDepValor.Text = lstAba5Sub2Dependente.Items.Count.ToString(); }
private void btnAba5Sub2Adicionar_Click(object sender, EventArgs e) { if (cmbAba5Sub2Parentesco.SelectedIndex > 0 && !string.IsNullOrEmpty(txtAba5Sub2Idade.Text)) { if ((ProdutoCalculo == (int)ProdutoPrincipal.PLANOSENIOR) && (Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue) == (int)GrauParentesco.CONJUGE) && (Convert.ToInt32(txtAba5Sub2Idade.Text) >= 61)) { lstAba5Sub2Dependente.Items.Add(cmbAba5Sub2Parentesco.Text + " - " + txtAba5Sub2Idade.Text); lblAba5Sub2QtdDepValor.Text = lstAba5Sub2Dependente.Items.Count.ToString(); return; } else if ((ProdutoCalculo == (int)ProdutoPrincipal.PLANOPROTECAO) && (cmbAba5Sub2Parentesco.Text.Equals(GrauParentesco.FILHO.GetStringValue()) || cmbAba5Sub2Parentesco.Text.Equals(GrauParentesco.ENTEADO.GetStringValue())) && (Convert.ToInt32(txtAba5Sub2Idade.Text) <= 24)) { lstAba5Sub2Dependente.Items.Add(cmbAba5Sub2Parentesco.Text + " - " + txtAba5Sub2Idade.Text); lblAba5Sub2QtdDepValor.Text = lstAba5Sub2Dependente.Items.Count.ToString(); return; } else if (Convert.ToInt32(txtAba5Sub2Idade.Text) > 80) { Util.CaixaMensagem.ExibirOk("O titular não poderá informar um agregado maior que 80 anos."); return; } else { TAgregadoDOMINIO temporario = new TAgregadoDOMINIO(); temporario.GrauParentesco = cmbAba5Sub2Parentesco.Text; temporario.Idade = Convert.ToInt32(txtAba5Sub2Idade.Text); switch (ProdutoCalculo) { case (int)ProdutoPrincipal.PLANOPROTECAO: temporario.Funeral = DadosTPlanoProtecao.NomePlano; temporario.Premio = ControllerPlanoProtecao.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; case (int)ProdutoPrincipal.PLANOSENIOR: temporario.Funeral = DadosTPlanoSenior.NomePlano; temporario.Premio = ControllerPlanoSenior.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; case (int)ProdutoPrincipal.PLANOCASAL: temporario.Funeral = DadosTPlanoCasal.NomePlano; temporario.Premio = ControllerPlanoCasal.CalcularPremioAgregado(Convert.ToInt32(cmbAba5Sub2Parentesco.SelectedValue), temporario.Idade, temporario.Funeral); break; default: break; } lstAba5Sub2Agregado.Items.Add(temporario.GrauParentesco.Trim() + " - " + temporario.Idade + " - " + String.Format(new CultureInfo("pt-BR"), "{0:C}", temporario.Premio)); PremioAgregadoTemp.Add(temporario.Premio); PremioAgregado += temporario.Premio; cmbAba5Sub2Parentesco.SelectedIndex = 0; txtAba5Sub2Idade.Text = string.Empty; PreencherCamposTotais(); lblAba5Sub2QuantidadeValor.Text = lstAba5Sub2Agregado.Items.Count.ToString(); } } }