public InsuranceQuoteResponseMessage GetQuoteUsingMessageContract(InsuranceQuoteRequestMessage requestMessage) { //InsuredInfo objInsuredInfo; //= new InsuredInfo(); InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); //objInsuredInfo = requestMessage.InsuredInformation; ////Validate the Insured information sent with request message //FaultInfo objFaultInfo = ValidateInsuredInfo(objInsuredInfo); //if (objFaultInfo == null) //{ // //Calculate insurance quote based on received info // objQuoteInfo = CalculateQuote(objInsuredInfo); //} //else //{ // //throw new FaultException<FaultInfo>(objFaultInfo); //} //Finally return the Quote InsuranceQuoteResponseMessage responseMessage = new InsuranceQuoteResponseMessage(); responseMessage.QuoteInformation = objQuoteInfo; return(responseMessage); }
public InsuranceQuoteResponseMessage GetQuoteUsingMessageContract(InsuranceQuoteRequestMessage requestMessage) { //InsuredInfo objInsuredInfo; //= new InsuredInfo(); InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); //objInsuredInfo = requestMessage.InsuredInformation; ////Validate the Insured information sent with request message //FaultInfo objFaultInfo = ValidateInsuredInfo(objInsuredInfo); //if (objFaultInfo == null) //{ // //Calculate insurance quote based on received info // objQuoteInfo = CalculateQuote(objInsuredInfo); //} //else //{ // //throw new FaultException<FaultInfo>(objFaultInfo); //} //Finally return the Quote InsuranceQuoteResponseMessage responseMessage = new InsuranceQuoteResponseMessage(); responseMessage.QuoteInformation = objQuoteInfo; return responseMessage; }
private InsuranceQuoteInfo CalculateQuote(InsuredInfo objInsuredInfo) { const double QUOTE_BASE_AMOUNT = 78; InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); double dblAgeAmount = 0; double dblCarAmount = 0; double dblMonthlyTotal = 0; //Parse strings to ints int intInsuredAge = int.Parse(objInsuredInfo.Age); int intVehicleYearBuilt = int.Parse(objInsuredInfo.VehicleYearBuilt); //Determine the Age Amount if ((intInsuredAge >= 16) && (intInsuredAge <= 25)) { dblAgeAmount = 50; } else if ((intInsuredAge >= 26) && (intInsuredAge <= 65)) { dblAgeAmount = 40; } else if (intInsuredAge > 65) { dblAgeAmount = 55; } //Determine the Car Amount if (intVehicleYearBuilt <= 1995) { dblCarAmount = 75; } else if ((intVehicleYearBuilt >= 1996) && (intVehicleYearBuilt <= 2005)) { dblCarAmount = 85; } else if ((intVehicleYearBuilt >= 2006) && (intVehicleYearBuilt <= 2010)) { dblCarAmount = 55; } //Calculate the monthly Quote Amount dblMonthlyTotal = QUOTE_BASE_AMOUNT + dblAgeAmount + dblCarAmount; //Assign values and return Quote objQuoteInfo.BaseAmount = QUOTE_BASE_AMOUNT; objQuoteInfo.AgeAmount = dblAgeAmount; objQuoteInfo.CarAmount = dblCarAmount; objQuoteInfo.MontlyTotal = dblMonthlyTotal; return objQuoteInfo; }
private InsuranceQuoteInfo CalculateQuote(InsuredInfo objInsuredInfo) { const double QUOTE_BASE_AMOUNT = 78; InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); double dblAgeAmount = 0; double dblCarAmount = 0; double dblMonthlyTotal = 0; //Parse strings to ints int intInsuredAge = int.Parse(objInsuredInfo.Age); int intVehicleYearBuilt = int.Parse(objInsuredInfo.VehicleYearBuilt); //Determine the Age Amount if ((intInsuredAge >= 16) && (intInsuredAge <= 25)) { dblAgeAmount = 50; } else if ((intInsuredAge >= 26) && (intInsuredAge <= 65)) { dblAgeAmount = 40; } else if (intInsuredAge > 65) { dblAgeAmount = 55; } //Determine the Car Amount if (intVehicleYearBuilt <= 1995) { dblCarAmount = 75; } else if ((intVehicleYearBuilt >= 1996) && (intVehicleYearBuilt <= 2005)) { dblCarAmount = 85; } else if ((intVehicleYearBuilt >= 2006) && (intVehicleYearBuilt <= 2010)) { dblCarAmount = 55; } //Calculate the monthly Quote Amount dblMonthlyTotal = QUOTE_BASE_AMOUNT + dblAgeAmount + dblCarAmount; //Assign values and return Quote objQuoteInfo.BaseAmount = QUOTE_BASE_AMOUNT; objQuoteInfo.AgeAmount = dblAgeAmount; objQuoteInfo.CarAmount = dblCarAmount; objQuoteInfo.MontlyTotal = dblMonthlyTotal; return(objQuoteInfo); }
public InsuranceQuoteInfo GetQuote(InsuredInfo insuredInformation) { InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); //Validate the Insured information sent with request message FaultInfo objFaultInfo = ValidateInsuredInfo(insuredInformation); if (objFaultInfo == null) { //Calculate insurance quote based on received info objQuoteInfo = CalculateQuote(insuredInformation); return objQuoteInfo; } else { throw new FaultException<FaultInfo>(objFaultInfo, objFaultInfo.Reason); } }
public InsuranceQuoteInfo GetQuote(InsuredInfo insuredInformation) { InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); //Validate the Insured information sent with request message FaultInfo objFaultInfo = ValidateInsuredInfo(insuredInformation); if (objFaultInfo == null) { //Calculate insurance quote based on received info objQuoteInfo = CalculateQuote(insuredInformation); return(objQuoteInfo); } else { throw new FaultException <FaultInfo>(objFaultInfo, objFaultInfo.Reason); } }
public InsuranceQuoteInfo GetQuote(InsuredInfo insuredInformation) { InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); ////Validate the Insured information sent with request message //FaultInfo objFaultInfo = ValidateInsuredInfo(insuredInformation); //if (objFaultInfo == null) //{ // //Calculate insurance quote based on received info // objQuoteInfo = CalculateQuote(insuredInformation); //} //else //{ // throw new FaultException<FaultInfo>(objFaultInfo); //} return objQuoteInfo; }
public InsuranceQuoteInfo GetQuote(InsuredInfo insuredInformation) { InsuranceQuoteInfo objQuoteInfo = new InsuranceQuoteInfo(); ////Validate the Insured information sent with request message //FaultInfo objFaultInfo = ValidateInsuredInfo(insuredInformation); //if (objFaultInfo == null) //{ // //Calculate insurance quote based on received info // objQuoteInfo = CalculateQuote(insuredInformation); //} //else //{ // throw new FaultException<FaultInfo>(objFaultInfo); //} return(objQuoteInfo); }