コード例 #1
0
    public static void AddQuestion(Questionnaire Questionnaire)

    {
        DataBase.Questions                   Questions = new DataBase.Questions("");
        DataBase.QuestionStructure           Qs        = new DataBase.QuestionStructure();
        DataBase.Questions.ObjectivesContent Oc;

        Qs.QuestionNumber = Questionnaire.QuestionNumber;
        Qs.Question       = Questionnaire.QuestionData;
        Qs.QuestionType   = Questionnaire.SetType;

        List <Objective> ols = Questionnaire.Objectives;

        List <DataBase.Questions.ObjectivesContent> Ocl = new List <DataBase.Questions.ObjectivesContent>();

        foreach (Objective Obj in ols)
        {
            Oc          = new DataBase.Questions.ObjectivesContent();
            Oc.Detail   = Obj.ObjectiveData;
            Oc.validity = Obj.ObjectiveValidity;

            Ocl.Add(Oc);
        }

        Qs.Objectives = Ocl.ToArray();

        try
        {
            Questions.CaptureQuestionData(Qs);
        }
        catch
        {
        }
    }
コード例 #2
0
    protected void ButtonNext_ServerClick(object sender, EventArgs e)
    {
        IsEdited = Convert.ToBoolean(ViewState["Edited"]);

        ObjContent = new DataBase.Questions.ObjectivesContent();

        List <DataBase.Questions.ObjectivesContent> omls = new List <DataBase.Questions.ObjectivesContent>();

        omls = GetObjectiveData();

        Qs.Objectives = omls.ToArray();

        ViewState["QuestObjectives"] = Qs.Objectives;

        DataBase.QuestionStructure Qs2 = new DataBase.QuestionStructure();


        if (IsEdited)
        {
            Qs2.QuestionNumber = CurrentNumber;
            Qs2.Question       = QuestionTextArea.Value;
            int QuestionType = 3;

            switch (QuestionTypeDropDown.SelectedValue)
            {
            case "Objectives":
                QuestionType = 1;
                break;

            case "Structured":
                QuestionType = 2;
                break;

            case "Mixed Mode":
                QuestionType = 3;
                break;
            }

            Qs2.QuestionType = QuestionType;


            Qs2.Objectives = (object[])ViewState["QuestObjectives"];

            System.Diagnostics.Debug.WriteLine("When this is: " + ViewState["Edited"].ToString() + CurrentNumber.ToString() + ViewState["Questionaire"].ToString());

            foreach (DataBase.Questions.ObjectivesContent obf in Qs2.Objectives)
            {
                System.Diagnostics.Debug.WriteLine("When this that is: " + obf.ObjID.ToString());
            }

            Questions.CaptureQuestionData(Qs2);

            ViewState["Edited"] = false;
        }

        ViewState["QNumber"] = MoveNext(CurrentNumber);

        LoadData(Convert.ToInt32(ViewState["QNumber"]), SectionNumber);
    }
コード例 #3
0
    private List <DataBase.Questions.ObjectivesContent> GetObjectiveData()
    {
        List <DataBase.Questions.ObjectivesContent> Oblist = new List <DataBase.Questions.ObjectivesContent>();

        int index = 1;

        foreach (HtmlTableRow Hrow in obtable.Rows)
        {
            DataBase.Questions.ObjectivesContent Obc = new DataBase.Questions.ObjectivesContent();

            if (Hrow.ID != "header_row")
            {
                int validation = 0;

                HtmlInputText Htext  = (HtmlInputText)Hrow.Cells[2].Controls[0].FindControl("TextBox" + index.ToString());
                RadioButton   Hradio = (RadioButton)Hrow.Cells[3].Controls[0].FindControl("AnswerRadio" + index.ToString());
                HiddenField   Hfield = (HiddenField)Hrow.Cells[4].Controls[0].FindControl("HiddenField" + index.ToString());

                if (Htext.Value.Length != 0)
                {
                    if (Hradio.Checked)
                    {
                        validation = 1;
                    }
                    else
                    {
                        validation = 0;
                    }

                    Obc.Detail   = Htext.Value;
                    Obc.validity = validation;

                    if (Hfield.Value == string.Empty)
                    {
                        Obc.ObjID = 0;
                    }
                    else
                    {
                        Obc.ObjID = Convert.ToInt32(Hfield.Value);
                    }

                    Oblist.Add(Obc);

                    ObjContent = Oblist[0];

                    System.Diagnostics.Debug.WriteLine("First:" + Htext.Value);
                }

                else
                {
                    System.Diagnostics.Debug.WriteLine("First:" + "There's Nothing");
                }
                index++;
            }
        }

        return(Oblist);
    }
コード例 #4
0
    protected void ButtonAdd_ServerClick(object sender, EventArgs e)
    {
        ViewState["Questionaire"] = QuestionTextArea.Value;


        System.Diagnostics.Debug.WriteLine("there is some: " + ViewState["Questionaire"].ToString());



        ObjContent = new DataBase.Questions.ObjectivesContent();

        List <DataBase.Questions.ObjectivesContent> omls = new List <DataBase.Questions.ObjectivesContent>();

        if (QuestionTextArea.Value != "")
        {
            omls = GetObjectiveData();

            Qs.Objectives = omls.ToArray();

            ViewState["QuestObjectives"] = Qs.Objectives;

            DataBase.QuestionStructure Qs2 = new DataBase.QuestionStructure();
            int QuestionType = 3;

            Qs2.QuestionNumber = CurrentNumber;
            Qs2.Question       = ViewState["Questionaire"].ToString();

            switch (QuestionTypeDropDown.SelectedValue)
            {
            case "Objectives":
                QuestionType = 1;
                break;

            case "Structured":
                QuestionType = 2;
                break;

            case "Mixed Mode":
                QuestionType = 3;
                break;
            }

            Qs2.QuestionType = QuestionType;

            Qs2.Objectives = (object[])ViewState["QuestObjectives"];

            Questions.CaptureQuestionData(Qs2);
        }

        ViewState["QNumber"] = MoveNext(CurrentNumber);

        LoadData(Convert.ToInt32(ViewState["QNumber"]), SectionNumber);
    }
コード例 #5
0
    public static DataBase.QuestionStructure RetrieveData(int QuestionNumber, int Section)
    {
        DataBase.Questions Questions = new DataBase.Questions("TST008/005");

        DataBase.Questions.ObjectivesContent ObjCont = new DataBase.Questions.ObjectivesContent();
        DataBase.QuestionStructure           Qs      = new DataBase.QuestionStructure();

        Questions.RetrieveData(QuestionNumber, Section);
        Qs.QuestionNumber = Questions.QuestionSructure.QuestionNumber;

        Qs.Question     = Questions.QuestionSructure.Question;
        Qs.QuestionType = Questions.QuestionSructure.QuestionType;
        Qs.Objectives   = Questions.QuestionSructure.Objectives;

        return(Qs);
    }