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
        {
        }
    }
    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);
    }
    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);
    }
    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);
    }
示例#5
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);
    }
示例#6
0
    public void CaptureQuestionData(DataBase.QuestionStructure QStruct)
    {
        Questions = new DataBase.Questions(this.TestCode);

        Questions.CaptureQuestionData(QStruct);
    }
示例#7
0
        public void CaptureQuestionData(DataBase.QuestionStructure Qs)
        {
            using (var Con = new SqlConnection(GC.ConnectionString))
            {
                Con.Open();

                string Query = "[dbo].[CaptureQuestion]";

                using (var com = new SqlCommand(Query, Con))
                {
                    com.CommandType = CommandType.StoredProcedure;

                    com.Parameters.Add(new SqlParameter("@ExamCode", this.TestCode));
                    com.Parameters.Add(new SqlParameter("@QuestionType", Qs.QuestionType));
                    com.Parameters.Add(new SqlParameter("@QuestionNumber", Qs.QuestionNumber));
                    com.Parameters.Add(new SqlParameter("@Question", Qs.Question));
                    com.Parameters.Add(new SqlParameter("@imagepath", null));
                    com.Parameters.Add(new SqlParameter("@SectionNumber", 1));

                    com.ExecuteNonQuery();

                    com.Dispose();
                }

                Con.Close();
            }

            if (Qs.QuestionType == 2)
            {
            }

            else
            {
                foreach (ObjectivesContent OC in Qs.Objectives)
                {
                    using (var con = new SqlConnection(GC.ConnectionString))
                    {
                        con.Open();

                        string query = "[dbo].[CaptureObjective]";

                        using (var com = new SqlCommand(query, con))
                        {
                            com.CommandType = CommandType.StoredProcedure;


                            com.Parameters.Add(new SqlParameter("@objective_id", OC.ObjID));
                            com.Parameters.Add(new SqlParameter("@ExamCode", this.TestCode));
                            com.Parameters.Add(new SqlParameter("@qtn_number", Qs.QuestionNumber));
                            com.Parameters.Add(new SqlParameter("@detail", OC.Detail));
                            com.Parameters.Add(new SqlParameter("@validity", OC.validity));

                            com.ExecuteNonQuery();

                            com.Dispose();
                        }
                        con.Close();
                    }
                }
            }
        }