public KettelFormAOutput CreateOutputJson(KettelFormAMethod kettel) { var flowChartMain = new Flowchart(); flowChartMain.Title = "профиль по Кеттелу (16PF)"; flowChartMain.Yaxis = "T-баллы"; flowChartMain.Xaxis = "Шкалы"; flowChartMain.Values = kettel.dictAnswerFinalPoints; var flowChartSecondary = new Flowchart(); flowChartSecondary.Title = "Вторичные факторы по Кеттелу (16PF)"; flowChartSecondary.Yaxis = ""; flowChartSecondary.Xaxis = "Факторы"; flowChartSecondary.Values = kettel.dictAnswerSecondaryFactorPoints; _flowcharts.Add(flowChartMain); _flowcharts.Add(flowChartSecondary); return this; }
public static KettelFormAMethod FormKettelFormAMethodFromString(String strKettel) { strKettel = strKettel.Trim(); var kettel = new KettelFormAMethod(); // Шаблон строки профиля по Кеттелу //"A:10, B:10, C:10, E:7, F:1, G:6, H:8, I:6, L:3, M:6, N:6, O:5, Q1:7, Q2:4, Q3:8, Q4:4, F1:2, F2:7, F3:4, F4:4." // Заполнение словаря финальных баллов по факторам List<int> tmpListValues = new List<int>(); int i = 0; while ((i = strKettel.IndexOf(':', i)) != -1) { i++; int j = strKettel.IndexOf(",", i); var substring = String.Empty; if (j == -1) { j = strKettel.IndexOf(".", i); } substring = strKettel.Substring(i, j - i); tmpListValues.Add(Convert.ToInt32(substring)); } kettel._dictAnswerFinalPoints.Add(A, tmpListValues[0]); kettel._dictAnswerFinalPoints.Add(B, tmpListValues[1]); kettel._dictAnswerFinalPoints.Add(C, tmpListValues[2]); kettel._dictAnswerFinalPoints.Add(E, tmpListValues[3]); kettel._dictAnswerFinalPoints.Add(F, tmpListValues[4]); kettel._dictAnswerFinalPoints.Add(G, tmpListValues[5]); kettel._dictAnswerFinalPoints.Add(H, tmpListValues[6]); kettel._dictAnswerFinalPoints.Add(I, tmpListValues[7]); kettel._dictAnswerFinalPoints.Add(L, tmpListValues[8]); kettel._dictAnswerFinalPoints.Add(M, tmpListValues[9]); kettel._dictAnswerFinalPoints.Add(N, tmpListValues[10]); kettel._dictAnswerFinalPoints.Add(O, tmpListValues[11]); kettel._dictAnswerFinalPoints.Add(Q1, tmpListValues[12]); kettel._dictAnswerFinalPoints.Add(Q2, tmpListValues[13]); kettel._dictAnswerFinalPoints.Add(Q3, tmpListValues[14]); kettel._dictAnswerFinalPoints.Add(Q4, tmpListValues[15]); kettel._dictAnswerSecondaryFactorPoints.Add(F1, tmpListValues[16]); kettel._dictAnswerSecondaryFactorPoints.Add(F2, tmpListValues[17]); kettel._dictAnswerSecondaryFactorPoints.Add(F3, tmpListValues[18]); kettel._dictAnswerSecondaryFactorPoints.Add(F4, tmpListValues[19]); return kettel; }