public RR.TravelInsuranceQuoteResponse GetQuote(RR.TravelInsuranceQuote quote)
 {
     try
     {
         BLO.TravelInsuranceQuote         req    = _mapper.Map <RR.TravelInsuranceQuote, BLO.TravelInsuranceQuote>(quote);
         BLO.TravelInsuranceQuoteResponse result = _travelInsuranceRep.GetTravelInsuranceQuote(req);
         return(_mapper.Map <BLO.TravelInsuranceQuoteResponse, RR.TravelInsuranceQuoteResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.TravelInsuranceQuoteResponse
         {
             IsTransactionDone = true,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Esempio n. 2
0
        protected void Calculate_Travel(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    master.IsSessionAvailable();
                    var userInfo = CommonMethods.GetUserDetails();
                    var service  = CommonMethods.GetLogedInService();

                    if (ddlPackage.SelectedItem.Value == "" || ddlPeriod.SelectedItem.Value == "")
                    {
                        return;
                    }
                    if (21 > master.CalculateAgeCorrect(txtTravelDOB.Text.CovertToCustomDateTime(), DateTime.Now) &&
                        userInfo.Agency == "BBK")
                    {
                        master.ShowErrorPopup("Insured age should be above 21 years !!", "Insured");
                        return;
                    }
                    if (!ValidateAge(txtTravelDOB.Text.CovertToCustomDateTime()))
                    {
                        return;
                    }

                    var travelQuote = new BKIC.SellingPoint.DTO.RequestResponseWrappers.TravelInsuranceQuote
                    {
                        //Get travel quote for the given values.
                        Agency      = userInfo.Agency,
                        AgentCode   = userInfo.AgentCode,
                        MainClass   = "MISC",
                        SubClass    = ddlPackage.SelectedItem.Text.ToLower() == "individual" ? "STI" : ddlPackage.SelectedItem.Text.ToLower() == "schengen" ? "STI" : "STP",
                        DateOfBirth = txtTravelDOB.Text.CovertToCustomDateTime(),

                        PackageCode = ddlPackage.SelectedItem.Text.ToLower() == "individual" ?
                                      "IN001" : ddlPackage.SelectedItem.Text.ToLower() == "schengen" ?
                                      "SCHEN" : "FM001",

                        PolicyPeriodCode = ddlPeriod.SelectedItem.Value,

                        CoverageType = ddlPackage.SelectedItem.Text.ToLower() == "schengen" ?
                                       "SCHENGEN" : ddlJourney.SelectedItem.Value
                    };


                    var travelQuoteResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                              <BKIC.SellingPoint.DTO.RequestResponseWrappers.TravelInsuranceQuoteResponse>,
                                                              BKIC.SellingPoint.DTO.RequestResponseWrappers.TravelInsuranceQuote>
                                                (BKIC.SellingPoint.DTO.Constants.TravelInsuranceURI.GetQuote, travelQuote);

                    if (travelQuoteResult.StatusCode == 200 && travelQuoteResult.Result.IsTransactionDone)
                    {
                        txtTravelPremium.Text = travelQuoteResult.Result.Premium.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }