public int GetConvertedSTP(SoilTest soilTest) { int convertedP = 0; try { //get soil test method selected by user FarmDetails fd = _ud.FarmDetails(); if (fd.testingMethod == null) { fd.testingMethod = _sd.GetDefaultSoilTestMethod(); } SoilTestMethod soilTestMethod = _sd.GetSoilTestMethodById(fd.testingMethod); if (soilTest.valPH >= 7.2M) //ph of 7.2 is a constant boundary { convertedP = Convert.ToInt16(Decimal.Multiply(soilTestMethod.ConvertToKelownaPge72, soilTest.ValP)); } else { convertedP = Convert.ToInt16(Decimal.Multiply(soilTestMethod.ConvertToKelownaPlt72, soilTest.ValP)); } } catch (Exception ex) { // display error throw; } return(convertedP); }