public void MarkExercise()
        {
            FactorAnswers faFactorAnswers = new FactorAnswers();
            List<int> lAnswerSet;
            int iGGFAnswer;
            //Set state

            for (int iExercise = 0; iExercise < ServerData.lFactorsGGF.Count; iExercise++)
            {
                FormData.GetType().GetProperty("sFactorOpacity" + ServerData.lFactorsGGF[iExercise][0].ToString()).SetValue(FormData, "1", null);
                FormData.GetType().GetProperty("sFactorOpacity" + ServerData.lFactorsGGF[iExercise][1].ToString()).SetValue(FormData, "1", null);
                FormData.GetType().GetProperty("sExerciseOpacity" + (iExercise+1).ToString()).SetValue(FormData, "1", null);

                //Mark spesific top and bottom factor's answers
                for (int iFactorSet = 0; iFactorSet < 2; iFactorSet++)
                {
                    lAnswerSet = (List<int>)faFactorAnswers.GetType().GetProperty("lFactorAnswer" + ServerData.lFactorsGGF[iExercise][iFactorSet].ToString()).GetValue(faFactorAnswers, null);
                    for (int iAnswer = 0; iAnswer < lAnswerSet.Count; iAnswer++)
                    {
                        if (lAnswerSet[iAnswer] == (int)FormData.GetType().GetProperty("iValue" + ServerData.lFactorsGGF[iExercise][iFactorSet].ToString() + "_" + (iAnswer + 1).ToString()).GetValue(FormData, null))
                        {
                            FormData.GetType().GetProperty("sValueBG" + ServerData.lFactorsGGF[iExercise][iFactorSet].ToString() + "_" + (iAnswer + 1).ToString()).SetValue(FormData, Session.sCorrectBackGroundColor, null);
                        }
                        else
                        {
                            FormData.GetType().GetProperty("sValueBG" + ServerData.lFactorsGGF[iExercise][iFactorSet].ToString() + "_" + (iAnswer + 1).ToString()).SetValue(FormData, Session.sWrongBackGroundColor, null);
                        }
                    }
                }
                //Get GGF answer

                iGGFAnswer = Calculations.GetBigestSharedFactor((List<int>)faFactorAnswers.GetType().GetProperty("lFactorAnswer" + ServerData.lFactorsGGF[iExercise][0].ToString()).GetValue(faFactorAnswers, null), (List<int>)faFactorAnswers.GetType().GetProperty("lFactorAnswer" + ServerData.lFactorsGGF[iExercise][1].ToString()).GetValue(faFactorAnswers, null));
                if (iGGFAnswer == (int)FormData.GetType().GetProperty("iExerciseValue" + (iExercise + 1).ToString()).GetValue(FormData, null))
                {
                    FormData.GetType().GetProperty("sExerciseBG" + (iExercise +1).ToString()).SetValue(FormData, Session.sCorrectBackGroundColor, null);
                }
                else
                {
                    FormData.GetType().GetProperty("sExerciseBG" + (iExercise + 1).ToString()).SetValue(FormData, Session.sWrongBackGroundColor, null);
                }
            }
        }
예제 #2
0
        private void MarkExercise()
        {
            FactorAnswers faFactorAnswers = new FactorAnswers();
            List<int> lAnswerSet;

            //Set state
            for (int iExercise = 0; iExercise < ServerData.lFactorsNumbers_G7_1.Count; iExercise++)
            {
                FormData.GetType().GetProperty("sFactorOpacity" + ServerData.lFactorsNumbers_G7_1[iExercise].ToString()).SetValue(FormData, "1", null);
                lAnswerSet = (List<int>)faFactorAnswers.GetType().GetProperty("lFactorAnswer" + ServerData.lFactorsNumbers_G7_1[iExercise].ToString()).GetValue(faFactorAnswers, null);
                //Mark spesific factor's answers
                for (int iAnswer = 0; iAnswer < lAnswerSet.Count; iAnswer++)
                {
                    if (lAnswerSet[iAnswer] == (int)FormData.GetType().GetProperty("iValue" + ServerData.lFactorsNumbers_G7_1[iExercise].ToString() + "_" + (iAnswer + 1).ToString()).GetValue(FormData, null))
                    {
                        FormData.GetType().GetProperty("sValueBG" + ServerData.lFactorsNumbers_G7_1[iExercise].ToString() + "_" + (iAnswer + 1).ToString()).SetValue(FormData, Session.sCorrectBackGroundColor, null);
                    }
                    else
                    {
                        FormData.GetType().GetProperty("sValueBG" + ServerData.lFactorsNumbers_G7_1[iExercise].ToString() + "_" + (iAnswer + 1).ToString()).SetValue(FormData, Session.sWrongBackGroundColor, null);
                    }
                }
            }
        }