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); }
/// <summary> /// Insert the motor endorsement type of cancel. /// </summary> /// <param name="motorEndorsement">Motor endorsement request</param> /// <returns>Motorendorsementid, Motorendorsementnumber.</returns> public MotorEndorsementResult PostAdminMotorEndorsement(BO.MotorEndorsement motorEndorsement) { MotorEndorsementResult result = InsertAdminMotorEndorsement(motorEndorsement); if (result.IsTransactionDone) { var req = new BO.MotorProductRequest { Type = "fetch", Agency = motorEndorsement.Agency, AgentCode = motorEndorsement.AgencyCode, MainClass = motorEndorsement.Mainclass, SubClass = motorEndorsement.Subclass, }; BO.MotorProductMasterResponse productRes = _adminRepository.GetMotorProduct(req); BO.MotorProductMaster product = productRes.motorProductMaster[0]; if (productRes != null && productRes.IsTransactionDone && productRes.motorProductMaster.Count > 0) { var endorsementType = product.MotorEndorsementMaster .Find(c => c.EndorsementType == motorEndorsement.EndorsementType); if (endorsementType != null && endorsementType.HasCommission && motorEndorsement.PremiumBeforeDiscount > endorsementType.ChargeAmount) { CalculateCommission(product, motorEndorsement, motorEndorsement.MotorID, result.DocumentNo, result.LinkID, motorEndorsement.RenewalCount, result.EndorsementCount, result.EndorsementNo, result.MotorEndorsementID); } } } return(result); }
public decimal GetRenewalDelayedDaysAmount(BO.MotorInsurancePolicy policy, BO.MotorProductMaster product, decimal netPremium) { decimal delayedDaysAmount = 0; if (policy.RenewalDelayedDays > 0) { delayedDaysAmount = (netPremium * policy.RenewalDelayedDays) / 365; } return(delayedDaysAmount); }
public decimal GetAgeLoading(decimal AgeLoadingPercent, decimal BasePremium, BO.MotorProductMaster product) { decimal ageLoading = decimal.Zero; if (product.HasAgeLoading && Age < product.UnderAge) { ageLoading = BasePremium * AgeLoadingPercent / 100; if (product.Agency == "TISCO") { ProductMinimumPremium = product.UnderAgeminPremium; } } return(ageLoading); }
public decimal GetClaimLoading(decimal ClaimAmount, decimal BasePremium, BO.MotorProductMaster product) { decimal claimLoading = decimal.Zero; if (product.MotorClaim != null && product.MotorClaim.Count > 0 && ClaimAmount > 0) { var claimRow = product.MotorClaim.Find(x => x.AmountFrom <= ClaimAmount && x.AmountTo >= ClaimAmount); if (claimRow != null) { ClaimLoadPercent = claimRow.Percentage; claimLoading = BasePremium * claimRow.Percentage / 100; } } return(claimLoading); }
/// <summary> /// Insert the motor endorsement. /// </summary> /// <param name="motorEndorsement">Motor endorsement details.</param> /// <returns>Motorendorsementid, Motorendorsementnumber.</returns> public MotorEndorsementResult PostMotorEndorsement(BO.MotorEndorsement motorEndorsement) { try { var req = new BO.MotorProductRequest { Type = "fetch", Agency = motorEndorsement.Agency, AgentCode = motorEndorsement.AgencyCode, MainClass = motorEndorsement.Mainclass, SubClass = motorEndorsement.Subclass, }; BO.MotorProductMasterResponse productRes = _adminRepository.GetMotorProduct(req); BO.MotorProductMaster product = productRes.motorProductMaster[0]; MotorEndorsementResult result = InsertMotorEndorsement(motorEndorsement); if (result.IsTransactionDone) { if (productRes != null && productRes.IsTransactionDone && productRes.motorProductMaster.Count > 0) { var endorsementType = product.MotorEndorsementMaster .Find(c => c.EndorsementType == motorEndorsement.EndorsementType); if (endorsementType != null && endorsementType.HasCommission && motorEndorsement.PremiumBeforeDiscount > endorsementType.ChargeAmount) { CalculateCommission(product, motorEndorsement, motorEndorsement.MotorID, result.DocumentNo, result.LinkID, motorEndorsement.RenewalCount, result.EndorsementCount, result.EndorsementNo, result.MotorEndorsementID); } } } return(result); } catch (Exception ex) { _mail.SendMailLogError(ex.Message, motorEndorsement.InsuredCode, "MotorEndorsement", motorEndorsement.Agency, false); return(new MotorEndorsementResult() { IsTransactionDone = false, TransactionErrorMessage = ex.Message }); } }
public decimal GetAdditionalDays(BO.MotorInsurancePolicy policy, BO.MotorProductMaster product, decimal netPremium) { decimal additionalDaysAmount = 0; if (product.HasAdditionalDays) { if (policy.Agency == "BBK") { var actualExpireDate = policy.PolicyCommencementDate.AddYears(1).AddDays(-1); decimal additionalDays = Convert.ToDecimal((policy.PolicyEndDate - actualExpireDate).TotalDays); if (additionalDays > 0) { additionalDaysAmount = netPremium * additionalDays / 365; } } else { DateTime actualExpireDate = DateTime.Now; if (policy.vehicleTypeCode == "Used" || string.IsNullOrEmpty(policy.vehicleTypeCode)) { actualExpireDate = policy.PolicyCommencementDate.AddYears(1).AddDays(-1); } else { actualExpireDate = policy.PolicyCommencementDate.AddMonths(13).AddDays(-1); } decimal additionalDays = Convert.ToDecimal((policy.PolicyEndDate - actualExpireDate).TotalDays); if (additionalDays > 0) { additionalDaysAmount = netPremium * additionalDays / 365; } } } return(additionalDaysAmount); }
public void SetHIR(BO.MotorProductMaster product, BO.MotorInsurancePolicy policy) { bool isAdded = false; if (product.MaximumVehicleAge < DateTime.Now.Year - policy.YearOfMake) { IsHIR = true; HIRReason = "Vehicle year exceed the limit"; HIRStatus = 1; isAdded = true; } if (product.MaximumVehicleValue < policy.VehicleValue) { IsHIR = true; HIRReason = isAdded ? ", " + "Vehicle value exceeds the limit" : "Vehicle value exceeds the limit"; HIRStatus = 1; isAdded = true; } if (product.UnderAgeToHIR && Age < product.UnderAge) { IsHIR = true; HIRReason = isAdded ? ", " + "Insured under age" : "Insured under age"; HIRStatus = 1; isAdded = true; } if (policy.ClaimAmount > 0 && product.MotorClaim != null && product.MotorClaim.Count > 0) { if (policy.ClaimAmount > product.MotorClaim[0].MaximumClaimAmount) { IsHIR = true; HIRReason = isAdded ? ", " + "Claim amount exceed" : "Claim amount exceed"; HIRStatus = 1; isAdded = true; } } }
public BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse InsertMotor(BO.MotorInsurancePolicy policy) { try { var req = new BO.MotorProductRequest { Type = "fetch", Agency = policy.Agency, AgentCode = policy.AgencyCode, MainClass = policy.Mainclass, SubClass = policy.Subclass, }; BO.MotorProductMasterResponse productRes = _adminRepository.GetMotorProduct(req); if (productRes != null && productRes.IsTransactionDone && productRes.motorProductMaster.Count > 0) { BO.MotorProductMaster product = productRes.motorProductMaster[0]; if (product != null) { Calculate(policy, product); var policyRecord = InsertMotorMain(policy, policy.IsRenewal ? MotorInsuranceSP.MotorRenewalInsert : MotorInsuranceSP.MotorInsert); if (policyRecord != null && policyRecord.IsInserted) { CalculateCommission(product, policy, policyRecord.NewMotorID, policyRecord.DocumentNumber, policyRecord.LinkID, policyRecord.RenewalCount); if (!IsHIR && policy.IsActivePolicy) { try { new Task(() => { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@MotorID", policyRecord.NewMotorID) }; SellingPointSQL.eds("MIG_IntegrateMotorDetails", para); }).Start(); } catch (AggregateException ex) { foreach (Exception inner in ex.InnerExceptions) { _mail.SendMailLogError(inner.Message, policy.InsuredCode, "MotorInsurance", policy.Agency, true); } } } return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse() { IsTransactionDone = true, IsHIR = IsHIR, MotorID = policyRecord.NewMotorID, DocumentNo = policyRecord.DocumentNumber, RenewalCount = policyRecord.RenewalCount }); } } return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse() { IsTransactionDone = false, TransactionErrorMessage = "Product not found" }); } return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse() { IsTransactionDone = false, TransactionErrorMessage = "Product not found" }); } catch (Exception ex) { _mail.SendMailLogError(ex.Message, policy.InsuredCode, "MotorInsurance", policy.Agency, false); return(new MotorInsurancePolicyResponse() { IsTransactionDone = false, TransactionErrorMessage = ex.ToString() }); } }