Beispiel #1
0
        /// <summary>
        /// function creates a new object of Rubric form and close the current form
        /// </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 button4_Click(object sender, EventArgs e)
        {
            Rubrics r = new Rubrics();

            this.Hide();
            r.Show();
        }
Beispiel #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();
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// function update 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 button6_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(connection);

            con.Open();
            if (con.State == ConnectionState.Open)
            {
                string     query = "UPDATE dbo.Rubric SET Details = '" + textBox1.Text + "', CloID = '" + comboBox1.SelectedValue + "' WHERE Id = '" + ID + "'";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Updated");
            }
            Rubrics r = new Rubrics();

            this.Hide();
            r.Show();
        }