Exemple #1
0
 //######################## UI updates ########################
 //Updates questions list
 void UI_UpdateList()
 {
     //Caso seja invocado por outro thread
     Invoke((MethodInvoker) delegate
     {
         questionsListBox.Items.Clear();
         List <DepartmentQuestion> questionsList = DepartmentDatabaseHandler.GetAllQuestions();
         if (questionsList != null)
         {
             for (int i = 0; i < questionsList.Count; i++)
             {
                 questionsListBox.Items.Add(questionsList[i]);
             }
         }
     });
 }
Exemple #2
0
 void UI_LBOX()
 {
     if (InvokeRequired)
     {
         BeginInvoke(new MethodInvoker(() => UI_LBOX()));
     }
     else
     {
         questionsListBox.Items.Clear();
         List <DepartmentQuestion> questionsList = DepartmentDatabaseHandler.GetAllQuestions();
         if (questionsList != null)
         {
             for (int i = 0; i < questionsList.Count; i++)
             {
                 questionsListBox.Items.Add(questionsList[i]);
             }
         }
     }
 }
Exemple #3
0
        void DebugTestes()
        {
            string msg = "\n\n\n------------------ Debug: ------------------\n";


            msg += "\n##################  Questions  ##################\n";
            if (DepartmentDatabaseHandler.AddQuestion("T1", "quest1", 1, 3))
            {
                msg += "1: OK\n";
            }
            else
            {
                msg += "1: ERROR\n";
            }

            if (DepartmentDatabaseHandler.AddQuestion("T2", "quest2", 1, 3))
            {
                msg += "2: OK\n";
            }
            else
            {
                msg += "2: ERROR\n";
            }

            if (DepartmentDatabaseHandler.GetQuestion(1).title == "T1" &&
                DepartmentDatabaseHandler.GetQuestion(1).question == "quest1" &&
                DepartmentDatabaseHandler.GetQuestion(1).serverQuestionId == 1 &&
                DepartmentDatabaseHandler.GetQuestion(1).ticketId == 3)
            {
                msg += "3: OK\n";
            }
            else
            {
                msg += "3: ERROR\n";
            }


            if (DepartmentDatabaseHandler.GetAllQuestions(3).Count == 2)
            {
                msg += "4: OK\n";
            }
            else
            {
                msg += "4: ERROR\n";
            }

            if (DepartmentDatabaseHandler.RemoveQuestion(1))
            {
                msg += "5: OK\n";
            }
            else
            {
                msg += "5: ERROR\n";
            }

            if (DepartmentDatabaseHandler.GetAllQuestions(3).Count == 1)
            {
                msg += "6: OK\n";
            }
            else
            {
                msg += "6: ERROR\n";
            }

            if (!DepartmentDatabaseHandler.IsAllQuestionsAnswered(3))
            {
                msg += "7: OK\n";
            }
            else
            {
                msg += "7: ERROR\n";
            }

            if (DepartmentDatabaseHandler.RemoveQuestion(2))
            {
                msg += "8: OK\n";
            }
            else
            {
                msg += "8: ERROR\n";
            }


            if (DepartmentDatabaseHandler.GetAllQuestions(3) == null)
            {
                msg += "9: OK\n";
            }
            else
            {
                msg += "9: ERROR\n";
            }

            if (DepartmentDatabaseHandler.IsAllQuestionsAnswered(3))
            {
                msg += "10: OK\n";
            }
            else
            {
                msg += "10: ERROR\n";
            }


            Console.WriteLine("\n\n\n" + msg);
        }