public static int CalculateActionStart(int intTransactionID) { int ret = -1; Model_ReportSection Rs = new Model_ReportSection(); List <Model_ReportSection> Rslist = Rs.GetListActive(); if (Rslist.Count > 0) { foreach (Model_ReportSection item in Rslist) { switch (item.ResultSectionID) { //T1 Working Philosophies case 1: Calculation_T1 cal1 = new Calculation_T1(item.ResultSectionID, intTransactionID); if (cal1.Calnow()) { ret = 0; } break; //T2 Working Traits case 2: Calculation_T2 cal2 = new Calculation_T2(item.ResultSectionID, intTransactionID); if (cal2.Calnow()) { ret = 0; } break; //T3 Working Geniuses case 3: Calculation_T3 cal3 = new Calculation_T3(item.ResultSectionID, intTransactionID); if (cal3.Calnow()) { ret = 0; } if (cal3.IsDupExtra) { ret = cal3.TransactionID; } break; //T4 nothing ??? case 4: Calculation_T4 cal4 = new Calculation_T4(item.ResultSectionID, intTransactionID); if (cal4.Calnow()) { ret = ret > 0 ? ret : 0; } break; case 5: Calculation_T5 cal5 = new Calculation_T5(item.ResultSectionID, intTransactionID); if (cal5.Calnow()) { ret = ret > 0 ? ret : 0; } break; case 6: Calculation_T6 cal6 = new Calculation_T6(item.ResultSectionID, intTransactionID); if (cal6.Calnow()) { ret = ret > 0 ? ret : 0; } break; } } } return(ret); }
public void T2Cal() { if (!string.IsNullOrEmpty(Request.QueryString["ts"])) { int tsID = int.Parse(Request.QueryString["ts"]); Calculation_T2 T2 = new Calculation_T2(2, tsID); //List<Model_UsersAssessment> T1list = T1.GetUserAss('f'); StringBuilder ret = new StringBuilder(); ret.Append("<table class='table table-strip'>"); foreach (Model_UsersAssessment item in T2.R_UserAss_D.OrderBy(o => o.SUCID)) { ret.Append("<tr>"); ret.Append("<td style='text-align:left'>"); ret.Append("<p>" + item.Code + " " + item.Questions + "</p>"); ret.Append("</td>"); ret.Append("<td>"); ret.Append("<p>" + item.SubSectionTitle + " " + item.Score + "</p>"); ret.Append("</td>"); ret.Append("</tr>"); } ret.Append("</table>"); ret.Append("<table class='table table-strip'>"); foreach (Model_UsersAssessment item in T2.R_UserAss_SumGroup_D) { ret.Append("<tr>"); ret.Append("<td style='text-align:left'>"); ret.Append("<p>" + item.SubSectionTitle + "</p>"); ret.Append("</td>"); ret.Append("<td>"); ret.Append("<p>" + item.Score + "</p>"); ret.Append("</td>"); ret.Append("<td>"); int score_r = T2.R_UserAss_SumGroup_D_RealScore.SingleOrDefault(o => o.SUCID == item.SUCID).Score; ret.Append("<p style='background-color:#fff202'>" + score_r + " x2 = <strong>" + (score_r) + "</strong></p>"); ret.Append("</td>"); ret.Append("</tr>"); } ret.Append("</table>"); dataD.Text = ret.ToString(); //List<object[]> Sumgroup = T1.R_UserAss_D ///* Group the list by the element at position 0 in each item */ //.GroupBy(o => o.SUCID) ///* Project the created grouping into a new object[]: */ //.Select(i => new object[] //{ // i.Key, // i.Sum(x => (int)x.Score) //}) //.ToList(); StringBuilder retchH = new StringBuilder(); List <Model_UsersAssessment> T1list_h = T2.R_UserAss_E; List <Model_UsersAssChoice> T1list_h_c = T2.R_UserAssChoice_E; foreach (Model_UsersAssessment cc in T1list_h) { retchH.Append("<div style='margin-bottom:10px;'>"); retchH.Append("<p>" + cc.Questions + "</p>"); retchH.Append("<table class='table table-strip'>"); foreach (Model_UsersAssChoice ch in T1list_h_c.Where(o => o.TASID == cc.TASID)) { retchH.Append("<tr>"); retchH.Append("<td>" + ch.Questions + "</td>"); retchH.Append("<td>" + ch.SubSectionTitle + "</td>"); retchH.Append("<td>" + ch.Score + "</td>"); retchH.Append("</tr>"); } retchH.Append("</table>"); retchH.Append("</div>"); } DAtaE.Text = retchH.ToString(); StringBuilder retF2 = new StringBuilder(); List <Model_ReportItemResult> fscore = T2.Code_SumValueBySubSection(); retF2.Append("<table class='table'>"); foreach (Model_ReportItemResult i in fscore) { retF2.Append("<tr>"); retF2.Append("<td>"); retF2.Append("<p>" + i.ResultItemTitle + "</p>"); retF2.Append("</td>"); retF2.Append("<td>"); retF2.Append("<p>" + i.Score + "</p>"); retF2.Append("</td>"); retF2.Append("</tr>"); } retF2.Append("</table>"); dataT2.Text = retF2.ToString(); T2.RecordResult(fscore); } }