コード例 #1
0
 public void SendControl(ControllerEnum aControl, int aValue, ChannelEnum aChannel = ChannelEnum.C0)
 {
     SendShortMessage((int)aChannel + (int)CommandEnum.Controller, (int)aControl, aValue);
 }
コード例 #2
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);
            }
        }
コード例 #3
0
 protected void DoChangeController(ControllerEnum controller)
 {
     this.controller = controller;
     EventsManager.CallEvent(EventAction.ChangeController, this.controller, this);
 }
コード例 #4
0
 protected byte[] SendCommand(ControllerEnum targetController, byte[] additionalInfo, bool isWaitAnswer = false)
 {
     byte[] buff = additionalInfo.Add((byte)targetController, 0);
     return(Connector.SendOneCommand(buff, isWaitAnswer));
 }