private static void SaveMCQOptions(long QuestionID, Repeater repOptions)
        {
            foreach (RepeaterItem riOptions in repOptions.Items)
            {
                MCQ_Option objMCQ_Option = new MCQ_Option();
                objMCQ_Option.OptionID   = Convert.ToInt64((riOptions.FindControl("hdnOptionID") as HiddenField).Value.Trim());
                objMCQ_Option.OptionText = (riOptions.FindControl("txtOptionText") as TextBox).Text.Trim();
                objMCQ_Option.QuestionID = QuestionID;

                if (objMCQ_Option.OptionID > 0)
                {
                    AptitudeTestBLL.Instance.UpdateMCQ_Option(objMCQ_Option);


                    HtmlInputHidden hdnIsAnswer = (riOptions.FindControl("hdnIsAnswer") as HtmlInputHidden);

                    if (hdnIsAnswer != null && hdnIsAnswer.Value.Equals("1"))
                    {
                        AptitudeTestBLL.Instance.UpdateMCQ_CorrectAnswer(objMCQ_Option);
                    }
                }
                else
                {
                    objMCQ_Option.OptionID = AptitudeTestBLL.Instance.InsertMCQ_Option(objMCQ_Option);

                    HtmlInputHidden hdnIsAnswer = (riOptions.FindControl("hdnIsAnswer") as HtmlInputHidden);

                    if (hdnIsAnswer != null && hdnIsAnswer.Value.Equals("1"))
                    {
                        AptitudeTestBLL.Instance.InsertMCQ_CorrectAnswer(objMCQ_Option);
                    }
                }
            }
        }
예제 #2
0
        public void UpdateMCQ_CorrectAnswer(MCQ_Option objMCQ_Option)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("UpdateMCQ_CorrectAnswer");
                    command.CommandType = CommandType.StoredProcedure;

                    database.AddInParameter(command, "@OptionID", DbType.String, objMCQ_Option.OptionID);
                    database.AddInParameter(command, "@QuestionID", DbType.Int64, objMCQ_Option.QuestionID);

                    database.ExecuteNonQuery(command);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public long InsertMCQ_CorrectAnswer(MCQ_Option objMCQ_Option)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("InsertMCQ_CorrectAnswer");
                    command.CommandType = CommandType.StoredProcedure;

                    database.AddInParameter(command, "@OptionText", DbType.String, objMCQ_Option.OptionText);
                    database.AddInParameter(command, "@QuestionID", DbType.Int64, objMCQ_Option.QuestionID);

                    return(Convert.ToInt64(database.ExecuteScalar(command)));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btnSaveExam_Click(object sender, EventArgs e)
        {
            MCQ_Exam objMCQ_Exam = GetMCQ_Exam();

            #region MCQ_Exam

            if (objMCQ_Exam.ExamID > 0)
            {
                AptitudeTestBLL.Instance.UpdateMCQ_Exam(objMCQ_Exam);
            }
            else
            {
                objMCQ_Exam.ExamID = AptitudeTestBLL.Instance.InsertMCQ_Exam(objMCQ_Exam);
            }

            #endregion

            foreach (RepeaterItem riQuestion in repQuestions.Items)
            {
                #region MCQ_Question

                MCQ_Question objMCQ_Question = new MCQ_Question();
                objMCQ_Question.ExamID        = objMCQ_Exam.ExamID;
                objMCQ_Question.QuestionID    = Convert.ToInt64((riQuestion.FindControl("hdnQuestionID") as HiddenField).Value.Trim());
                objMCQ_Question.Question      = (riQuestion.FindControl("txtQuestion") as TextBox).Text.Trim();
                objMCQ_Question.PositiveMarks = Convert.ToInt64((riQuestion.FindControl("txtPositiveMarks") as TextBox).Text.Trim());
                objMCQ_Question.NegetiveMarks = Convert.ToInt64((riQuestion.FindControl("txtNegetiveMarks") as TextBox).Text.Trim());
                objMCQ_Question.QuestionType  = 1;

                if (objMCQ_Question.QuestionID > 0)
                {
                    AptitudeTestBLL.Instance.UpdateMCQ_Question(objMCQ_Question);
                }
                else
                {
                    objMCQ_Question.QuestionID = AptitudeTestBLL.Instance.InsertMCQ_Question(objMCQ_Question);
                }

                #endregion

                Repeater repOptions = (riQuestion.FindControl("repOptions") as Repeater);

                foreach (RepeaterItem riOptions in repOptions.Items)
                {
                    #region MCQ_Option & Answer

                    MCQ_Option objMCQ_Option = new MCQ_Option();
                    objMCQ_Option.OptionID   = Convert.ToInt64((riOptions.FindControl("hdnOptionID") as HiddenField).Value.Trim());
                    objMCQ_Option.OptionText = (riOptions.FindControl("txtOptionText") as TextBox).Text.Trim();
                    objMCQ_Option.QuestionID = objMCQ_Question.QuestionID;

                    if (objMCQ_Option.OptionID > 0)
                    {
                        AptitudeTestBLL.Instance.UpdateMCQ_Option(objMCQ_Option);

                        HtmlInputHidden hdnIsAnswer = (HtmlInputHidden)riOptions.FindControl("hdnIsAnswer");

                        if (hdnIsAnswer.Value.Equals("1"))
                        {
                            AptitudeTestBLL.Instance.UpdateMCQ_CorrectAnswer(objMCQ_Option);
                        }
                    }
                    else
                    {
                        objMCQ_Option.OptionID = AptitudeTestBLL.Instance.InsertMCQ_Option(objMCQ_Option);

                        HtmlInputHidden hdnIsAnswer = (HtmlInputHidden)riOptions.FindControl("hdnIsAnswer");

                        if (hdnIsAnswer.Value.Equals("1"))
                        {
                            AptitudeTestBLL.Instance.InsertMCQ_CorrectAnswer(objMCQ_Option);
                        }
                    }

                    #endregion
                }
            }

            Response.Redirect("~/sr_app/view-aptitude-test.aspx?ExamID=" + objMCQ_Exam.ExamID);
        }
예제 #5
0
 public void UpdateMCQ_CorrectAnswer(MCQ_Option objMCQ_Option)
 {
     AptitudeTestDAL.Instance.UpdateMCQ_CorrectAnswer(objMCQ_Option);
 }
예제 #6
0
 public long InsertMCQ_CorrectAnswer(MCQ_Option objMCQ_Option)
 {
     return(AptitudeTestDAL.Instance.InsertMCQ_CorrectAnswer(objMCQ_Option));
 }
예제 #7
0
 public void UpdateMCQ_Option(MCQ_Option objMCQ_Option)
 {
     AptitudeTestDAL.Instance.UpdateMCQ_Option(objMCQ_Option);
 }
예제 #8
0
 public long InsertMCQ_Option(MCQ_Option objMCQ_Option)
 {
     return(AptitudeTestDAL.Instance.InsertMCQ_Option(objMCQ_Option));
 }
예제 #9
0
        protected void btnSaveExam_Click(object sender, EventArgs e)
        {
            MCQ_Exam objMCQ_Exam = GetMCQ_Exam();

            if (objMCQ_Exam.ExamID > 0)
            {
                AptitudeTestBLL.Instance.UpdateMCQ_Exam(objMCQ_Exam);
            }
            else
            {
                objMCQ_Exam.ExamID = AptitudeTestBLL.Instance.InsertMCQ_Exam(objMCQ_Exam);
            }

            foreach (RepeaterItem riQuestion in repQuestions.Items)
            {
                MCQ_Question objMCQ_Question = new MCQ_Question();
                objMCQ_Question.ExamID        = objMCQ_Exam.ExamID;
                objMCQ_Question.QuestionID    = Convert.ToInt64((riQuestion.FindControl("hdnQuestionID") as HiddenField).Value.Trim());
                objMCQ_Question.Question      = (riQuestion.FindControl("txtQuestion") as TextBox).Text.Trim();
                objMCQ_Question.PositiveMarks = Convert.ToInt64((riQuestion.FindControl("txtPositiveMarks") as TextBox).Text.Trim());
                objMCQ_Question.NegetiveMarks = Convert.ToInt64((riQuestion.FindControl("txtNegetiveMarks") as TextBox).Text.Trim());
                objMCQ_Question.QuestionType  = 1;

                if (objMCQ_Question.QuestionID > 0)
                {
                    AptitudeTestBLL.Instance.UpdateMCQ_Question(objMCQ_Question);
                }
                else
                {
                    objMCQ_Question.QuestionID = AptitudeTestBLL.Instance.InsertMCQ_Question(objMCQ_Question);
                }

                Repeater repOptions = (riQuestion.FindControl("repOptions") as Repeater);

                foreach (RepeaterItem riOptions in repOptions.Items)
                {
                    MCQ_Option objMCQ_Option = new MCQ_Option();
                    objMCQ_Option.OptionID   = Convert.ToInt64((riOptions.FindControl("hdnOptionID") as HiddenField).Value.Trim());
                    objMCQ_Option.OptionText = (riOptions.FindControl("txtOptionText") as TextBox).Text.Trim();
                    objMCQ_Option.QuestionID = objMCQ_Question.QuestionID;

                    if (objMCQ_Option.OptionID > 0)
                    {
                        AptitudeTestBLL.Instance.UpdateMCQ_Option(objMCQ_Option);

                        if ((riOptions.FindControl("rdoIsAnswer") as RadioButton).Checked)
                        {
                            AptitudeTestBLL.Instance.UpdateMCQ_CorrectAnswer(objMCQ_Option);
                        }
                    }
                    else
                    {
                        objMCQ_Option.OptionID = AptitudeTestBLL.Instance.InsertMCQ_Option(objMCQ_Option);

                        if ((riOptions.FindControl("rdoIsAnswer") as RadioButton).Checked)
                        {
                            AptitudeTestBLL.Instance.InsertMCQ_CorrectAnswer(objMCQ_Option);
                        }
                    }
                }
            }
        }