Ejemplo n.º 1
0
 public RR.ExcessAmountResponse GetExcessAmount(RR.ExcessAmountRequest request)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BLO.ExcessAmountRequest  details = _mapper.Map <RR.ExcessAmountRequest, BLO.ExcessAmountRequest>(request);
             BLO.ExcessAmountResponse result  = _motorInsuranceRepository.GetExcessCalcualtion(details);
             return(_mapper.Map <BLO.ExcessAmountResponse, RR.ExcessAmountResponse>(result));
         }
         else
         {
             var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
             return(new RR.ExcessAmountResponse()
             {
                 IsTransactionDone = false,
                 TransactionErrorMessage = message
             });
         }
     }
     catch (Exception ex)
     {
         return(new RR.ExcessAmountResponse
         {
             IsTransactionDone = true,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Ejemplo n.º 2
0
        public decimal GetExcess(BO.MotorInsurancePolicy policy, BO.MotorProductMaster product, int Age)
        {
            decimal excessAmount = decimal.Zero;

            var underAgeLimit = product != null ? product.UnderAge : 25;

            var excessRequest = new BKIC.SellingPoint.DL.BO.ExcessAmountRequest
            {
                VehicleMake  = policy.VehicleMake,
                VehicleModel = policy.VehicleModel,
                ExcessType   = policy.ExcessType,
                Agency       = policy.Agency,
                AgentCode    = policy.AgencyCode,
                MainClass    = policy.Mainclass,
                SubClass     = policy.Subclass,
                IsUnderAge   = Age < underAgeLimit ? true : false
            };

            var excessResponse = _motorInsuranceRepository.GetExcessCalcualtion(excessRequest);

            if (excessResponse.IsTransactionDone)
            {
                excessAmount = excessResponse.ExcessAmount;
                return(excessAmount);
            }
            return(excessAmount);
        }