Example #1
0
        public void CalculaValorSeguradora(Seguradora seguradora, Cotacao cotacao)
        {
            var acrescimoTipoViagem = new AcrescimoTipoViagemDAO().ObterPorTipoViagem(seguradora.SegId, cotacao.TipoViagem); // passando como parâmetro os valores da tabela seguradora.SegId e tabela cotacao.TipoViagem

            double acrescimo1 = 0, acrescimo2 = 0, acrescimo3 = 0;

            var ValorDias   = seguradora.ValorPorDia * cotacao.QtdeDias;         // Valor por dia * qntide de dias que o usuário vai ficar
            var ValorPessoa = seguradora.ValorPorPessoa * cotacao.QtdeViajantes; // Valor por pessoa * qntde de Viajantes
            var Comissao    = (seguradora.Comissao / 100) + 1;
            var ValorFinal  = ValorDias + ValorPessoa;

            if (acrescimoTipoViagem != null)
            {
                acrescimo1 = ValorFinal * ((acrescimoTipoViagem.AcrescimoViagem / 100) + 1);  //
            }


            var acrescimoMeioTransporte = new AcrescimoMeioTransporteDAO().ObterPorMeioTransporte(seguradora.SegId, cotacao.MeioTransporte);

            if (acrescimoMeioTransporte != null)
            {
                acrescimo2 = ValorFinal * ((acrescimoMeioTransporte.AcrescimoTransporte / 100) + 1);
            }

            var acrescimoMotivoViagem = new AcrescimoMotivoViagemDAO().OberPorMotivoViagem(seguradora.SegId, cotacao.MotivoViagem);

            if (acrescimoMotivoViagem != null)
            {
                acrescimo3 = ValorFinal * ((acrescimoMotivoViagem.AcrescimoMotivo / 100) + 1);
            }

            seguradora.Valor  = (acrescimo1 + acrescimo2 + acrescimo3) * Comissao;
            seguradora.CotdId = cotacao.CotId;
        }
Example #2
0
        public ActionResult Atualizar(int id)
        {
            var dao = new AcrescimoMotivoViagemDAO();
            AcrescimoMotivoViagem acrescimo = dao.BuscaPorId(id);

            return(View(acrescimo));
        }
Example #3
0
        public ActionResult Listar()
        {
            var dao       = new AcrescimoMotivoViagemDAO();
            var acrescimo = dao.Lista();

            return(View(acrescimo));
        }
Example #4
0
 public ActionResult Atualizar(AcrescimoMotivoViagem acrescimoMotivoViagem)
 {
     if (ModelState.IsValid)
     {
         var dao = new AcrescimoMotivoViagemDAO();
         dao.Atualizar(acrescimoMotivoViagem);
         return(RedirectToAction("Listar"));
     }
     return(View("Atualizar"));
 }