示例#1
0
        public void UpdateMCQ_Exam(MCQ_Exam objMCQ_Exam)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("UpdateMCQ_Exam");
                    command.CommandType = CommandType.StoredProcedure;

                    database.AddInParameter(command, "@ExamID", DbType.Int64, objMCQ_Exam.ExamID);
                    database.AddInParameter(command, "@ExamTitle", DbType.String, objMCQ_Exam.ExamTitle);
                    database.AddInParameter(command, "@ExamDescription", DbType.String, objMCQ_Exam.ExamDescription);
                    database.AddInParameter(command, "@IsActive", DbType.Boolean, objMCQ_Exam.IsActive);
                    database.AddInParameter(command, "@CourseID", DbType.Int64, objMCQ_Exam.CourseID);
                    database.AddInParameter(command, "@ExamDuration", DbType.Int32, objMCQ_Exam.ExamDuration);
                    database.AddInParameter(command, "@PassPercentage", DbType.Decimal, objMCQ_Exam.PassPercentage);
                    database.AddInParameter(command, "@DesignationID", DbType.String, objMCQ_Exam.DesignationID);

                    database.ExecuteNonQuery(command);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private MCQ_Exam GetMCQ_Exam()
        {
            MCQ_Exam objMCQ_Exam = new MCQ_Exam();

            objMCQ_Exam.ExamID          = this.ExamID;
            objMCQ_Exam.CourseID        = 0;
            objMCQ_Exam.DesignationID   = Convert.ToInt32(ddlDesignation.SelectedValue);
            objMCQ_Exam.ExamDescription = txtDescription.Text.Trim();
            objMCQ_Exam.ExamDuration    = Convert.ToInt32(txtDuration.Text.Trim());
            objMCQ_Exam.ExamTitle       = txtTitle.Text.Trim();
            objMCQ_Exam.IsActive        = chkActive.Checked;
            objMCQ_Exam.PassPercentage  = (float)Convert.ToDecimal(txtPassPercentage.Text.Trim());
            return(objMCQ_Exam);
        }
        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);
        }
 public void UpdateMCQ_Exam(MCQ_Exam objMCQ_Exam)
 {
     AptitudeTestDAL.Instance.UpdateMCQ_Exam(objMCQ_Exam);
 }
 public long InsertMCQ_Exam(MCQ_Exam objMCQ_Exam)
 {
     return(AptitudeTestDAL.Instance.InsertMCQ_Exam(objMCQ_Exam));
 }
示例#6
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);
                        }
                    }
                }
            }
        }