Ejemplo n.º 1
0
        /// <summary>
        /// function delete of edit the rubric level
        /// </summary>
        /// <param name="sender">sender is the object sender that raised the event.</param>
        /// <param name="e"> e is the Event Argument of the object and basically contains the event data</param>
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection con = new SqlConnection(connection);

            con.Open();
            if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index)
            {
                if (con.State == ConnectionState.Open)
                {
                    int        ID1   = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
                    string     query = "DELETE FROM dbo.RubricLevel WHERE Id = '" + ID1 + "'";
                    SqlCommand cmd   = new SqlCommand(query, con);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Date Deleted");
                    RubricLevel rl = new RubricLevel(ID);
                    this.Hide();
                    rl.Show();
                }
            }
            if (e.ColumnIndex == dataGridView1.Columns["Edit"].Index)
            {
                if (con.State == ConnectionState.Open)
                {
                    int             ID1    = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
                    string          detail = dataGridView1.Rows[e.RowIndex].Cells["Details"].Value.ToString();
                    int             multi  = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["MeasurementLevel"].Value);
                    EditRubricLevel ed     = new EditRubricLevel(ID, ID1, detail, multi);
                    this.Hide();
                    ed.Show();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// function edit or delete the rubric or insert a level against the rubric
        /// </summary>
        /// <param name="sender">sender is the object sender that raised the event.</param>
        /// <param name="e"> e is the Event Argument of the object and basically contains the event data</param>
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index)
            {
                SqlConnection con = new SqlConnection(connection);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    if (MessageBox.Show("Deleting this item will cause other items to delete. Are You Sure you Want to Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int        ID     = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
                        string     query1 = "DELETE FROM dbo.RubricLevel WHERE RubricId = '" + ID + "'";
                        SqlCommand cmd1   = new SqlCommand(query1, con);
                        cmd1.ExecuteNonQuery();
                        string     query2 = "DELETE FROM dbo.AssessmentComponent WHERE RubricId = '" + ID + "'";
                        SqlCommand cmd2   = new SqlCommand(query2, con);
                        cmd2.ExecuteNonQuery();
                        string     query = "DELETE FROM dbo.Rubric WHERE Id = '" + ID + "'";
                        SqlCommand cmd   = new SqlCommand(query, con);
                        cmd.ExecuteNonQuery();
                        MessageBox.Show("Data Deleted");
                        Rubrics r = new Rubrics();
                        this.Hide();
                        r.Show();
                    }
                }
            }
            if (e.ColumnIndex == dataGridView1.Columns["Edit"].Index)
            {
                SqlConnection con = new SqlConnection(connection);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    int    ID      = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
                    string Details = (dataGridView1.Rows[e.RowIndex].Cells["Details"].Value).ToString();
                    string name    = (dataGridView1.Rows[e.RowIndex].Cells["Name"].Value).ToString();

                    EditRubric frm = new EditRubric(ID, Details, name);
                    this.Hide();
                    frm.Show();
                }
            }
            if (e.ColumnIndex == dataGridView1.Columns["RubricLevel"].Index)
            {
                SqlConnection con = new SqlConnection(connection);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    int         ID  = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
                    RubricLevel frm = new RubricLevel(ID);
                    this.Hide();
                    frm.Show();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// function update the rubric level of the selected id
        /// </summary>
        /// <param name="sender">sender is the object sender that raised the event.</param>
        /// <param name="e"> e is the Event Argument of the object and basically contains the event data</param>
        private void button6_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(connection);

            con.Open();
            if (con.State == ConnectionState.Open)
            {
                string     query = "UPDATE dbo.RubricLevel SET Details = '" + textBox1.Text + "', MeasurementLevel = '" + textBox2.Text + "' WHERE Id = '" + ID + "'";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Updated");
                RubricLevel rl = new RubricLevel(Rid);
                this.Hide();
                rl.Show();
            }
        }