Beispiel #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        int examDuration = Convert.ToInt32(ddlExamHour.SelectedValue) * 60 + Convert.ToInt32(ddlExamMin.SelectedValue);
            if (examDuration == 0)
                examDuration = 120;
            DateTime examStartTime = DateTime.Now;
            bool isRetake = false;// cbIsRetake.Checked;
            int courseID = Convert.ToInt32(ddlCourseID.SelectedValue);
            int subjectID = Convert.ToInt32(ddlSubjectID.SelectedValue);
            int chapterID = 0;      // Convert.ToInt32(ddlChapterID.SelectedValue);

            Quiz_Exam qe = new Quiz_Exam(0, ddlCourseID.SelectedItem.Text + " - " + ddlSubjectID.SelectedItem.Text + " - " + txtExamName.Text, courseID, subjectID, chapterID, examDuration, examStartTime,
                        isRetake, true, Profile.card_id.ToString(), DateTime.Now, Profile.card_id, DateTime.Now);
            int examID = Quiz_ExamManager.InsertQuiz_Exam(qe);

        //    Quiz_Exam quiz_Exam = new Quiz_Exam ();
        ////	quiz_Exam.ExamID=  int.Parse(ddlExamID.SelectedValue);
        //    quiz_Exam.ExamName=  txtExamName.Text;
        //    quiz_Exam.CourseID=  int.Parse(ddlCourseID.SelectedValue);
        //    quiz_Exam.SubjectID=  int.Parse(ddlSubjectID.SelectedValue);
        //    quiz_Exam.ChapterID=  int.Parse(ddlChapterID.SelectedValue);
        //    quiz_Exam.ExamTimeDuration=  int.Parse(txtExamTimeDuration.Text);
        //    quiz_Exam.ExamStartTime=   DateTime.Parse(txtExamStartTime.Text);
        //    quiz_Exam.IsRetake=  bool.Parse( radIsRetake.SelectedValue);
        //    quiz_Exam.IsActive=  bool.Parse( radIsActive.SelectedValue);
        //    quiz_Exam.AddedBy=  txtAddedBy.Text;
        //    quiz_Exam.AddedDate=  DateTime.Now;
        //    quiz_Exam.ModifiedBy=  "530038e1-cf38-4ddb-84a4-99b6974b4f9d";
        //    quiz_Exam.ModifiedDate=  DateTime.Now;
        //    int resutl =Quiz_ExamManager.InsertQuiz_Exam(quiz_Exam);
        Response.Redirect("AdminDisplayQuiz_Exam.aspx");
    }
Beispiel #2
0
 public static Quiz_Exam GetQuiz_ExamByExamID(int ExamID)
 {
     Quiz_Exam quiz_Exam = new Quiz_Exam();
     SqlQuiz_ExamProvider sqlQuiz_ExamProvider = new SqlQuiz_ExamProvider();
     quiz_Exam = sqlQuiz_ExamProvider.GetQuiz_ExamByExamID(ExamID);
     return quiz_Exam;
 }
Beispiel #3
0
 public static Quiz_Exam GetHR_CourseByCourseID(int CourseID)
 {
     Quiz_Exam quiz_Exam = new Quiz_Exam();
     SqlQuiz_ExamProvider sqlQuiz_ExamProvider = new SqlQuiz_ExamProvider();
     quiz_Exam = sqlQuiz_ExamProvider.GetQuiz_ExamByCourseID(CourseID);
     return quiz_Exam;
 }
Beispiel #4
0
 public static Quiz_Exam GetHR_ChapterByChapterID(int ChapterID)
 {
     Quiz_Exam quiz_Exam = new Quiz_Exam();
     SqlQuiz_ExamProvider sqlQuiz_ExamProvider = new SqlQuiz_ExamProvider();
     quiz_Exam = sqlQuiz_ExamProvider.GetQuiz_ExamByChapterID(ChapterID);
     return quiz_Exam;
 }
Beispiel #5
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Quiz_Exam quiz_Exam = new Quiz_Exam ();
        quiz_Exam = Quiz_ExamManager.GetQuiz_ExamByExamID(Int32.Parse(Request.QueryString["ID"]));
        quiz_Exam.ExamName=  txtExamName.Text;
        quiz_Exam.CourseID=  int.Parse(ddlCourseID.SelectedValue);
        quiz_Exam.SubjectID=  int.Parse(ddlSubjectID.SelectedValue);
        quiz_Exam.ChapterID=  int.Parse(ddlChapterID.SelectedValue);
        quiz_Exam.ModifiedBy= Profile.card_id;
        quiz_Exam.ModifiedDate=  DateTime.Now;
        int examDuration = Convert.ToInt32(ddlExamHour.SelectedValue) * 60 + Convert.ToInt32(ddlExamMin.SelectedValue);
        if (examDuration == 0)
        examDuration = 120;

        quiz_Exam.ExamTimeDuration = examDuration;

        bool  resutl =Quiz_ExamManager.UpdateQuiz_Exam(quiz_Exam);
        Response.Redirect("AdminDisplayQuiz_Exam.aspx");
    }
Beispiel #6
0
    public bool UpdateQuiz_Exam(Quiz_Exam quiz_Exam)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateQuiz_Exam", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ExamID", SqlDbType.Int).Value = quiz_Exam.ExamID;
            cmd.Parameters.Add("@ExamName", SqlDbType.NVarChar).Value = quiz_Exam.ExamName;
            cmd.Parameters.Add("@CourseID", SqlDbType.Int).Value = quiz_Exam.CourseID;
            cmd.Parameters.Add("@SubjectID", SqlDbType.Int).Value = quiz_Exam.SubjectID;
            cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = quiz_Exam.ChapterID;
            cmd.Parameters.Add("@ExamTimeDuration", SqlDbType.Int).Value = quiz_Exam.ExamTimeDuration;
            cmd.Parameters.Add("@ExamStartTime", SqlDbType.DateTime).Value = quiz_Exam.ExamStartTime;
            cmd.Parameters.Add("@IsRetake", SqlDbType.Bit).Value = quiz_Exam.IsRetake;
            cmd.Parameters.Add("@IsActive", SqlDbType.Bit).Value = quiz_Exam.IsActive;
            cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = quiz_Exam.ModifiedBy;
            cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = quiz_Exam.ModifiedDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Beispiel #7
0
    public Quiz_Exam GetQuiz_ExamFromReader(IDataReader reader)
    {
        try
        {
            Quiz_Exam quiz_Exam = new Quiz_Exam
                (

                     DataAccessObject.IsNULL<int>(reader["ExamID"]),
                     DataAccessObject.IsNULL<string>(reader["ExamName"]),
                     DataAccessObject.IsNULL<int>(reader["CourseID"]),
                     DataAccessObject.IsNULL<int>(reader["SubjectID"]),
                     DataAccessObject.IsNULL<int>(reader["ChapterID"]),
                     DataAccessObject.IsNULL<int>(reader["ExamTimeDuration"]),
                     DataAccessObject.IsNULL<DateTime>(reader["ExamStartTime"]),
                     DataAccessObject.IsNULL<bool>(reader["IsRetake"]),
                     DataAccessObject.IsNULL<bool>(reader["IsActive"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"]),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["ModifiedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["ModifiedDate"])
                );
             return quiz_Exam;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
Beispiel #8
0
    private void showQuiz_ExamData()
    {
        Quiz_Exam quiz_Exam  = new Quiz_Exam ();
         	quiz_Exam = Quiz_ExamManager.GetQuiz_ExamByExamID(Int32.Parse(Request.QueryString["ID"]));
         	txtExamName.Text =quiz_Exam.ExamName.ToString();
         	ddlCourseID.SelectedValue  =quiz_Exam.CourseID.ToString();
        ddlCourseID_SelectedIndexChanged(this, new EventArgs());
        ddlSubjectID.SelectedValue = quiz_Exam.SubjectID.ToString();
        ddlSubjectID_SelectedIndexChanged(this, new EventArgs());
         	ddlChapterID.SelectedValue  =quiz_Exam.ChapterID.ToString();

        ddlExamHour.SelectedValue = (quiz_Exam.ExamTimeDuration / 60).ToString();
        ddlExamMin.SelectedValue = (quiz_Exam.ExamTimeDuration % 60).ToString();
    }
Beispiel #9
0
 public static int InsertQuiz_Exam(Quiz_Exam quiz_Exam)
 {
     SqlQuiz_ExamProvider sqlQuiz_ExamProvider = new SqlQuiz_ExamProvider();
     return sqlQuiz_ExamProvider.InsertQuiz_Exam(quiz_Exam);
 }
Beispiel #10
0
 public static bool UpdateQuiz_Exam(Quiz_Exam quiz_Exam)
 {
     SqlQuiz_ExamProvider sqlQuiz_ExamProvider = new SqlQuiz_ExamProvider();
     return sqlQuiz_ExamProvider.UpdateQuiz_Exam(quiz_Exam);
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            #region Begin Insert Exam
            int examDuration = Convert.ToInt32(ddlExamHour.SelectedValue) * 60 + Convert.ToInt32(ddlExamMin.SelectedValue);
            if (examDuration == 0)
                examDuration = 120;
            DateTime examStartTime = DateTime.Now;
            bool isRetake = false;// cbIsRetake.Checked;
            int courseID = Convert.ToInt32(ddlCourseID.SelectedValue);
            int subjectID = Convert.ToInt32(ddlSubjectID.SelectedValue);
            int chapterID = 0;      // Convert.ToInt32(ddlChapterID.SelectedValue);

            Quiz_Exam qe = new Quiz_Exam(0, txtExamName.Text, courseID, subjectID, chapterID, examDuration, examStartTime,
                        isRetake, true, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
            int examID = Quiz_ExamManager.InsertQuiz_Exam(qe);

            #endregion End Insert Exam

            #region Begin Exam Details
            if (examID > 0)
            {
                foreach (GridViewRow row in gvQuiz_nc_TrueFalse.Rows)
                {
                    int trueFalseID = Convert.ToInt32(((HiddenField)row.FindControl("hfTrueFalseID")).Value);
                    Quiz_ExamQuestionDetails qe_Details = new Quiz_ExamQuestionDetails(0, examID, (int)Enums.QuestionTypes.TrueFalse,
                            trueFalseID, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
                    Quiz_ExamQuestionDetailsManager.InsertQuiz_ExamQuestionDetails(qe_Details);
                }

                foreach (GridViewRow row in gvQuiz_nc_gvDrCr.Rows)
                {
                    int drCrID = Convert.ToInt32(((HiddenField)row.FindControl("hfDrCrID")).Value);
                    Quiz_ExamQuestionDetails qe_Details = new Quiz_ExamQuestionDetails(0, examID, (int)Enums.QuestionTypes.DrCr,
                            drCrID, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
                    Quiz_ExamQuestionDetailsManager.InsertQuiz_ExamQuestionDetails(qe_Details);
                }

                foreach (GridViewRow row in gvQuiz_nc_FillInTheBlanks.Rows)
                {
                    int fillInTheBlanksID = Convert.ToInt32(((Label)row.FindControl("lblFillInTheBlanksID")).Text);
                    Quiz_ExamQuestionDetails qe_Details = new Quiz_ExamQuestionDetails(0, examID, (int)Enums.QuestionTypes.FillInTheBlanks,
                            fillInTheBlanksID, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
                    Quiz_ExamQuestionDetailsManager.InsertQuiz_ExamQuestionDetails(qe_Details);
                }

                foreach (GridViewRow row in gvQuiz_nc_MultipleQuestion.Rows)
                {
                    Label lblMcqID = (Label)row.FindControl("lblMultipleQustionID");
                    int mcqID = Convert.ToInt32(lblMcqID.Text);
                    Quiz_ExamQuestionDetails qe_Details = new Quiz_ExamQuestionDetails(0, examID, (int)Enums.QuestionTypes.MCQ,
                            mcqID, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
                    Quiz_ExamQuestionDetailsManager.InsertQuiz_ExamQuestionDetails(qe_Details);
                }

                foreach (GridViewRow row in gvQuiz_Comprehension.Rows)
                {
                    int comprehensionID = Convert.ToInt32(((Label)row.FindControl("lblComprehensionID")).Text);
                    Quiz_ExamQuestionDetails qe_Details = new Quiz_ExamQuestionDetails(0, examID, (int)Enums.QuestionTypes.Comprehension,
                                comprehensionID, "User", DateTime.Now,  Profile.card_id, DateTime.Now);
                    Quiz_ExamQuestionDetailsManager.InsertQuiz_ExamQuestionDetails(qe_Details);
                }
            }
            #endregion End Exam Details
        }
        catch (Exception ex)
        {
        }
    }