protected void Calculate_Home(object sender, EventArgs e) { try { master.IsSessionAvailable(); var userInfo = CommonMethods.GetUserDetails(); var service = CommonMethods.GetLogedInService(); var homeQuote = new BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeInsuranceQuote { BuildingValue = !string.IsNullOrEmpty(txtBuildingValue.Text.Trim()) ? Convert.ToDecimal(txtBuildingValue.Text.Trim()) : 0, ContentValue = !string.IsNullOrEmpty(txtContentValue.Text.Trim()) ? Convert.ToDecimal(txtContentValue.Text.Trim()) : 0, JewelleryValue = !string.IsNullOrEmpty(txtJewelleryValue.Text.Trim()) ? Convert.ToDecimal(txtJewelleryValue.Text.Trim()) : 0, // homeQuote.IsPropertyToBeInsured = ddlPropertyInsured.SelectedIndex > 0 ? (ddlPropertyInsured.SelectedIndex == 1 ? true : false) : false; IsRiotStrikeAdded = ddlMaliciousDamageCover.SelectedIndex > 0 ? (ddlMaliciousDamageCover.SelectedIndex == 1 ? true : false) : false, JewelleryCover = ddlJewelleryCoverWithinContents.SelectedItem.Value, NumberOfDomesticWorker = Convert.ToInt32(txtDomesticHelpWorkers.Text), Agency = userInfo.Agency, AgentCode = userInfo.AgentCode, MainClass = HomeMainClass, SubClass = userInfo.Agency == "BBK" ? "SH" : "TSHO" }; var homeQuoteResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper <BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeInsuranceQuoteResponse>, BKIC.SellingPoint.DTO.RequestResponseWrappers.HomeInsuranceQuote> (BKIC.SellingPoint.DTO.Constants.HomeURI.GetQuote, homeQuote); if (homeQuoteResult.StatusCode == 200 && homeQuoteResult.Result.IsTransactionDone) { txtHomePremium.Text = Convert.ToString(homeQuoteResult.Result.TotalPremium); var vatResponse = master.GetVat(Convert.ToDecimal(txtHomePremium.Text), 0); if (vatResponse != null && vatResponse.IsTransactionDone) { txtHomeVat.Text = Convert.ToString(vatResponse.VatAmount); txtHomeTotal.Text = Convert.ToString(Convert.ToDecimal(txtHomePremium.Text) + Convert.ToDecimal(vatResponse.VatAmount)); } } } catch (Exception ex) { //throw ex; } finally { master.ShowLoading = false; } }
public RR.HomeInsuranceQuoteResponse GetQuote(RR.HomeInsuranceQuote homeQuote) { try { BLO.HomeInsuranceQuote homeInsuranceQuote = _mapper.Map <RR.HomeInsuranceQuote, BLO.HomeInsuranceQuote>(homeQuote); BLO.HomeInsuranceQuoteResponse res = _homeInsuranceRepository.GetHomeInsuranceQuote(homeInsuranceQuote); return(_mapper.Map <BLO.HomeInsuranceQuoteResponse, RR.HomeInsuranceQuoteResponse>(res)); } catch (Exception ex) { return(new RR.HomeInsuranceQuoteResponse { IsTransactionDone = false, TransactionErrorMessage = ex.Message }); } }