protected void SubmitQuestions_Click(object sender, EventArgs e)
    {
        if (OptionA.Checked)
        {
            answercheck = "A";
        }
        else if (OptionB.Checked)
        {
            answercheck = "B";
        }
        else if (OptionC.Checked)
        {
            answercheck = "C";
        }
        else if (OptionD.Checked)
        {
            answercheck = "D";
        }
        else
        {
            answercheck = "N";
        }

        UserBO ob = new UserBO();

        ob.coursecode = Session["CourseSelected"].ToString();

        clsBLL    logicob       = new clsBLL();
        DataTable questiontable = logicob.QuestionTableCreatorBLL(ob);

        logicob.updateAnsweredBLL(rowno, answercheck, Session["CourseSelected"].ToString());

        Session["questioncount"] = countofQuestions;
        Response.Redirect("UserPresentTestCalculus.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserBO ob = new UserBO();

        ob.coursecode = Session["AdminSelectedUserCourse"].ToString();
        ob.userid     = Session["AdminSelectedUser"].ToString();



        clsBLL        obj    = new clsBLL();
        List <string> mylist = obj.getScoreDetailsBLL(ob);

        DataTable questiontable    = obj.QuestionTableCreatorBLL(ob);
        int       countofQuestions = questiontable.Rows.Count;

        int a;

        try { a = Convert.ToInt32((Convert.ToDouble(mylist[3]) / countofQuestions) * 100); } catch { a = 0; }

        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "draw(" + a + ")", true);

        userid.Text     = mylist[0];
        Coursecode.Text = mylist[1];
        date.Text       = mylist[2];
        score.Text      = "(" + mylist[3] + "/" + countofQuestions.ToString() + ")";
        Percentage.Text = a.ToString();
        status.Text     = mylist[4];
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            UserBO ob = new UserBO();

            try
            {
                ob.userid     = Session["User"].ToString();
                ob.coursecode = Session["CourseSelected"].ToString();
            }
            catch
            {
                Response.Redirect("UserMain.aspx");
            }
            clsBLL logicob = new clsBLL();
            if (logicob.iscourseopenedBLL(ob) == "Y")
            {
                DataTable questiontable = logicob.QuestionTableCreatorBLL(ob);
                countofQuestions = questiontable.Rows.Count;
                if (countofQuestions > 0)
                {
                    startingQuestion = 1;
                    rowno            = startingQuestion - 1;
                    displayQuestion(questiontable);
                }
                else
                {
                    QuestionText.Text = "Sorry There are no questions for this course";
                }

                test.DataSource = questiontable;
                test.DataBind();
                SubmitQuestions.Visible = false;
            }
            else
            {
                Response.Redirect("UserMain.aspx");
            }
        }
    }
    protected void leftindicpicbutton_Click(object sender, EventArgs e)
    {
        rowno = startingQuestion - 2;
        startingQuestion--;
        if (startingQuestion < 1)
        {
            Response.Write("<script>alert('You cannot go back');</script>");
        }
        else
        {
            UserBO ob = new UserBO();
            ob.coursecode = Session["CourseSelected"].ToString();

            clsBLL    logicob       = new clsBLL();
            DataTable questiontable = logicob.QuestionTableCreatorBLL(ob);

            displayQuestion(questiontable);

            if (OptionA.Checked)
            {
                OptionA.Checked = false;
            }
            else if (OptionB.Checked)
            {
                OptionB.Checked = false;
            }
            else if (OptionC.Checked)
            {
                OptionC.Checked = false;
            }
            else if (OptionD.Checked)
            {
                OptionD.Checked = false;
            }
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserBO ob  = new UserBO();
        clsBLL obj = new clsBLL();

        ob.userid           = Session["User"].ToString();
        ob.coursecode       = Session["CourseSelected"].ToString();
        ob.maxquestioncount = Session["questioncount"].ToString();

        int score_achieved = Convert.ToInt32(obj.scorecardBLL(ob));

        ob.score = score_achieved.ToString();

        StatusBar.Text = score_achieved.ToString() + " / " + ob.maxquestioncount.ToString();

        DataTable questiontable = obj.QuestionTableCreatorBLL(ob);

        afterAnswered.DataSource = questiontable;
        afterAnswered.DataBind();

        int myavg = (score_achieved / Convert.ToInt32(Session["questioncount"])) * 100;

        if (myavg > passgrade)
        {
            ob.status = "passed";
        }
        else
        {
            ob.status = "Progress";
        }

        ob.completiondate = DateTime.Today.ToString("dd-MM-yyyy");


        obj.updateStatusBLL(ob);
    }
    protected void rightindicpicbutton_Click(object sender, EventArgs e)
    {
        rowno = startingQuestion - 1;
        startingQuestion++;
        if (startingQuestion > countofQuestions)
        {
            Response.Write("<script>alert('You are completed with your Questions click on submit');</script>");
            SubmitQuestions.Visible = true;
        }
        else
        {
            if (OptionA.Checked)
            {
                answercheck = "A";
            }
            else if (OptionB.Checked)
            {
                answercheck = "B";
            }
            else if (OptionC.Checked)
            {
                answercheck = "C";
            }
            else if (OptionD.Checked)
            {
                answercheck = "D";
            }
            else
            {
                answercheck = "N";
            }

            UserBO ob = new UserBO();
            ob.coursecode = Session["CourseSelected"].ToString();

            clsBLL    logicob       = new clsBLL();
            DataTable questiontable = logicob.QuestionTableCreatorBLL(ob);

            StatusBar.Text = questiontable.Rows[rowno][7].ToString();

            logicob.updateAnsweredBLL(rowno, answercheck, Session["CourseSelected"].ToString());

            displayQuestion(questiontable);

            if (OptionA.Checked)
            {
                OptionA.Checked = false;
            }
            else if (OptionB.Checked)
            {
                OptionB.Checked = false;
            }
            else if (OptionC.Checked)
            {
                OptionC.Checked = false;
            }
            else if (OptionD.Checked)
            {
                OptionD.Checked = false;
            }
        }
    }