Beispiel #1
0
 public RR.HomeEndorsementQuoteResponse GetQuote(RR.HomeEndorsementQuote homeEndorsementQuote)
 {
     try
     {
         BLO.HomeEndorsementQuote         details = _mapper.Map <RR.HomeEndorsementQuote, BLO.HomeEndorsementQuote>(homeEndorsementQuote);
         BLO.HomeEndorsementQuoteResponse result  = _homeEndorsementRepository.GetHomeEndorsementQuote(details);
         return(_mapper.Map <BLO.HomeEndorsementQuoteResponse, RR.HomeEndorsementQuoteResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.HomeEndorsementQuoteResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Beispiel #2
0
        public void CalculateEndorsementQuote(bool showPremium)
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var homeEndorementQuote = new BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuote
            {
                Agency            = userInfo.Agency,
                AgentCode         = userInfo.AgentCode,
                MainClass         = MainClass,
                SubClass          = SubClass,
                EffectiveFromDate = txtEffectiveFromDate.Text.CovertToCustomDateTime(),
                EffectiveToDate   = txtEffectiveToDate.Text.CovertToCustomDateTime(),
                PaidPremium       = string.IsNullOrEmpty(paidPremium.Value) ? decimal.Zero : Convert.ToDecimal(paidPremium.Value),
                EndorsementType   = "ChangeAddress",
                CancelationDate   = DateTime.Now
            };

            //Calculate the home endorsement premium.
            var homeEndoQuoteResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                        <BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuoteResponse>,
                                                        BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuote>
                                          (BKIC.SellingPoint.DTO.Constants.HomeEndorsementURI.GetHomeEndorsementQuote, homeEndorementQuote);

            if (homeEndoQuoteResult.StatusCode == 200 && homeEndoQuoteResult.Result.IsTransactionDone)
            {
                var endoresementPremium = homeEndoQuoteResult.Result.EndorsementPremium;
                calculatedPremium.Value = endoresementPremium.ToString();


                var  product           = master.GetHomeProduct(MainClass, SubClass);
                bool includeCommission = false;
                if (product != null)
                {
                    var hEndorsement = product.HomeEndorsementMaster.Find(c => c.EndorsementType == "ChangeAddress");
                    if (hEndorsement != null)
                    {
                        includeCommission = hEndorsement.HasCommission;
                    }
                }

                var commisionRequest = new BKIC.SellingPoint.DTO.RequestResponseWrappers.CommissionRequest();
                commisionRequest.AgentCode     = userInfo.AgentCode;
                commisionRequest.Agency        = userInfo.Agency;
                commisionRequest.SubClass      = string.IsNullOrEmpty(subClass.Value) ? "SH" : subClass.Value;
                commisionRequest.PremiumAmount = includeCommission ? endoresementPremium : decimal.Zero;

                //Get commision for the endorsement premium.
                var commissionresult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                         <BKIC.SellingPoint.DTO.RequestResponseWrappers.CommissionResponse>,
                                                         BKIC.SellingPoint.DTO.RequestResponseWrappers.CommissionRequest>("api/insurance/Commission", commisionRequest);

                if (commissionresult.StatusCode == 200 && commissionresult.Result.IsTransactionDone && commissionresult.Result.CommissionAmount > 0)
                {
                    //commission.Text = Convert.ToString(commissionresult.Result.CommissionAmount);
                    calculatedCommision.Value = Convert.ToString(commissionresult.Result.CommissionAmount);
                    //ShowPremium(userInfo, endoresementPremium, commissionresult.Result.CommissionAmount);
                }
            }
        }
        public void CalculateEndorsementQuote(bool showPremium)
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var homeEndorementQuote = new BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuote();

            homeEndorementQuote.Agency             = userInfo.Agency;
            homeEndorementQuote.AgentCode          = userInfo.AgentCode;
            homeEndorementQuote.MainClass          = MainClass;
            homeEndorementQuote.SubClass           = SubClass;
            homeEndorementQuote.EffectiveFromDate  = txtEffectiveFromDate.Text.CovertToCustomDateTime();
            homeEndorementQuote.EffectiveToDate    = expireDate.Value.CovertToCustomDateTime();
            homeEndorementQuote.PaidPremium        = string.IsNullOrEmpty(paidPremium.Value) ? decimal.Zero : Convert.ToDecimal(paidPremium.Value);
            homeEndorementQuote.EndorsementType    = "CancelPolicy";
            homeEndorementQuote.CancelationDate    = txtEffectiveToDate.Text.CovertToCustomDateTime();//expireDate.Value.CovertToCustomDateTime();
            homeEndorementQuote.RefundType         = ddlRefundType.SelectedItem.Text.Trim();
            homeEndorementQuote.DocumentNumber     = ddlHomePolicies.SelectedItem.Text.Trim();
            homeEndorementQuote.BuildingSumInsured = BuildingSumInsured;
            homeEndorementQuote.ContentSumInsured  = ContentSumInsured;
            homeEndorementQuote.NoOfDomesticHelp   = NoOfDomesticHelp;
            homeEndorementQuote.jewelleryCoverType = JewelleryCover;

            //Calculate the home endorsement premium.
            var homeEndoQuoteResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                        <BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuoteResponse>,
                                                        BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeEndorsementQuote>
                                          (BKIC.SellingPoint.DTO.Constants.HomeEndorsementURI.GetHomeEndorsementQuote,
                                          homeEndorementQuote);

            if (homeEndoQuoteResult.StatusCode == 200 && homeEndoQuoteResult.Result.IsTransactionDone)
            {
                var refundPremium = Math.Abs(homeEndoQuoteResult.Result.EndorsementPremium);
                calculatedPremium.Value    = Convert.ToString(refundPremium * -1);
                adjustedPremium.Value      = Convert.ToString(refundPremium * -1);
                calculatedCommission.Value = Convert.ToString(homeEndoQuoteResult.Result.Commission * -1);
                adjustedCommission.Value   = Convert.ToString(homeEndoQuoteResult.Result.Commission * -1);
                ShowPremium(userInfo, refundPremium * -1, homeEndoQuoteResult.Result.Commission * -1);


                decimal TotalPremium    = (homeEndoQuoteResult.Result.EndorsementPremium + homeEndoQuoteResult.Result.RefundVat) * -1;
                decimal TotalCommission = (homeEndoQuoteResult.Result.Commission + 0) * -1;
                ShowVAT(userInfo, homeEndoQuoteResult.Result.RefundVat * -1, 0, TotalPremium, TotalCommission);
            }
            else
            {
                master.ShowLoading = false;
                master.ShowErrorPopup(homeEndoQuoteResult.Result.TransactionErrorMessage, "Request Failed !");
                return;
            }

            //Calculate VAT.
            //var vatResponse = master.GetVat(homeEndoQuoteResult.Result.EndorsementPremium,
            //                    homeEndoQuoteResult.Result.Commission);

            //if (vatResponse != null && vatResponse.IsTransactionDone)
            //{
            //    decimal TotalPremium = homeEndoQuoteResult.Result.EndorsementPremium + vatResponse.VatAmount;
            //    decimal TotalCommission = homeEndoQuoteResult.Result.Commission + vatResponse.VatCommissionAmount;
            //    ShowVAT(userInfo, vatResponse.VatAmount, vatResponse.VatCommissionAmount, TotalPremium, TotalCommission);
            //}
            btnSubmit.Visible = true;
        }