Example #1
0
    public void AddQuestion()
    {
        string a, b, c, d, pyt;

        a   = odpA.text;
        b   = odpB.text;
        c   = odpC.text;
        d   = odpD.text;
        pyt = Pytanie.text;
        int kategoria, pop;

        pop       = Poprawna.value + 1;
        kategoria = Kategorie.value + 1;
        if (a == "" || b == "" || c == "" || d == "" || pyt == "")
        {
            QuestionAlert.GetComponent <Text>().text = "Pola nie mogą być puste";
            QuestionAlert.SetActive(true);
        }
        else if (a.Contains("'") || a.Contains(Char.ConvertFromUtf32(34)) || b.Contains("'") || b.Contains(Char.ConvertFromUtf32(34)) || c.Contains("'") || c.Contains(Char.ConvertFromUtf32(34)) || d.Contains("'") || d.Contains(Char.ConvertFromUtf32(34)) ||
                 pyt.Contains("'") || pyt.Contains(Char.ConvertFromUtf32(34)))
        {
            QuestionAlert.GetComponent <Text>().text = "Pola nie mogą zawierać znaków takich jak: ' " + Char.ConvertFromUtf32(34);
            QuestionAlert.SetActive(true);
        }
        else
        {
            db.AddQuestion(a, b, c, d, pyt, pop, kategoria);
            menu.Menu();
        }
    }