Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddRubric s = new AddRubric();

            this.Hide();
            s.Show();
        }
Exemple #2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit")
     {
         Class1.id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         this.Hide();
         AddRubric registerStudent = new AddRubric();
         registerStudent.Show();
     }
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete")
     {
         int stdId = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         if (MessageBox.Show("Do you want to delete " + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             con.Open();
             SqlCommand command = new SqlCommand("DELETE FROM Rubric WHERE Id  = '" + stdId + "'", con);
             command.ExecuteNonQuery();
             con.Close();
             this.rubricTableAdapter.Fill(this.projectBDataSet.Rubric);
         }
     }
 }
Exemple #3
0
        private void dataRubric_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection connection = new SqlConnection(constring);

            connection.Open();
            if (e.ColumnIndex == dataRubric.Columns["Delete"].Index)
            {
                try
                {
                    int[] rubric_level         = new int[4];
                    int   j                    = 0;
                    int[] assessment_componenT = new int[100];


                    int row = e.RowIndex;
                    id = Convert.ToInt32(dataRubric.Rows[e.RowIndex].Cells[0].Value);
                    String     d    = "SELECT Id FROM dbo.RubricLevel where RubricId ='" + id + "'";
                    SqlCommand com1 = new SqlCommand(d, connection);
                    com1.Parameters.Add(new SqlParameter("0", 1));
                    SqlDataReader r2 = com1.ExecuteReader();
                    while (r2.Read())
                    {
                        rubric_level[j] = Convert.ToInt32(r2[0]);
                        j++;
                    }
                    r2.Close();
                    int        s     = rubric_level[0];
                    int        v     = rubric_level[1];
                    String     del   = "SELECT Id FROM dbo.AssessmentComponent where RubricId ='" + id + "'";
                    SqlCommand com11 = new SqlCommand(del, connection);
                    com11.Parameters.Add(new SqlParameter("0", 1));
                    SqlDataReader r3 = com11.ExecuteReader();
                    while (r3.Read())
                    {
                        assessment_componenT[j] = Convert.ToInt32(r3[0]);
                        j++;
                    }
                    r3.Close();

                    int s1 = assessment_componenT[1];
                    int s2 = assessment_componenT[0];
                    int s3 = assessment_componenT[2];

                    foreach (int a in rubric_level)

                    {
                        int        delete = a;
                        string     Qeury0 = "Delete from dbo.StudentResult where RubricMeasurementId = '" + a + "'";
                        SqlCommand cmd0   = new SqlCommand(Qeury0, connection);
                        cmd0.ExecuteNonQuery();
                    }
                    foreach (int a in assessment_componenT)

                    {
                        int        delete = a;
                        string     Qeury1 = "Delete from dbo.StudentResult where AssessmentComponentId = '" + a + "'";
                        SqlCommand cmd1   = new SqlCommand(Qeury1, connection);
                        cmd1.ExecuteNonQuery();
                    }
                    string     Qeury2 = "Delete from dbo.RubricLevel where RubricId = '" + id + "'";
                    SqlCommand cmd3   = new SqlCommand(Qeury2, connection);
                    cmd3.ExecuteNonQuery();


                    string     Qeury4 = "Delete from dbo.AssessmentComponent where RubricId = '" + id + "'";
                    SqlCommand cmd4   = new SqlCommand(Qeury4, connection);
                    cmd4.ExecuteNonQuery();

                    string     qeury5 = "Delete from dbo.Rubric where Id = '" + id + "'";
                    SqlCommand cmd5   = new SqlCommand(qeury5, connection);
                    cmd5.ExecuteNonQuery();

                    MessageBox.Show("Rubric Deleted");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            if (e.ColumnIndex == dataRubric.Columns["edit"].Index)
            {
                string temp = dataRubric.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();
                id = Convert.ToInt32(temp);



                txtRubricId.Text = dataRubric.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();
                comboCloNo.Text  = dataRubric.Rows[e.RowIndex].Cells[2].FormattedValue.ToString();
                txtDetails.Text  = dataRubric.Rows[e.RowIndex].Cells[1].FormattedValue.ToString();
                button1.Text     = "Update";
                tab2.Hide();

                AddRubric.Show();
            }
        }