Пример #1
0
        //######################## UI events ########################

        void SelectQuestionsListItem(object sender, MouseEventArgs e)
        {
            if (questionsListBox.SelectedItems.Count == 0)
            {
                return;
            }

            DepartmentQuestion question;

            question = (DepartmentQuestion)questionsListBox.SelectedItems[0];
            if (question == null)
            {
                activeQuestion = null;
                UI_UpdateList();
                return;
            }

            question = DepartmentDatabaseHandler.GetQuestion(question.id);
            if (question == null)
            {
                activeQuestion = null;
                UI_UpdateList();
                return;
            }

            UI_UpdateQuestionInfo(question);
        }
Пример #2
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);
        }