Exemplo n.º 1
0
        protected void pledgeCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            GridViewRow row                  = (sender as CheckBox).Parent.Parent as GridViewRow;
            int         studentID            = Int32.Parse(AllStudentsGridview.DataKeys[row.RowIndex].Values[0].ToString());
            CheckBox    PledgeSignedCheckBox = (CheckBox)sender;
            bool        PledgeSigned         = PledgeSignedCheckBox.Checked;
            string      constr               = ConfigurationManager.ConnectionStrings["CS414_FasTestConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand("Change_Pledge_Signed_Grading"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pSigned", PledgeSigned);
                    cmd.Parameters.AddWithValue("@pStudentID", studentID);
                    cmd.Parameters.AddWithValue("@pAssignmentID", ddlSelectAssignment.SelectedValue);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            AllStudentsGridview.DataBind();
            fillAllStudentsTestsGridview();
            fillAllTestVisible();
        }
Exemplo n.º 2
0
        protected void fillAllStudentsTestsGridview()
        {
            string constr = ConfigurationManager.ConnectionStrings["CS414_FasTestConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (con)
                {
                    using (SqlCommand getcmd = new SqlCommand("Get_All_Students_Tests"))
                    {
                        getcmd.Connection = con;
                        con.Open();
                        //Get Assignment Questions is the procedure
                        SqlDataAdapter da = new SqlDataAdapter("Get_All_Students_Tests", con);
                        da.SelectCommand.CommandType = CommandType.StoredProcedure;
                        da.SelectCommand.Parameters.AddWithValue("@pTestID", ddlSelectAssignment.SelectedValue);

                        DataSet ds = new DataSet();
                        // Question is Table name
                        da.Fill(ds, "StudentAssignment");
                        AllStudentsGridview.DataSource = ds.Tables["StudentAssignment"];


                        AllStudentsGridview.DataBind();
                        da.Dispose();
                        con.Close();
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void chkAllVisible_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox allVisibleCheckbox = (CheckBox)sender;
            bool     allVisible         = allVisibleCheckbox.Checked;
            string   constr             = ConfigurationManager.ConnectionStrings["CS414_FasTestConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand("Set_All_Visibility"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pClassID", ddlSelectclass.SelectedValue);
                    cmd.Parameters.AddWithValue("@pAssignmentID", ddlSelectAssignment.SelectedValue);
                    cmd.Parameters.AddWithValue("@pVisible", allVisible);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            AllStudentsGridview.DataBind();
            fillAllStudentsTestsGridview();
        }
Exemplo n.º 4
0
        protected void chkPledgeSigned_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox PledgeSignedCheckBox = (CheckBox)sender;
            bool     PledgeSigned         = PledgeSignedCheckBox.Checked;
            string   constr = ConfigurationManager.ConnectionStrings["CS414_FasTestConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand("Change_Pledge_Signed_Grading"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pSigned", PledgeSigned);
                    cmd.Parameters.AddWithValue("@pStudentID", Convert.ToInt32(ViewState["SelectedStudentID"]));
                    cmd.Parameters.AddWithValue("@pAssignmentID", ddlSelectAssignment.SelectedValue);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            AllStudentsGridview.DataBind();
            fillAllStudentsTestsGridview();
        }