Exemplo n.º 1
0
 public void Answer_Click(object sender, EventArgs e)
 {
     // When the question is a poll, the answer needs to be send to the databse immediately
     if (Questions[counter].type == 1)
     {
         QuestionLog tempLog = new QuestionLog(idQuestionlist, Answer[Int32.Parse(((Button)sender).Tag.ToString())].Text, Questionlists.title, bc.user.firstname+" "+bc.user.lastname, Questions[counter].id);
         bc.sqc.createAnswer(tempLog);
     }
     else
     {
         // Replaces or sets the anwser in the tempList
         if (MutipleChoiceList[timesMutipleChoice - 1].Answer != Questions[counter].title)
         {
             MutipleChoiceList[timesMutipleChoice - 1].QuestionID = Questions[counter].id;
             MutipleChoiceList[timesMutipleChoice - 1].Answer = Answer[Int32.Parse(((Button)sender).Tag.ToString())].Text;
         }
     }
     // Set color back to white
     resetButtons();
     // Set new answer to green
     Answer[Int32.Parse(((Button)sender).Tag.ToString())].FlatAppearance.BorderColor = Color.LightGreen;
     Answered = true;
 }
Exemplo n.º 2
0
        private void Handle_Next_Click()
        {
            // Check if the student is at the last question
            if ((Questions.Count - 1) == counter)
            {
                // Stops the loop
                if (Questionlists.type == 1)
                {
                    loopThread.Abort();
                }

                // Goes through each item and if its not an empty string it gets send to the database
                foreach (AnswerTracker A in OpenAnswersList)
                {
                    if (A.Answer != "")
                    {
                        QuestionLog tempLog = new QuestionLog(idQuestionlist, A.Answer, Questionlists.title, bc.user.firstname + " " + bc.user.lastname, A.QuestionID);
                        bc.sqc.createAnswer(tempLog);
                    }
                }

                // Goes through each item and if its not an empty string it gets send to the database
                foreach (AnswerTracker A in MutipleChoiceList)
                {
                    if (A.Answer != "")
                    {
                        QuestionLog tempLog = new QuestionLog(idQuestionlist, A.Answer, Questionlists.title, bc.user.firstname + " " + bc.user.lastname, A.QuestionID);
                        bc.sqc.createAnswer(tempLog);
                    }
                }

                MessageBox.Show("U bent nu klaar met de vragenlijst.");
                // Sets the OverviewQuestionlistView panel
                bc.scc.setOverviewPanel();
            }
            else
            {
                // Check if student is at the last question
                if ((Questions.Count - 2) == counter)
                {
                    Next.Enabled = true;
                    Next.Text = "Afronden";

                    Handle_Next_Question_Type();

                }
                else
                {
                    if (Questionlists.type == 1)
                    {
                        int tempCounter = counter;
                        tempCounter += 2;
                        if (currentQuestion > tempCounter)
                        {
                            Next.Enabled = true;
                        }
                        else
                        {
                            Next.Enabled = false;
                        }
                    }

                    Handle_Next_Question_Type();
                }
            }
        }