Esempio n. 1
0
        private void setScore(int index, Boolean isEnd)
        {
            ExamSubQuestionPanel examSubQuestionPanel = examMainQuestionPanelList[shortCutButtonList[index].MainQuestionNo].SubQuestionPanelsList[shortCutButtonList[index].SubQuestionNo];
            int score = int.Parse(examSubQuestionPanel.StudentScorePanel.ScoreTextBox.Text);

            string value = "";

            switch (examSubQuestionPanel.Type)
            {
            case 0:
                ExamOXPanel examOXPanel = (ExamOXPanel)examSubQuestionPanel;
                value = examOXPanel.Answer.ToString();
                break;

            case 1:
                ExamShortAnswerQuestionPanel examShortAnswerQuestionPanel = (ExamShortAnswerQuestionPanel)examSubQuestionPanel;
                value = examShortAnswerQuestionPanel.AnswerPanel.AnswerLabel.Text;
                break;

            case 2:
                ExamEssayQuestionPanel examEssayQuestionPanel = (ExamEssayQuestionPanel)examSubQuestionPanel;
                value = examEssayQuestionPanel.AnswerPanel.AnswerLabel.Text;
                break;

            case 3:
                ExamMultipleChoiceQuestionPanel examMultipleChoiceQuestionPanel = (ExamMultipleChoiceQuestionPanel)examSubQuestionPanel;
                value = examMultipleChoiceQuestionPanel.Answer.ToString();
                break;

            default: break;
            }

            isScoredList[index] = true;

            if (isEnd)
            {
                try
                {
                    mainController.professorChangeScore(value, room_id, index + 1, student_id, score);
                }
                catch (Exception error)
                {
                    Console.WriteLine(error);
                }
            }
            else
            {
                (new Thread(new ThreadStart(() =>
                {
                    try
                    {
                        mainController.professorChangeScore(value, room_id, index + 1, student_id, score);
                    }
                    catch (Exception error)
                    {
                        Console.WriteLine(error);
                    }
                }))).Start();
            }
        }
Esempio n. 2
0
 private void ScoreTextBox_LostFocus(object sender, EventArgs e)
 {
     try
     {
         TextBox scoreTextBox = (TextBox)sender;
         string  str          = scoreTextBox.Text.Replace(" ", "");
         str = str.Replace("\r", "");
         str = str.Replace("\n", "");
         if (str != "")
         {
             ScorePanel           scorePanel           = (ScorePanel)scoreTextBox.Parent;
             ExamSubQuestionPanel examSubQuestionPanel = (ExamSubQuestionPanel)scorePanel.Parent;
             int index         = Find_shortCutButton_index(examSubQuestionPanel);
             int problem_score = int.Parse(examSubQuestionPanel.ExamScorePanel.ScoreTextBox.Text);
             int score         = int.Parse(scoreTextBox.Text);
             if (score > problem_score)
             {
                 MessageBox.Show("문제의 최고 점수보다 높게 점수를 부여할 수 없습니다.", "점수 오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 examSubQuestionPanel.StudentScorePanel.ScoreTextBox.Text = "0";
                 return;
             }
             setScore(index, false);
         }
     }
     catch (Exception error)
     {
         Console.WriteLine(error);
     }
 }
Esempio n. 3
0
        private void multiple_enter_answer(object sender, EventArgs e)
        {
            RadioButton                     radioButton                     = (RadioButton)sender;
            ExamMultipleChoicePanel         multipleChoicePanel             = (ExamMultipleChoicePanel)radioButton.Parent;
            ExamSubQuestionPanel            multipleChoiceQuestionPanel     = (ExamSubQuestionPanel)multipleChoicePanel.Parent;
            ExamMultipleChoiceQuestionPanel examMultipleChoiceQuestionPanel = (ExamMultipleChoiceQuestionPanel)multipleChoiceQuestionPanel;
            int index = Find_shortCutButton_index(multipleChoiceQuestionPanel);

            submitAnswer(examMultipleChoiceQuestionPanel.Answer.ToString(), index + 1);
            shortCutButtonList[index].BackColor = Color.GreenYellow;
        }
Esempio n. 4
0
        private void ox_enter_answer(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            ExamSubQuestionPanel examOXPanel = (ExamSubQuestionPanel)button.Parent;
            ExamOXPanel          oxPanel     = (ExamOXPanel)examOXPanel;
            int index = Find_shortCutButton_index(examOXPanel);

            string answer = oxPanel.Answer.ToString();

            submitAnswer(answer, index + 1);
            shortCutButtonList[index].BackColor = Color.GreenYellow;
        }
Esempio n. 5
0
        private void setAnswers(JArray jArray)
        {
            int count = jArray.Count;

            for (int i = 0; i < count; i++)
            {
                int     num      = (int)jArray[i]["question_num"];
                int     score    = (int)jArray[i]["score"];
                string  value    = (string)jArray[i]["value"];
                Boolean isScored = (Boolean)jArray[i]["is_scored"];

                isScoredList[num - 1] = isScored;
                ExamSubQuestionPanel subQuestionPanel = examMainQuestionPanelList[shortCutButtonList[num - 1].MainQuestionNo].SubQuestionPanelsList[shortCutButtonList[num - 1].SubQuestionNo];
                subQuestionPanel.StudentScorePanel.ScoreTextBox.Text = score.ToString();
                int type = subQuestionPanel.Type;
                if (type == 0)
                {
                    ExamOXPanel oxPanel = (ExamOXPanel)subQuestionPanel;
                    oxPanel.checkAnswer(value);
                }
                else if (type == 1)
                {
                    ExamShortAnswerQuestionPanel shortAnswerQuestionPanel = (ExamShortAnswerQuestionPanel)subQuestionPanel;
                    shortAnswerQuestionPanel.AnswerPanel.AnswerLabel.Text   = value;
                    shortAnswerQuestionPanel.AnswerPanel.AnswerTextBox.Text = value;
                    if (!value.Equals(""))
                    {
                        shortAnswerQuestionPanel.AnswerPanel.AnswerLabel.Visible   = true;
                        shortAnswerQuestionPanel.AnswerPanel.AnswerTextBox.Visible = false;
                    }
                }
                else if (type == 2)
                {
                    ExamEssayQuestionPanel essayQuestionPanel = (ExamEssayQuestionPanel)subQuestionPanel;
                    essayQuestionPanel.AnswerPanel.AnswerLabel.Text   = value;
                    essayQuestionPanel.AnswerPanel.AnswerTextBox.Text = value;
                    if (!value.Equals(""))
                    {
                        essayQuestionPanel.AnswerPanel.AnswerLabel.Visible   = true;
                        essayQuestionPanel.AnswerPanel.AnswerTextBox.Visible = false;
                    }
                }
                else
                {
                    ExamMultipleChoiceQuestionPanel multipleChoiceQuestionPanel = (ExamMultipleChoiceQuestionPanel)subQuestionPanel;
                    multipleChoiceQuestionPanel.checkAnswer(value);
                }
            }
        }
Esempio n. 6
0
        private void essay_enter_answer(object sender, EventArgs e)
        {
            TextBox                textBox                = (TextBox)sender;
            EssayAnswerPanel       essayAnswerPanel       = (EssayAnswerPanel)textBox.Parent;
            ExamSubQuestionPanel   examEssayQuestionPanel = (ExamSubQuestionPanel)essayAnswerPanel.Parent;
            ExamEssayQuestionPanel essayQuestionPanel     = (ExamEssayQuestionPanel)examEssayQuestionPanel;
            int index = Find_shortCutButton_index(examEssayQuestionPanel);

            if (textBox.Visible == true)
            {
                shortCutButtonList[index].BackColor = Color.White;
            }
            else
            {
                submitAnswer(essayQuestionPanel.AnswerPanel.AnswerLabel.Text, index + 1);
                shortCutButtonList[index].BackColor = Color.GreenYellow;
            }
        }
Esempio n. 7
0
        private int Find_shortCutButton_index(ExamSubQuestionPanel examSubQuestionPanel)
        {
            int index = 0;
            int count = examMainQuestionPanelList.Count;

            for (int i = 0; i < count; i++)
            {
                int subCount = examMainQuestionPanelList[i].SubQuestionPanelsList.Count;
                for (int j = 0; j < subCount; j++)
                {
                    if (examMainQuestionPanelList[i].SubQuestionPanelsList[j] == examSubQuestionPanel)
                    {
                        return(index);
                    }

                    index++;
                }
            }

            return(-1);
        }
Esempio n. 8
0
        private void initShortCutButton()
        {
            int index = 0, count = examMainQuestionPanelList.Count, i;
            int locationY;
            int locationX;

            for (i = 0; i < count; i++)
            {
                int subCount = examMainQuestionPanelList[i].SubQuestionPanelsList.Count;

                for (int j = 0; j < subCount; j++)
                {
                    ShortCutButton shortCutButton = new ShortCutButton(customFonts, index + 1);
                    locationY = (index / 4) * 27;
                    locationX = (index % 4) * 77;
                    this.examShortCutPanel.Controls.Add(shortCutButton);
                    this.shortCutButtonList.Add(shortCutButton);
                    shortCutButton.Location       = new Point(locationX, locationY);
                    shortCutButton.MainQuestionNo = i;
                    shortCutButton.SubQuestionNo  = j;
                    shortCutButton.Click         += shortCutButton_Click_1;
                    index++;

                    if (!isStudent)
                    {
                        isScoredList.Add(false);
                        examMainQuestionPanelList[i].SubQuestionPanelsList[j].ExamScorePanel.ScoreTextBox.BackColor     = Color.White;
                        examMainQuestionPanelList[i].SubQuestionPanelsList[j].StudentScorePanel.Visible                 = true;
                        examMainQuestionPanelList[i].SubQuestionPanelsList[j].StudentScorePanel.ScoreTextBox.LostFocus += ScoreTextBox_LostFocus;
                    }
                    if (isStudent)
                    {
                        ExamSubQuestionPanel examSubQuestionPanel = examMainQuestionPanelList[i].SubQuestionPanelsList[j];

                        switch (examSubQuestionPanel.Type)
                        {
                        case 0:
                            ExamOXPanel examOXPanel = (ExamOXPanel)examSubQuestionPanel;
                            examOXPanel.OButton.Click += ox_enter_answer;
                            examOXPanel.XButton.Click += ox_enter_answer;
                            break;

                        case 1:
                            ExamShortAnswerQuestionPanel examShortAnswerQuestionPanel = (ExamShortAnswerQuestionPanel)examSubQuestionPanel;
                            examShortAnswerQuestionPanel.AnswerPanel.AnswerTextBox.LostFocus += short_enter_answer;
                            break;

                        case 2:
                            ExamEssayQuestionPanel examEssayQuestionPanel = (ExamEssayQuestionPanel)examSubQuestionPanel;
                            examEssayQuestionPanel.AnswerPanel.AnswerTextBox.LostFocus += essay_enter_answer;
                            break;

                        case 3:
                            ExamMultipleChoiceQuestionPanel examMultipleChoiceQuestionPanel = (ExamMultipleChoiceQuestionPanel)examSubQuestionPanel;
                            add_event_at_radiobutton(examMultipleChoiceQuestionPanel.ChoicePaneList);
                            break;

                        default: break;
                        }
                    }
                }
            }
        }