protected void Page_Load(object sender, EventArgs e) { string[] strTestAnswers = new string[6] { "535455132234414322", "5232424545126555413", "31141341241231431322", "3143225321553125113435352124254311423442", "121121111211212212122112122111222122121211211112222221221121222122111212211221111221111222", "443241134132322412234213422214211113334333" }; string[] strTestAnswers2 = new string[6] { "515353112335424521", "5331414635116456423", "33111244221133441121", "3344215522543324123333342225244212443344","111222121112222111112211112212212221111112221211212122211222212221121111221122121122121121", "413142114231312111214111412111221211314131" }; scoTest = new CareerCruisingWeb.CCLib.AbilityProfiler.Score(); strScoreType = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("ScoreType","Full"); strAnswers = (strScoreType == "Half") ? strTestAnswers2 : strTestAnswers; if (IsPostBack) { strScoreType = "Custom"; for(int i=0;i<6;i++) strAnswers[i] = CareerCruisingWeb.CCLib.Common.Strings.GetFormString("Answers"+i); } scoTest.ScoreTest(strAnswers); dtlTest = scoTest.Occupations; GridViewOccList.DataSource = dtlTest; GridViewOccList.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string strSQL = "select SectionID,Answers from AP_SavedSection where APTestID=" + strTestID + " order by SectionID"; DataTable dtAnswers = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL); if (dtAnswers.Rows.Count > 0) { for (int i = 0; i < dtAnswers.Rows.Count; i++) { strAnswers[i] = dtAnswers.Rows[i]["Answers"].ToString(); } scoTest = new CareerCruisingWeb.CCLib.AbilityProfiler.Score(); scoTest.ScoreTest(strAnswers); strSQL = ""; for (int j = 0; j < 6; j++) { strSQL += "update AP_SavedSection set CorrectAnswers = " + scoTest.CorrectAnswers[j].ToString() + ", ConvertedScore = " + scoTest.ScaledScores[scoTest.SubTestMatchingAbilityNameIndex[j]].ToString() + ", Percentile = " + scoTest.PercentileScores[j].ToString() + " where APTestID=" + strTestID + " and SectionID = " + Convert.ToString(j + 1) + "; "; } CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(strSQL); } }