protected void RadBtnQualifyClient_Click(object sender, EventArgs e) { WS.AllLifePrincingClient WS = new WS.AllLifePrincingClient(); DataTable ReturnDT; string strSubscriberName = string.Empty; string strSubscriberPassword = string.Empty; string strSubscriberCode = string.Empty; SqlConnection sqlConnectionX; SqlCommand sqlCommandX; SqlParameter sqlParam; SqlDataReader sqlDR; try { hideOption1Life(); hideOption1Disability(); hideOption2Life(); hideOption2Disability(); hideOption3Life(); hideOption3Disability(); hideOption4Life(); hideOption4Disability(); hideOption5Life(); hideOption5Disability(); lblRequalify.Text = ""; sqlConnectionX = new SqlConnection(ConfigurationManager.AppSettings["SQLConnection"]); sqlConnectionX.Open(); #region "Get SubscriberName" strSubscriberName = GetSetting("SubscriberName"); //sqlCommandX = new SqlCommand(); //sqlCommandX.Connection = sqlConnectionX; //sqlCommandX.CommandType = CommandType.StoredProcedure; //sqlCommandX.CommandText = "spx_SELECT_Setting"; //sqlParam = new SqlParameter("SettingName", "SubscriberName"); //sqlCommandX.Parameters.Add(sqlParam); //sqlDR = sqlCommandX.ExecuteReader(); //while (sqlDR.Read()) //{ // strSubscriberName = sqlDR.GetValue(0).ToString(); //} //sqlDR.Close(); //sqlCommandX.Cancel(); //sqlCommandX.Dispose(); #endregion #region "Get SubscriberPassword" strSubscriberPassword = GetSetting("SubscriberPassword"); //sqlCommandX = new SqlCommand(); //sqlCommandX.Connection = sqlConnectionX; //sqlCommandX.CommandType = CommandType.StoredProcedure; //sqlCommandX.CommandText = "spx_SELECT_Setting"; //sqlParam = new SqlParameter("SettingName", "SubscriberPassword"); //sqlCommandX.Parameters.Add(sqlParam); //sqlDR = sqlCommandX.ExecuteReader(); //while (sqlDR.Read()) //{ // strSubscriberPassword = sqlDR.GetValue(0).ToString(); //} //sqlDR.Close(); //sqlCommandX.Cancel(); //sqlCommandX.Dispose(); #endregion #region "Get SubscriberCode" strSubscriberCode = GetSetting("SubscriberCode"); //sqlCommandX = new SqlCommand(); //sqlCommandX.Connection = sqlConnectionX; //sqlCommandX.CommandType = CommandType.StoredProcedure; //sqlCommandX.CommandText = "spx_SELECT_Setting"; //sqlParam = new SqlParameter("SettingName", "SubscriberCode"); //sqlCommandX.Parameters.Add(sqlParam); //sqlDR = sqlCommandX.ExecuteReader(); //while (sqlDR.Read()) //{ // strSubscriberCode = sqlDR.GetValue(0).ToString(); //} //sqlDR.Close(); //sqlCommandX.Cancel(); //sqlCommandX.Dispose(); #endregion bool blnTobaccoUse; int intHbA1c = 0; int intAlcoholUnitsPerDay = 0; string strEmployment = string.Empty; string strQualification = string.Empty; string strSpouseQualification = string.Empty; string strResultLife = string.Empty; string strResultDisability = string.Empty; int intClass = 0; int intMarriedTypeID = 0; string strTobaccoSelection = RadioButtonListTobacco.SelectedValue; if (strTobaccoSelection == "non-smoker") blnTobaccoUse = false; else blnTobaccoUse = true; //if (RadioButtonListTobacco.Checked == true) // blnTobaccoUse = true; //else // blnTobaccoUse = false; string strAcoholSelection = RadioButtonListAlcohol.SelectedValue; if (strAcoholSelection == "non-drinker") intAlcoholUnitsPerDay = 0; if (strAcoholSelection == "0 - 5") intAlcoholUnitsPerDay = 5; if (strAcoholSelection == "> 5") intAlcoholUnitsPerDay = 6; #region "HbA1c" if (RadioButtonHbA1c3.Checked == true) intHbA1c = 4; if (RadioButtonHbA1c4.Checked == true) intHbA1c = 4; if (RadioButtonHbA1c6.Checked == true) intHbA1c = 6; if (RadioButtonHbA1c7.Checked == true) intHbA1c = 7; if (RadioButtonHbA1c8.Checked == true) intHbA1c = 8; if (RadioButtonHbA1c9.Checked == true) intHbA1c = 9; if (RadioButtonHbA1c10.Checked == true) intHbA1c = 10; if (RadioButtonHbA1c11.Checked == true) intHbA1c = 11; if (RadioButtonHbA1c12.Checked == true) intHbA1c = 12; if (RadioButtonHbA1c15.Checked == true) intHbA1c = 15; #endregion #region "Married" if (RadioButtonMaritalStatusNotMarried.Checked == true) { intMarriedTypeID = 0; } if (RadioButtonMaritalStatusMarried.Checked == true) { intMarriedTypeID = 1; } #endregion if (RadioButtonEsc6.Checked == true) HiddenFieldEscalationLife.Value = "6.00"; if (RadioButtonEsc10.Checked == true) HiddenFieldEscalationLife.Value = "10.00"; //if (RadioButtonEscLife6.Checked == true) // HiddenFieldEscalationLife.Value = "6.00"; //if (RadioButtonEscLife10.Checked == true) // HiddenFieldEscalationLife.Value = "10.00"; //if (RadioButtonEscalationDis6.Checked == true) // HiddenFieldEscalationDisablility.Value = "6.00"; //if (RadioButtonEscalationDis10.Checked == true) // HiddenFieldEscalationDisablility.Value = "10.00"; strEmployment = RadComboBoxOccupation.SelectedItem.Text.ToString().Trim(); #region "QualifyLife" ReturnDT = WS.QualifyLife(strSubscriberName, strSubscriberPassword, strSubscriberCode, RadTxtAgeOfNextBirthday.Text.Trim(), blnTobaccoUse.ToString(), intHbA1c.ToString(), RadNumericTxtBMI.Text.ToString().Trim(), RadNumericTxtPantSize.Text.Trim(), intAlcoholUnitsPerDay.ToString(), strEmployment); foreach (DataRow row in ReturnDT.Rows) { strResultLife = row["Result"].ToString(); } if (strResultLife == "Successful") { LblQualificationMessage.Text = "ok"; PanelLife.GroupingText = "Life"; //PanelLife.Enabled = true; RadioButtonEscLife6.Enabled = true; RadioButtonEscLife10.Enabled = true; RadNumericTxtCoverLife.Enabled = true; RadNumericTxtPremiumLife.Enabled = true; RadNumericTxtEMLoadingLife.Enabled = true; RadioButtonQuoteLifeYes.Checked = true; //RadioButtonEscLife6.Checked = true; RadioButtonEsc6.Checked = true; } else { LblQualificationMessage.Text = strResultLife; PanelLife.GroupingText = "Life - Unavailable"; if (RadComboBoxTypeBenefitLife.SelectedItem.Text == "FDB") { //PanelLife.Enabled = false; RadioButtonEscLife6.Enabled = false; RadioButtonEscLife10.Enabled = false; RadNumericTxtCoverLife.Enabled = false; RadNumericTxtPremiumLife.Enabled = false; RadNumericTxtEMLoadingLife.Enabled = false; hideOption1Life(); } else { RadioButtonEscLife6.Enabled = true; RadioButtonEscLife10.Enabled = true; RadNumericTxtCoverLife.Enabled = true; RadNumericTxtPremiumLife.Enabled = true; RadNumericTxtEMLoadingLife.Enabled = true; //RadioButtonQuoteLifeYes.Checked = true; //RadioButtonEscLife6.Checked = true; //RadioButtonEsc6.Checked = true; } } #endregion //Does the client qualify for the disability //********************************************************** #region "QualifyDisability" if (RadioButtonNotMat.Checked) strQualification = "No matric"; if (RadioButtonMatriculated.Checked) strQualification = "Matric"; if (RadioButtonDiploma.Checked) strQualification = "3 or 4 yr. Diploma/3 yr. Degree"; if (RadioButtonDegree.Checked) strQualification = "4 yr. Degree/professional qualification"; if (RadioButtonSNotMat.Checked) strSpouseQualification = "No matric"; if (RadioButtonSMat.Checked) strSpouseQualification = "Matric"; if (RadioButtonSDip.Checked) strSpouseQualification = "3 or 4 yr. Diploma/3 yr. Degree"; if (RadioButtonSDegree.Checked) strSpouseQualification = "4 yr. Degree/professional qualification"; strEmployment = RadComboBoxOccupation.SelectedItem.Text.ToString().Trim(); string strSpouseIncome = RadNumericTxtSpouseIncome.Text.Trim(); if (strSpouseIncome == "") strSpouseIncome = "0"; string strProduct = string.Empty; #region "Get Default Diabetes Product" sqlCommandX = new SqlCommand(); sqlCommandX.Connection = sqlConnectionX; sqlCommandX.CommandType = CommandType.StoredProcedure; sqlCommandX.CommandText = "spx_SELECT_Setting"; sqlParam = new SqlParameter("SettingName", "Default Diabetes Product"); sqlCommandX.Parameters.Add(sqlParam); sqlDR = sqlCommandX.ExecuteReader(); while (sqlDR.Read()) { strProduct = sqlDR.GetValue(0).ToString(); } sqlDR.Close(); sqlCommandX.Cancel(); sqlCommandX.Dispose(); #endregion //Get the risk band string strRiskModifier = GetRiskModifier(); ReturnDT = WS.returnRiskBand(strSubscriberName, strSubscriberPassword, strSubscriberCode, strProduct + "WL06", strRiskModifier, RadDatePickerQuoteDate.SelectedDate.ToString()); string strRiskBand = ReturnDT.Rows[0][0].ToString(); RadTxtRiskBand.Text = strRiskBand; ReturnDT = WS.QualifyDisability(strSubscriberName, strSubscriberPassword, strSubscriberCode, RadTxtAgeOfNextBirthday.Text.Trim(), blnTobaccoUse.ToString(), intHbA1c.ToString(), RadNumericTxtBMI.Text.ToString().Trim(), RadNumericTxtPantSize.Text.Trim(), intAlcoholUnitsPerDay.ToString(), strEmployment, strQualification, RadNumericTxtIncome.Text.Trim(), strSpouseIncome, strRiskBand); foreach (DataRow row in ReturnDT.Rows) { strResultDisability = row["Result"].ToString(); intClass = Convert.ToInt16(row["Class"].ToString()); } HiddenFieldClassOfLife.Value = intClass.ToString(); if (strResultDisability == "Successful") { lblDisabilityMessage.Text = "ok"; PanelDisability.GroupingText = "Disability"; //PanelDisability.Enabled = true; RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonEscalationDis6.Enabled = true; RadioButtonEscalationDis10.Enabled = true; RadioButtonQuoteDisYes.Enabled = true; RadioButtonQuoteDisNo.Enabled = true; RadNumericTxtCoverAmnDis.Enabled = true; RadNumericTxtPremiumDis.Enabled = true; RadNumericTxtEMLoadingDisability.Enabled = true; RadioButtonQuoteDisYes.Checked = true; ////RadioButtonEscalationDis6.Checked = true; ////if (intClass > 0) ////{ //// lblDisabilityMessage.Text += ", class:" + intClass.ToString(); ////} sqlCommandX = new SqlCommand(); sqlCommandX.Connection = sqlConnectionX; sqlCommandX.CommandType = CommandType.StoredProcedure; sqlCommandX.CommandText = "spx_Select_OccupationLimitsByOccupation"; sqlParam = new SqlParameter("Occupation", strEmployment); sqlCommandX.Parameters.Add(sqlParam); bool blnADW = false; bool blnOCC = false; sqlDR = sqlCommandX.ExecuteReader(); while (sqlDR.Read()) { if (sqlDR.GetBoolean(1) == true) //sql column 1 = ADW blnADW = true; if (sqlDR.GetBoolean(2) == true) //sql column 2 = OCC blnOCC = true; } sqlDR.Close(); sqlDR.Dispose(); if ((intClass >= 1) && (intClass < 4)) { if (blnOCC == true) { RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonTypeOfDisOCC.Checked = true; RadioButtonTypeOfDisADW.Enabled = true; RadTxtDisabilityType.Text = "OCC"; } else { if (blnADW == true) { RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonTypeOfDisOCC.Checked = false; RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisADW.Checked = true; RadTxtDisabilityType.Text = "ADW"; } else { strResultDisability = "Occupation does not allow disability"; lblDisabilityMessage.Text = strResultDisability; PanelDisability.GroupingText = "Disability - Unavailable"; //PanelDisability.Enabled = false; RadioButtonTypeOfDisADW.Enabled = false; RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonEscalationDis6.Enabled = false; RadioButtonEscalationDis10.Enabled = false; RadioButtonQuoteDisYes.Enabled = false; RadioButtonQuoteDisNo.Enabled = false; RadNumericTxtCoverAmnDis.Enabled = false; RadNumericTxtPremiumDis.Enabled = false; RadNumericTxtEMLoadingDisability.Enabled = false; hideOption1Disability(); } } } if (intClass > 3) { if (blnADW == true) { RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonTypeOfDisOCC.Checked = false; RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisADW.Checked = true; RadTxtDisabilityType.Text = "ADW"; } else { strResultDisability = "Occupation does not allow disability"; lblDisabilityMessage.Text = strResultDisability; PanelDisability.GroupingText = "Disability - Unavailable"; //PanelDisability.Enabled = false; RadioButtonTypeOfDisADW.Enabled = false; RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonEscalationDis6.Enabled = false; RadioButtonEscalationDis10.Enabled = false; RadioButtonQuoteDisYes.Enabled = false; RadioButtonQuoteDisNo.Enabled = false; RadNumericTxtCoverAmnDis.Enabled = false; RadNumericTxtPremiumDis.Enabled = false; RadNumericTxtEMLoadingDisability.Enabled = false; hideOption1Disability(); } } } else { if (RadComboBoxTypeBenefitDisability.SelectedItem.Text == "FDB") { lblDisabilityMessage.Text = strResultDisability; PanelDisability.GroupingText = "Disability - Unavailable"; if ((RadComboBoxTypeBenefitDisability.SelectedItem.Text == "FDB") && (RadComboBoxTypeBenefitLife.Items.Count() == 1)) { //PanelDisability.Enabled = false; RadioButtonTypeOfDisADW.Enabled = false; RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonEscalationDis6.Enabled = false; RadioButtonEscalationDis10.Enabled = false; RadioButtonQuoteDisYes.Enabled = false; RadioButtonQuoteDisNo.Enabled = false; RadNumericTxtCoverAmnDis.Enabled = false; RadNumericTxtPremiumDis.Enabled = false; RadNumericTxtEMLoadingDisability.Enabled = false; hideOption1Disability(); } else { RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonEscalationDis6.Enabled = true; RadioButtonEscalationDis10.Enabled = true; RadioButtonQuoteDisYes.Enabled = true; RadioButtonQuoteDisNo.Enabled = true; RadNumericTxtCoverAmnDis.Enabled = true; RadNumericTxtPremiumDis.Enabled = true; RadNumericTxtEMLoadingDisability.Enabled = true; } } else { RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonEscalationDis6.Enabled = true; RadioButtonEscalationDis10.Enabled = true; RadioButtonQuoteDisYes.Enabled = true; RadioButtonQuoteDisNo.Enabled = true; RadNumericTxtCoverAmnDis.Enabled = true; RadNumericTxtPremiumDis.Enabled = true; RadNumericTxtEMLoadingDisability.Enabled = true; //RadioButtonQuoteDisYes.Checked = true; //////RadioButtonEscalationDis6.Checked = true; //////if (intClass > 0) //////{ ////// lblDisabilityMessage.Text += ", class:" + intClass.ToString(); //////} sqlCommandX = new SqlCommand(); sqlCommandX.Connection = sqlConnectionX; sqlCommandX.CommandType = CommandType.StoredProcedure; sqlCommandX.CommandText = "spx_Select_OccupationLimitsByOccupation"; sqlParam = new SqlParameter("Occupation", strEmployment); sqlCommandX.Parameters.Add(sqlParam); bool blnADW = false; bool blnOCC = false; sqlDR = sqlCommandX.ExecuteReader(); while (sqlDR.Read()) { if (sqlDR.GetBoolean(1) == true) //sql column 1 = ADW blnADW = true; if (sqlDR.GetBoolean(2) == true) //sql column 2 = OCC blnOCC = true; } sqlDR.Close(); sqlDR.Dispose(); if ((intClass >= 1) && (intClass < 4)) { if (blnOCC == true) { RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonTypeOfDisOCC.Checked = true; RadioButtonTypeOfDisADW.Enabled = true; RadTxtDisabilityType.Text = "OCC"; } else { if (blnADW == true) { RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonTypeOfDisOCC.Checked = false; RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisADW.Checked = true; RadTxtDisabilityType.Text = "ADW"; } else { strResultDisability = "Occupation does not allow disability"; lblDisabilityMessage.Text = strResultDisability; PanelDisability.GroupingText = "Disability - Unavailable"; if ((RadComboBoxTypeBenefitDisability.SelectedItem.Text == "FDB") && (RadComboBoxTypeBenefitLife.Items.Count() == 1)) { //PanelDisability.Enabled = false; RadioButtonTypeOfDisADW.Enabled = false; RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonEscalationDis6.Enabled = false; RadioButtonEscalationDis10.Enabled = false; RadioButtonQuoteDisYes.Enabled = false; RadioButtonQuoteDisNo.Enabled = false; RadNumericTxtCoverAmnDis.Enabled = false; RadNumericTxtPremiumDis.Enabled = false; RadNumericTxtEMLoadingDisability.Enabled = false; hideOption1Disability(); } else { RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonEscalationDis6.Enabled = true; RadioButtonEscalationDis10.Enabled = true; RadioButtonQuoteDisYes.Enabled = true; RadioButtonQuoteDisNo.Enabled = true; RadNumericTxtCoverAmnDis.Enabled = true; RadNumericTxtPremiumDis.Enabled = true; RadNumericTxtEMLoadingDisability.Enabled = true; } } } } if (intClass > 3) { if (blnADW == true) { RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonTypeOfDisOCC.Checked = false; RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisADW.Checked = true; RadTxtDisabilityType.Text = "ADW"; } else { strResultDisability = "Occupation does not allow disability"; lblDisabilityMessage.Text = strResultDisability; PanelDisability.GroupingText = "Disability - Unavailable"; if ((RadComboBoxTypeBenefitDisability.SelectedItem.Text == "FDB") && (RadComboBoxTypeBenefitLife.Items.Count() == 1)) { //PanelDisability.Enabled = false; RadioButtonTypeOfDisADW.Enabled = false; RadioButtonTypeOfDisOCC.Enabled = false; RadioButtonEscalationDis6.Enabled = false; RadioButtonEscalationDis10.Enabled = false; RadioButtonQuoteDisYes.Enabled = false; RadioButtonQuoteDisNo.Enabled = false; RadNumericTxtCoverAmnDis.Enabled = false; RadNumericTxtPremiumDis.Enabled = false; RadNumericTxtEMLoadingDisability.Enabled = false; hideOption1Disability(); } else { RadioButtonTypeOfDisADW.Enabled = true; RadioButtonTypeOfDisOCC.Enabled = true; RadioButtonEscalationDis6.Enabled = true; RadioButtonEscalationDis10.Enabled = true; RadioButtonQuoteDisYes.Enabled = true; RadioButtonQuoteDisNo.Enabled = true; RadNumericTxtCoverAmnDis.Enabled = true; RadNumericTxtPremiumDis.Enabled = true; RadNumericTxtEMLoadingDisability.Enabled = true; } } } } } #endregion #region "Add the quote to the Quote audit table" sqlCommandX = new SqlCommand(); sqlCommandX.Connection = sqlConnectionX; sqlCommandX.CommandType = CommandType.StoredProcedure; sqlCommandX.CommandText = "spx_INSERT_QuoteAuditTrail"; #region "Parameters" string strGender = string.Empty; string strHighestQualification = string.Empty; string strDiabetesType = string.Empty; string strInsulinUse = string.Empty; string strTabletUse = string.Empty; string strDoctorsVisits = string.Empty; string strDiabeticControl = string.Empty; string strHbA1c = string.Empty; string strExercisePlan = string.Empty; string strExHowWellFollowed = string.Empty; string strEatingPlan = string.Empty; string strEatHowWellFollowed = string.Empty; string strHighBP = string.Empty; string strHighCholesterol = string.Empty; string strMedicalAid = string.Empty; string strAlcohol = string.Empty; string strAlcoholUnits = string.Empty; string strTobacco = string.Empty; decimal decEscalationLife = 0; decimal decEscalationDisability = 0; string strTobaccoUnits = string.Empty; string strLifeBenifit = string.Empty; string strDisabilityBenifit = string.Empty; int intQuoteLife = 1; int intQuoteDisability = 1; sqlParam = new SqlParameter("MagnumID", RadTxtMagnumID.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("UserID", Session["UserID"].ToString()); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("ClientName", RadTxtClientNameAndSurname.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("IDType", RadComboIDType.SelectedItem.Text.ToString()); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("IDNumber", RadTxtIDNumber.Text.Trim()); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("QuoteDate", Convert.ToDateTime(RadDatePickerQuoteDate.SelectedDate.ToString()).ToString("yyyy-MM-dd")); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("EmailAddress", RadTxtEmail.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("DOB", Convert.ToDateTime(RadDatePickerDOB.SelectedDate.ToString()).ToString("yyyy-MM-dd")); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("AgeAtNextBD", RadTxtAgeOfNextBirthday.Text); if (RadioButtonMale.Checked == true) strGender = "M"; if (RadioButtonFemale.Checked == true) strGender = "F"; if (RadioButtonOther.Checked == true) strGender = "M"; sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("Gender", strGender); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("IDValidation", LabelValidationMsg.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("HighestQualification", strQualification); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("OccupationID", Convert.ToInt16(RadComboBoxOccupation.SelectedItem.Value)); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("Income", Convert.ToDecimal(RadNumericTxtIncome.Text.Trim())); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("@MarriedStatusID", intMarriedTypeID); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("SpouseQualification", strSpouseQualification); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("SpouseIncome", Convert.ToDecimal(strSpouseIncome)); sqlCommandX.Parameters.Add(sqlParam); //sqlParam = new SqlParameter("DateOfDiagnisis", Convert.ToDateTime(RadDatePickerDateOfDiag.SelectedDate.ToString()).ToString("yyyy-MM-dd")); sqlParam = new SqlParameter("DateOfDiagnisis", Convert.ToDateTime(RadMonthYearPickerDateOfDiag.SelectedDate.ToString()).ToString("yyyy")); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonDiabetesType1.Checked) { strDiabetesType = "type1"; HiddenFieldRMDiabetesType.Value = "T1"; } if (RadioButtonDiabetesType2.Checked) { strDiabetesType = "type2"; HiddenFieldRMDiabetesType.Value = "T2"; } if (RadioButtonDiabetesTypeNotSure.Checked) { strDiabetesType = "NotSure"; HiddenFieldRMDiabetesType.Value = "T2"; } sqlParam = new SqlParameter("DiabetesType", strDiabetesType); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonInsulinYes.Checked) { strInsulinUse = "Yes"; HiddenFieldRMDiabetesType.Value = "T1"; } if (RadioButtonInsulinNo.Checked) strInsulinUse = "No"; if (RadioButtonInsulinNotSure.Checked) strInsulinUse = "NotSure"; sqlParam = new SqlParameter("InsulineUse", strInsulinUse); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonTabletUseYes.Checked) strTabletUse = "Yes"; if (RadioButtonTabletUseNo.Checked) strTabletUse = "No"; if (RadioButtonTabletUseNotSure.Checked) strTabletUse = "NotSure"; sqlParam = new SqlParameter("TabletUse", strTabletUse); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonDVYes1.Checked) strDoctorsVisits = "1"; if (RadioButtonDVYes2.Checked) strDoctorsVisits = "2"; if (RadioButtonDVYes3.Checked) strDoctorsVisits = "3"; if (RadioButtonDVNo.Checked) strDoctorsVisits = "4"; sqlParam = new SqlParameter("DoctorsVisits", strDoctorsVisits); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonDiabetControlExcellent.Checked) strDiabeticControl = "Excellent"; if (RadioButtonDiabetControlGood.Checked) strDiabeticControl = "Good"; if (RadioButtonDiabetControlMod.Checked) strDiabeticControl = "Moderate"; if (RadioButtonDiabetControlPoor.Checked) strDiabeticControl = "Poor"; sqlParam = new SqlParameter("DiabeticControl", strDiabeticControl); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonHbA1c3.Checked) strHbA1c = "4"; if (RadioButtonHbA1c4.Checked) strHbA1c = "0"; if (RadioButtonHbA1c6.Checked) strHbA1c = "6"; if (RadioButtonHbA1c7.Checked) strHbA1c = "7"; if (RadioButtonHbA1c8.Checked) strHbA1c = "8"; if (RadioButtonHbA1c9.Checked) strHbA1c = "9"; if (RadioButtonHbA1c10.Checked) strHbA1c = "10"; if (RadioButtonHbA1c11.Checked) strHbA1c = "11"; if (RadioButtonHbA1c12.Checked) strHbA1c = "12"; if (RadioButtonHbA1c15.Checked) strHbA1c = "15"; if (RadioButtonHbA1cUnknown.Checked) strHbA1c = "0"; sqlParam = new SqlParameter("HbA1c", strHbA1c); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonExPYes.Checked) strExercisePlan = "Yes"; if (RadioButtonExPNo.Checked) strExercisePlan = "No"; sqlParam = new SqlParameter("ExercisePlan", strExercisePlan); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonExFollowedVW.Checked) strExHowWellFollowed = "Very Well"; if (RadioButtonExFollowedok.Checked) strExHowWellFollowed = "Ok"; if (RadioButtonExFollowedpoor.Checked) strExHowWellFollowed = "Poor"; sqlParam = new SqlParameter("ExHowWellFollowed", strExHowWellFollowed); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonEatPYes.Checked) strEatingPlan = "Yes"; if (RadioButtonEatPNo.Checked) strEatingPlan = "No"; sqlParam = new SqlParameter("EatingPlan", strEatingPlan); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonEatFollowedVW.Checked) strEatHowWellFollowed = "Very Well"; if (RadioButtonEatFollowedOk.Checked) strEatHowWellFollowed = "Ok"; if (RadioButtonEatFollowedPoor.Checked) strEatHowWellFollowed = "Poor"; sqlParam = new SqlParameter("EatHowWellFollowed", strEatHowWellFollowed); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonHighBPYes.Checked) strHighBP = "Yes"; if (RadioButtonHighBPNo.Checked) strHighBP = "No"; if (RadioButtonHighBP.Checked) strHighBP = "Not sure"; sqlParam = new SqlParameter("HighBP", strHighBP); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonCholesterolYes.Checked) strHighCholesterol = "Yes"; if (RadioButtonCholesterolNo.Checked) strHighCholesterol = "No"; if (RadioButtonCholesterolNotSure.Checked) strHighCholesterol = "Not sure"; sqlParam = new SqlParameter("HighCholesterol", strHighCholesterol); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonMedicalAidNone.Checked) strMedicalAid = "None"; if (RadioButtonMedicalAidNotSure.Checked) strMedicalAid = "Not sure"; if (RadioButtonMedicalAidComp.Checked) strMedicalAid = "Comprehensive"; if (RadioButtonMedicalAidHos.Checked) strMedicalAid = "Hospital plan"; sqlParam = new SqlParameter("MedicalAid", strMedicalAid); sqlCommandX.Parameters.Add(sqlParam); if (RadNumericTxtHeight.Text != "") sqlParam = new SqlParameter("Height", Convert.ToDecimal(RadNumericTxtHeight.Text)); else sqlParam = new SqlParameter("Height", Convert.ToDecimal("0")); sqlCommandX.Parameters.Add(sqlParam); if (RadNumericTxtWeight.Text != "") sqlParam = new SqlParameter("Weight", Convert.ToDecimal(RadNumericTxtWeight.Text)); else sqlParam = new SqlParameter("Weight", Convert.ToDecimal("0")); sqlCommandX.Parameters.Add(sqlParam); if (RadNumericTxtPantSize.Text != "") sqlParam = new SqlParameter("PantSize", Convert.ToInt16(RadNumericTxtPantSize.Text)); else sqlParam = new SqlParameter("PantSize", Convert.ToDecimal("0")); sqlCommandX.Parameters.Add(sqlParam); if (RadNumericTxtBMI.Text != "") sqlParam = new SqlParameter("BMI", Convert.ToDecimal(RadNumericTxtBMI.Text)); else sqlParam = new SqlParameter("BMI", Convert.ToDecimal("0")); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonListAlcohol.SelectedValue == "non-drinker") strAlcohol = "No"; else strAlcohol = "Yes"; //if (RadioButtonAlcoholYes.Checked) // strAlcohol = "Yes"; //if (RadioButtonAlcoholNo.Checked) // strAlcohol = "No"; sqlParam = new SqlParameter("Alcohol", strAlcohol); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("AlcoholUnits", RadioButtonListAlcohol.SelectedValue.ToString()); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonListTobacco.SelectedValue == "non-smoker") strTobacco = "No"; else strTobacco = "Yes"; //if (RadioButtonTobaccoYes.Checked) // strTobacco = "Yes"; //if (RadioButtonTobaccoNo.Checked) // strTobacco = "No"; sqlParam = new SqlParameter("Tobacco", strTobacco); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("TobaccoUnits", RadioButtonListTobacco.SelectedValue.ToString()); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("QualifyLife", LblQualificationMessage.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("QualifyDisability", lblDisabilityMessage.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("RiskBand", RadTxtRiskBand.Text); sqlCommandX.Parameters.Add(sqlParam); sqlParam = new SqlParameter("DisabilityType", RadTxtDisabilityType.Text); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonEsc6.Checked) decEscalationLife = 6; if (RadioButtonEsc10.Checked) decEscalationLife = 10; //if (RadioButtonEscLife6.Checked) // decEscalationLife = 6; //if (RadioButtonEscLife10.Checked) // decEscalationLife = 10; sqlParam = new SqlParameter("EscalationLife", decEscalationLife); sqlCommandX.Parameters.Add(sqlParam); //if (RadioButtonEscalationDis6.Checked) // decEscalationDisability = 6; //if (RadioButtonEscalationDis10.Checked) // decEscalationDisability = 10; decEscalationDisability = 0; sqlParam = new SqlParameter("EscalationDisability", decEscalationDisability); sqlCommandX.Parameters.Add(sqlParam); strLifeBenifit = RadComboBoxTypeBenefitLife.SelectedItem.Text; sqlParam = new SqlParameter("LifeBenifit", strLifeBenifit); sqlCommandX.Parameters.Add(sqlParam); strDisabilityBenifit = RadComboBoxTypeBenefitDisability.SelectedItem.Text; sqlParam = new SqlParameter("DisabilityBenifit", strDisabilityBenifit); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonQuoteLifeNo.Checked == true) intQuoteLife = 0; else intQuoteLife = 1; sqlParam = new SqlParameter("QuoteLife", intQuoteLife); sqlCommandX.Parameters.Add(sqlParam); if (RadioButtonQuoteDisNo.Checked == true) intQuoteDisability = 0; else intQuoteDisability = 1; sqlParam = new SqlParameter("QuoteDisability", intQuoteDisability); sqlCommandX.Parameters.Add(sqlParam); sqlDR = sqlCommandX.ExecuteReader(); while (sqlDR.Read()) { HiddenFieldQuoteAuditID.Value = sqlDR.GetValue(0).ToString(); } sqlDR.Close(); sqlCommandX.Cancel(); sqlCommandX.Dispose(); #endregion #endregion //The below was added so that if ADB or ACDB are selected iit does not take the qualification into account if (RadComboBoxTypeBenefitLife.SelectedItem.Text != "FDB") { strResultLife = "Successful"; } if (RadComboBoxTypeBenefitDisability.SelectedItem.Text != "FDB") { strResultLife = "Successful"; } if ((strResultLife == "Successful") || (strResultDisability == "Successful")) { LblOffer.Text = "We can offer you:"; LblAcceptedQuote.Visible = true; //RadBtnOption1.Visible = true; RadioButtonOption1.Visible = true; //RadBtnOption2.Visible = true; RadioButtonOption2.Visible = true; //RadBtnOption3.Visible = true; RadioButtonOption3.Visible = true; RadBtnOption4.Visible = true; RadioButtonOption4.Visible = true; RadBtnOption5.Visible = true; RadioButtonOption5.Visible = true; RadBtnOption1_Click(sender, e); RadBtnOption2_Click(sender, e); RadBtnOption3_Click(sender, e); } else { LblOffer.Text = "Unfortnatley we are unable to offer you cover at this time"; LblAcceptedQuote.Visible = false; lblOr.Visible = false; RadBtnOption1.Visible = false; RadioButtonOption1.Visible = false; RadBtnOption2.Visible = false; RadioButtonOption2.Visible = false; RadBtnOption3.Visible = false; RadioButtonOption3.Visible = false; RadBtnOption4.Visible = false; RadioButtonOption4.Visible = false; RadBtnOption5.Visible = false; RadioButtonOption5.Visible = false; lblSuitable0.Visible = false; lblAlso.Visible = false; lblSuitable.Visible = false; lblSpecificCover.Visible = false; lblSpecificPremium.Visible = false; } PanelQuotePresentation.Visible = true; RadBtnQualifyClient.Enabled = true; sqlConnectionX.Close(); } catch (Exception ex) { lblInfo.Text = ex.Message; lblInfo2.Text = ex.Message; //throw; } }