private void btn_Add_Click(object sender, EventArgs e) { Rubrics r = new Rubrics(); if (r.DetailsAlreadyExist(txt_Details.Text) == "") { id = r.getId(); if (id == -1) { id = 0; } else { id++; } r.Id = id; r.Details = txt_Details.Text; r.CloId = r.getCloId(cmb_CLO.Text); r.AddRubric(); DataTable dt = r.ShowInGrid(); dataGridView1.DataSource = dt; txt_Details.Clear(); } else { MessageBox.Show("Details should be unique"); } }
private void btn_Update_Click(object sender, EventArgs e) { Rubrics r2 = new Rubrics(); r2.Details = txt_Details.Text; r2.CloId = r2.getCloId(cmb_CLO.Text); r2.Edit(idEdit); DataTable dt = r2.ShowInGrid(); dataGridView1.DataSource = dt; txt_Details.Clear(); }