public static bool CheckForExistance(string TestCode, int QuestionNumber, int Section)
    {
        DataBase.Questions Questions = new DataBase.Questions(TestCode);
        bool rets = Questions.CheckForQuestionExistance(TestCode, QuestionNumber, Section);

        return(rets);
    }
Example #2
0
    public DataBase.QuestionStructure GetQuestionData(string TestCode, int QuestionNumber, int Section)
    {
        Questions = new DataBase.Questions(TestCode);

        Qs = new DataBase.QuestionStructure();

        if (Questions.CheckForQuestionExistance(TestCode, QuestionNumber, Section))
        {
            Questions.RetrieveData(QuestionNumber, Section);
            Qs.QuestionNumber = Questions.QuestionSructure.QuestionNumber;
            Qs.Question       = Questions.QuestionSructure.Question;
            Qs.QuestionType   = Questions.QuestionSructure.QuestionType;
            Qs.Objectives     = Questions.QuestionSructure.Objectives;
        }

        else
        {
        }

        return(Qs);
    }
    public void LoadData(int QuestionNumber, int SectionNumber)
    {
        ClearTemplate();

        char[] Sections = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();


        for (int i = 0; i <= SectionNumber; i++)
        {
            ListItem Li = new ListItem();
            Li.Value = "Section" + " " + Sections[i];

            SectionSelection.Items.Add(Li);



            if (QuestionNumber == 1)
            {
                ButtonPrev.Disabled = true;
            }

            else
            {
                ButtonPrev.Disabled = false;
            }

            qt.InnerText = "Qtn: " + QuestionNumber;

            if (Questions.CheckForQuestionExistance(TestCodeData, QuestionNumber, SectionNumber))
            {
                int count = 1;
                DisableControls(true);
                ButtonNext.InnerText = "NEXT";

                Questions.RetrieveData(QuestionNumber, SectionNumber);

                QuestionTextArea.InnerText = Questions.QuestionSructure.Question;

                List <string> data = new List <string>();

                HtmlTableRow Htr = new HtmlTableRow();

                switch (Questions.QuestionSructure.QuestionType)
                {
                case 1:
                    QuestionTypeDropDown.Items.Add(QuestionTypes[0].ToString());
                    break;

                case 2:
                    QuestionTypeDropDown.Items.Add(QuestionTypes[1].ToString());
                    break;

                case 3:
                    QuestionTypeDropDown.Items.Add(QuestionTypes[2].ToString());
                    break;
                }

                if (Questions.QuestionSructure.Objectives != null)
                {
                    foreach (DataBase.Questions.ObjectivesContent obc in Questions.QuestionSructure.Objectives)
                    {
                        HtmlInputText HtText = (HtmlInputText)obtable.Rows[count].Cells[2].Controls[0].FindControl("TextBox" + count.ToString());

                        HtText.Value = obc.Detail;

                        RadioButton Hradio = (RadioButton)obtable.Rows[count].Cells[3].Controls[0].FindControl("AnswerRadio" + count.ToString());

                        HiddenField Hfield = (HiddenField)obtable.Rows[count].Cells[4].Controls[0].FindControl("HiddenField" + count.ToString());

                        Hfield.Value = obc.ObjID.ToString();


                        if (obc.validity == 1)
                        {
                            Hradio.Checked = true;
                        }
                        else
                        {
                            Hradio.Checked = false;
                        }

                        PopulateObjectives(count);

                        count++;
                    }


                    ViewState["ObjectivesReturnedCount"] = count;
                }
                else
                {
                    PopulateObjectives(0);
                }

                ButtonNext.Visible = true;
                ButtonAdd.Visible  = false;
            }
            else
            {
                ButtonAdd.Visible  = true;
                ButtonNext.Visible = false;
                DisableControls(false);
                LoadOptions();

                LoadQuestionTypes();
            }
        }
    }