示例#1
0
        private void btnaddrubric_Click(object sender, EventArgs e)
        {
            this.Hide();
            AddRubric addnew = new AddRubric();

            addnew.Show();
        }
示例#2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (rubricrecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit")
     {
         Class1.stuId = Convert.ToInt32(rubricrecord.Rows[e.RowIndex].Cells[0].Value);
         this.Hide();
         AddRubric cl = new AddRubric();
         cl.Show();
     }
     if (rubricrecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete")
     {
         int rId = Convert.ToInt32(rubricrecord.Rows[e.RowIndex].Cells[0].Value);
         if (MessageBox.Show("Are you sure to perform this action!?" + rubricrecord.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SqlConnection newconn = new SqlConnection(con);
             newconn.Open();
             SqlCommand command = new SqlCommand("delete from Rubric where Id  = '" + rId + "'", newconn);
             command.ExecuteNonQuery();
             newconn.Close();
             this.rubricTableAdapter.Fill(this.projectBDataSet.Rubric);
         }
     }
 }