Пример #1
0
        private void PreencherCamposAbaDados()
        {
            try
            {
                if (Program.CodigoEntrevista > 0)
                {
                    DataTable tableTEntrevistado = ControllerEntrevistado.SelecioneEntrevistado(Program.CodigoEntrevista);

                    if (tableTEntrevistado.Rows.Count == 1)
                    {
                        if (!string.IsNullOrEmpty(tableTEntrevistado.Rows[0]["DataNascimento"].ToString()))
                        {
                            txtAba3CPF.Text = tableTEntrevistado.Rows[0]["CPF"].ToString();

                            DataCompleta = Convert.ToDateTime(tableTEntrevistado.Rows[0]["DataNascimento"]);
                            cmbAba3DataNascimentoDia.SelectedValue = DataCompleta.Day;
                            cmbAba3DataNascimentoMes.SelectedValue = DataCompleta.Month;
                            cmbAba3DataNascimentoAno.SelectedValue = DataCompleta.Year;


                            DadosTEntrevistado.FaixaEtaria = ControllerEnum.FaixaEtariaDataNascimento(DataCompleta);

                            cmbAba3Sexo.Text = tableTEntrevistado.Rows[0]["Sexo"].ToString();

                            string telefone = "(" + tableTEntrevistado.Rows[0]["DDD"].ToString() + ")" + tableTEntrevistado.Rows[0]["Telefone"].ToString();

                            if (telefone.Length > 4)
                            {
                                txtAba3Telefone.Text = telefone;
                            }

                            string celular = "(" + tableTEntrevistado.Rows[0]["DDDCelular"].ToString() + ")" + tableTEntrevistado.Rows[0]["Celular"].ToString();

                            if (celular.Length > 4)
                            {
                                txtAba3Celular.Text = celular;
                            }

                            DataTable tableTEntrevistadoEndereco = ControllerEntrevistadoEndereco.SelecioneEntrevistadoEndereco(Program.CodigoEntrevista);
                            if (tableTEntrevistadoEndereco.Rows.Count == 1)
                            {
                                txtAba3Email.Text = tableTEntrevistadoEndereco.Rows[0]["Email"].ToString();
                            }
                        }
                        else
                        {
                            PreencherCamposAbaDadosTemporario();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogErro.GravaLog("Erro ao preencher Aba Dados.", ex.Message);
            }
        }
Пример #2
0
        private void MapearCamposAbaDados()
        {
            try
            {
                DadosTEntrevistado.CodigoEntrevista = Program.CodigoEntrevista;
                DadosTEntrevistado.CPF = txtAba3CPF.Text;

                if (string.IsNullOrEmpty(cmbAba3DataNascimentoAno.Text) || string.IsNullOrEmpty(cmbAba3DataNascimentoMes.Text) || string.IsNullOrEmpty(cmbAba3DataNascimentoDia.Text))
                {
                    DadosTEntrevistado.DataNascimento = DataCompleta;
                }
                else
                {
                    string dataCompleta = cmbAba3DataNascimentoAno.Text + "-" + cmbAba3DataNascimentoMes.Text + "-" + cmbAba3DataNascimentoDia.Text;

                    DadosTEntrevistado.DataNascimento = Convert.ToDateTime(dataCompleta);
                }

                DadosTEntrevistado.FaixaEtaria = ControllerEnum.FaixaEtariaDataNascimento(DadosTEntrevistado.DataNascimento.GetValueOrDefault());

                DadosTEntrevistado.Sexo = cmbAba3Sexo.Text;

                if (txtAba3Telefone.Text.Length > 4)
                {
                    DadosTEntrevistado.DDD      = txtAba3Telefone.Text.Substring(1, 2);
                    DadosTEntrevistado.Telefone = txtAba3Telefone.Text.Substring(4);
                }

                if (txtAba3Celular.Text.Length > 4)
                {
                    DadosTEntrevistado.DDDCelular = txtAba3Celular.Text.Substring(1, 2);
                    DadosTEntrevistado.Celular    = txtAba3Celular.Text.Substring(4);
                }
            }
            catch (Exception ex)
            {
                LogErro.GravaLog("Erro ao mapear Aba Dados.", ex.Message);
                CaixaMensagem.ExibirOk("Erro ao mapear Aba Dados!");
            }
        }
Пример #3
0
        private void MapearCamposAbaPessoal()
        {
            try
            {
                DadosTEntrevistado.CodigoEntrevista = DadosTEntrevista.CodigoEntrevista;
                DadosTEntrevistado.Nome             = txtAba1Nome.Text;
                DadosTEntrevistado.EstadoCivil      = Convert.ToInt32(cmbAba1EstadoCivil.SelectedValue);
                DadosTEntrevistado.IDProfissao      = Convert.ToInt32(cmbAba1Profissao.SelectedValue);

                //TODO JOAO  Verificar o capital de acordo com a profissão
                //DadosTEntrevistado.CapitalLimitado = cmbAba1Capital.SelectedValue.ToString();
                if ((pAba1ConjugePanel.Visible) &&
                    !string.IsNullOrEmpty(cmbAba1DataNascimentoAno.Text) &&
                    !string.IsNullOrEmpty(cmbAba1DataNascimentoMes.Text) &&
                    !string.IsNullOrEmpty(cmbAba1DataNascimentoDia.Text))
                {
                    string dataCompleta = cmbAba1DataNascimentoAno.Text + "-" + cmbAba1DataNascimentoMes.Text + "-" + cmbAba1DataNascimentoDia.Text;

                    DadosTEntrevistado.IDProfissaoConjuge    = Convert.ToInt32(cmbAba1ConjugeProfissao.SelectedValue);
                    DadosTEntrevistado.FaixaEtariaConjuge    = ControllerEnum.FaixaEtariaDataNascimento(Convert.ToDateTime(dataCompleta));
                    DadosTEntrevistado.DataNascimentoConjuge = Convert.ToDateTime(dataCompleta);
                }
                else
                {
                    DadosTEntrevistado.IDProfissaoConjuge    = 0;
                    DadosTEntrevistado.FaixaEtariaConjuge    = 0;
                    DadosTEntrevistado.DataNascimentoConjuge = null;
                }
                //DadosTEntrevistado.CapitalLimitadoConjuge = cmbAba2Capital.SelectedValue.ToString();
            }
            catch (Exception ex)
            {
                LogErro.GravaLog("Erro ao mapear Aba Pessoal.", ex.Message);
                CaixaMensagem.ExibirOk("Erro ao mapear Aba Pessoal!");
            }
        }
Пример #4
0
        private void PopularSimulador()
        {
            try
            {
                if (ControllerEnum.FaixaEtariaDataNascimento(DadosTEntrevistado.DataNascimento.GetValueOrDefault()) != (int)FaixaEtaria.PREMIO_81)
                {
                    List <ProdutoPrincipal> produtos = new List <ProdutoPrincipal>();
                    int  idadeBase       = 0;
                    bool alterarAgregado = true;
                    TipoRegistro           = 'A';
                    DadosTSimuladorProduto = new TSimuladorProdutoDOMINIO();
                    DadosTPlanoProtecao    = new TPlanoProtecaoDOMINIO();
                    DadosTPlanoSenior      = new TPlanoSeniorDOMINIO();
                    DadosTPlanoCasal       = new TPlanoCasalDOMINIO();
                    ControllerPlano.PlanoProtecaoDOMINIO = new TPlanoProtecaoDOMINIO();
                    ControllerPlano.PlanoSeniorDOMINIO   = new TPlanoSeniorDOMINIO();
                    ControllerPlano.PlanoCasalDOMINIO    = new TPlanoCasalDOMINIO();

                    //Verifica se já foi feita simulação
                    DataTable tableProduto = ControllerSimuladorProduto.SelecioneSimuladorProduto(DadosTEntrevista.CodigoEntrevista);

                    if (tableProduto.Rows.Count > 0)
                    {
                        DadosTSimuladorProduto.IDSimuladorProduto   = Convert.ToInt32(tableProduto.Rows[0]["IDSimuladorProduto"]);
                        DadosTSimuladorProduto.IDEntrevista         = Convert.ToInt64(tableProduto.Rows[0]["IDEntrevista"]);
                        DadosTSimuladorProduto.Produto              = tableProduto.Rows[0]["Produto"].ToString();
                        DadosTSimuladorProduto.PremioTotal          = Convert.ToDecimal(tableProduto.Rows[0]["PremioTotal"]);
                        DadosTSimuladorProduto.FaixaEtaria          = Convert.ToInt32(tableProduto.Rows[0]["FaixaEtaria"]);
                        DadosTSimuladorProduto.FaixaEtariaConjuge   = Convert.ToInt32(tableProduto.Rows[0]["FaixaEtariaConjuge"]);
                        DadosTSimuladorProduto.RespostaBaseRenda    = Convert.ToInt32(tableProduto.Rows[0]["RespostaBaseRenda"]);
                        DadosTSimuladorProduto.RespostaBaseDisposto = Convert.ToInt32(tableProduto.Rows[0]["RespostaBaseDisposto"]);

                        //Verificações para Aba Planos
                        if ((DadosTSimuladorProduto.FaixaEtaria == DadosTEntrevistado.FaixaEtaria) &&
                            (DadosTSimuladorProduto.FaixaEtariaConjuge == DadosTEntrevistado.FaixaEtariaConjuge) &&
                            (DadosTSimuladorProduto.RespostaBaseRenda == Resposta2) &&
                            (DadosTSimuladorProduto.RespostaBaseDisposto == Resposta7))
                        {
                            int CalculaBase = 0;
                            ControllerPlano.FaixaBase(DadosTEntrevistado.FaixaEtaria, DadosTEntrevistado.FaixaEtariaConjuge, ref CalculaBase);
                            FaixaBase         = CalculaBase;
                            ProdutoDisponivel = new List <ProdutoPrincipal>();
                            if ((FaixaBase <= 6) || (FaixaBase == 8))
                            {
                                ProdutoDisponivel.Add(ProdutoPrincipal.PLANOPROTECAO);
                            }

                            if ((FaixaBase >= 6) && (FaixaBase != 8))
                            {
                                ProdutoDisponivel.Add(ProdutoPrincipal.PLANOSENIOR);

                                ProdutoDisponivel.Add(ProdutoPrincipal.PLANOCASAL);
                            }

                            PreencherDominoAbaSimuladorSubPlanos();

                            alterarAgregado = false;
                            GravarSimulador = false;
                        }
                        else
                        {
                            if (ControllerPlano.SimularPlano(DadosTEntrevistado.DataNascimento.Value, DadosTEntrevistado.DataNascimentoConjuge, Resposta2, Resposta7, ref produtos, ref idadeBase))
                            {
                                FaixaBase           = idadeBase;
                                DadosTPlanoProtecao = ControllerPlano.PlanoProtecaoDOMINIO;
                                DadosTPlanoSenior   = ControllerPlano.PlanoSeniorDOMINIO;
                                DadosTPlanoCasal    = ControllerPlano.PlanoCasalDOMINIO;
                                PremioTotalMax      = ControllerPlano.TotalMax;
                                ProdutoDisponivel   = produtos;
                                GravarSimulador     = true;
                                TipoRegistro        = 'S';
                            }
                        }
                    }
                    else
                    {
                        if (ControllerPlano.SimularPlano(DadosTEntrevistado.DataNascimento.Value, DadosTEntrevistado.DataNascimentoConjuge, Resposta2, Resposta7, ref produtos, ref idadeBase))
                        {
                            FaixaBase           = idadeBase;
                            DadosTPlanoProtecao = ControllerPlano.PlanoProtecaoDOMINIO;
                            DadosTPlanoSenior   = ControllerPlano.PlanoSeniorDOMINIO;
                            DadosTPlanoCasal    = ControllerPlano.PlanoCasalDOMINIO;
                            PremioTotalMax      = ControllerPlano.TotalMax;
                            ProdutoDisponivel   = produtos;
                            GravarSimulador     = true;
                            TipoRegistro        = 'S';
                        }

                        DadosTSimuladorProduto.Produto = "Produto";
                    }

                    //Preenche campos do simulador
                    PreencherCamposSimuladorAbaPlanos();

                    //Verificações para Aba Agregados
                    PreencherDominoAbaSimuladorSubAgregados(alterarAgregado);

                    if (DadosTPlanoProtecao.IDPlanoProtecao > 0 || DadosTSimuladorProduto.Produto.Equals(ProdutoPrincipal.PLANOPROTECAO.GetStringValue()))
                    {
                        //Verificações para Aba Renda
                        PreencherDominoAbaSimuladorSubRenda();
                        PreencherCamposSimuladorAbaRenda();
                    }

                    PreencherCamposTotais();

                    if (GravarSimulador)
                    {
                        SalvarAbaSimulador();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.CaixaMensagem.ExibirOk(ex.Message);

                Util.LogErro.GravaLog("Erro ao Simular Plano.", ex.Message);
            }
        }