コード例 #1
0
        protected void btnEnd_Click(object sender, EventArgs e)
        {
            myDal.ClearParams();
            myDal.AddParam("@IssuedQuizId", lblIssuedQuizId.Text);
            myDal.AddParam("@MentorId", HttpContext.Current.Session["Userid"].ToString());
            myDal.AddParam("@Action", "CloseQuiz");
            DataSet ds = myDal.ExecuteProcedure("SD18EXAM_spActionQuiz");

            if (ds.Tables.Count != 0)//not null
            {
                switch (ds.Tables[0].Rows[0]["status"].ToString())
                {
                case "closeSuccess":
                    Response.Write("<SCRIPT>alert('Quiz Closed')</SCRIPT>");
                    break;

                case "InvalidQuiz":
                    Response.Write("<SCRIPT>alert('Cannot close this because it is invalid Quiz')</SCRIPT>");
                    break;

                case "userlevelNotEnough":
                    Response.Write("<SCRIPT>alert('User Account level is not enough!')</SCRIPT>");
                    break;

                default:
                    Response.Write("<SCRIPT>alert('Error(s) Found.')</SCRIPT>");
                    break;
                }
            }
            PopUpQuizAction(Convert.ToInt32(lblIssuedQuizId.Text));
            MPEQuizAction.Show();
            LoadQuizStatus();
        }
コード例 #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];

            if (confirmValue == "Yes")
            {
                myDal.ClearParams();
                myDal.AddParam("@IssuedQuizId", lblIssuedQuizId.Text);
                myDal.AddParam("@MentorId", HttpContext.Current.Session["Userid"].ToString());
                myDal.AddParam("@Action", "DeleteQuiz");
                DataSet ds = myDal.ExecuteProcedure("SD18EXAM_spActionQuiz");
                if (ds.Tables.Count != 0)//not null
                {
                    switch (ds.Tables[0].Rows[0]["status"].ToString())
                    {
                    case "QuizDeleted":
                        Response.Write("<SCRIPT>alert('Quiz Deleted')</SCRIPT>");
                        break;

                    case "QuizNotFound":
                        Response.Write("<SCRIPT>alert('Cannot Delete this because it is invalid Quiz')</SCRIPT>");
                        break;

                    default:
                        Response.Write("<SCRIPT>alert('Error(s) Found.')</SCRIPT>");
                        break;
                    }
                }
            }
            else
            {
                MPEQuizAction.Show();
            }
            LoadQuizStatus();
        }
コード例 #3
0
        private void PopUpQuizAction(int IssuedQuizId)
        {
            if (IssuedQuizId != -1)
            {
                myDal.ClearParams();
                myDal.AddParam("@IssuedQuizId", IssuedQuizId.ToString());
                DataSet ds = myDal.ExecuteProcedure("SD18EXAM_spgetIssuedQuizDetails");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    lblIssuedQuizId.Text = ds.Tables[0].Rows[0]["IssuedQuizId"].ToString();
                    lblTitle.Text        = ds.Tables[0].Rows[0]["Title"].ToString();
                    lblTime.Text         = ds.Tables[0].Rows[0]["Time"].ToString();
                    lblClass.Text        = ds.Tables[0].Rows[0]["Classname"].ToString();
                    lblStatus.Text       = ds.Tables[0].Rows[0]["StatusName"].ToString();

                    //load Student
                    //ddlActionQuizStudent
                    myDal.ClearParams();
                    myDal.AddParam("@IssuedQuizId", IssuedQuizId);
                    ddlActionQuizStudent.DataSource     = myDal.ExecuteProcedure("SD18EXAM_spGetStudentsFromIssuedQuizID");
                    ddlActionQuizStudent.DataTextField  = "Name";
                    ddlActionQuizStudent.DataValueField = "QuizStudentid";
                    ddlActionQuizStudent.DataBind();
                    ddlActionQuizStudent.Items.Insert(0, new ListItem("Please select", "-1"));


                    //SD18EXAM_spGetStudentResponseDetails
                    MPEQuizAction.Show();
                }
            }
        }
コード例 #4
0
 protected void ddlActionQuizStudent_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlActionQuizStudent.SelectedIndex != -1 || ddlActionQuizStudent.SelectedValue != "-1")
     {
         myDal.ClearParams();
         myDal.AddParam("@QuizStudentid", ddlActionQuizStudent.SelectedValue.ToString());
         DataSet ds = myDal.ExecuteProcedure("SD18EXAM_spStudentQuizInfoUser");
         ddlActionQuizStudent.SelectedIndex = ddlActionQuizStudent.Items.IndexOf(ddlActionQuizStudent.Items.FindByText(ds.Tables[0].Rows[0]["StatusName"].ToString()));
     }
     MPEQuizAction.Show();
 }