private void btn_Update_Click(object sender, EventArgs e)
        {
            RubricLevels RL = new RubricLevels();

            lbl_ErrorMeasurementLevel.Text      = RL.ValidMeasurementLevel(txt_MeasurementLevel.Text);
            lbl_ErrorMeasurementLevel.ForeColor = System.Drawing.Color.Gray;
            lbl_ErrorMeasurementLevel.Refresh();

            if (lbl_ErrorMeasurementLevel.Text == "")
            {
                RL.rubricId         = RL.getRubricIdFromRubricDetails(cmb_Rubric.Text);
                RL.details          = txt_Details.Text;
                RL.measurementLevel = Convert.ToInt32(txt_MeasurementLevel.Text);

                RL.Edit(id);
                DataTable dt = RL.ShowInGrid();
                dataGridView1.DataSource = dt;
                int count = dt.Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    string s1 = RL.getDetailsFromRubricId(Convert.ToInt32(dt.Rows[i][1]));
                    dataGridView1.Rows[i].Cells[2].Value = s1;
                }
            }
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            RubricLevels RL = new RubricLevels();

            lbl_ErrorMeasurementLevel.Text      = RL.ValidMeasurementLevel(txt_MeasurementLevel.Text);
            lbl_ErrorMeasurementLevel.ForeColor = System.Drawing.Color.Red;
            lbl_ErrorMeasurementLevel.Refresh();
            if (RL.DetailsAlreadyExist(txt_Details.Text) == "")
            {
                if (lbl_ErrorMeasurementLevel.Text == "")
                {
                    RL.rubricId         = RL.getRubricIdFromRubricDetails(cmb_Rubric.Text);
                    RL.details          = txt_Details.Text;
                    RL.measurementLevel = Convert.ToInt32(txt_MeasurementLevel.Text);

                    RL.Add();
                    DataTable dt = RL.ShowInGrid();
                    dataGridView1.DataSource = dt;
                    int count = dt.Rows.Count;
                    for (int i = 0; i < count; i++)
                    {
                        string s1 = RL.getDetailsFromRubricId(Convert.ToInt32(dt.Rows[i][1]));
                        dataGridView1.Rows[i].Cells[2].Value = s1;
                    }
                }
            }
            else
            {
                MessageBox.Show("Details should be unique");
            }
        }
        private void RubricLevel_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'projectBDataSet12.RubricLevel' table. You can move, or remove it, as needed.
            this.rubricLevelTableAdapter.Fill(this.projectBDataSet12.RubricLevel);

            btn_RubricLevel.BackColor = Color.Gray;
            btn_RubricLevel.Enabled   = false;

            RubricLevels RL = new RubricLevels();

            RL.AddToComboBox(cmb_Rubric);

            DataTable dt = RL.ShowInGrid();

            dataGridView1.DataSource = dt;
            int count = dt.Rows.Count;

            for (int i = 0; i < count; i++)
            {
                string s1 = RL.getDetailsFromRubricId(Convert.ToInt32(dt.Rows[i][1]));
                dataGridView1.Rows[i].Cells[2].Value = s1;
            }
        }