private void Add_Click(object sender, EventArgs e) { if (Datails1.Text != "" && MeasurementcomboBox1.Text != "" && Details2.Text != "" && MeasurementcomboBox2.Text != "" && Datails3.Text != "" && MeasurementcomboBox3.Text != "" && Datails4.Text != "" && MeasurementcomboBox4.Text != "") { RubricLevelClass RL = new RubricLevelClass(); RL.ADD_RubricL(Datails1.Text.Trim(), MeasurementcomboBox1.Text.Trim(), Details2.Text.Trim(), MeasurementcomboBox2.Text.Trim(), Datails3.Text.Trim(), MeasurementcomboBox3.Text.Trim(), Datails4.Text.Trim(), MeasurementcomboBox4.Text.Trim(), Rubricselection.Text); MessageBox.Show("Data has been addes successfully"); Datails1.Text = ""; MeasurementcomboBox1.Text = ""; Details2.Text = ""; MeasurementcomboBox2.Text = ""; Datails3.Text = ""; MeasurementcomboBox3.Text = ""; Datails4.Text = ""; MeasurementcomboBox4.Text = ""; Rubricselection.Text = ""; } else { MessageBox.Show("firstly fill all the fields to further proceed"); } RubricLevelindex RLI = new RubricLevelindex(); this.Hide(); RLI.Show(); }
/// <summary> /// This function used to insert the RubricLevel record in RubricLevel List /// </summary> /// <param name="query">Query to retrieve the data from database</param> public void ShowRubricLevelRecord(string query) { try { SqlCommand command = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader; reader = command.ExecuteReader(); if (reader.HasRows) { ListofClasses Lt1 = new ListofClasses(); Lt1.RemoveFromRubricLevel(); while (reader.Read()) { RubricLevelClass RL = new RubricLevelClass(); RL.Id = Convert.ToInt32(reader[0]); int rubricid = Convert.ToInt32(reader[1]); RL.Details1 = reader[2].ToString(); RL.Measurement1 = Convert.ToInt32(reader[3]); string myquery = "select Details FROM Rubric where Id = '" + rubricid + "'"; RL.RubricName1 = Cloname(myquery); Lt1.AddRubricLevelList(RL); } } } catch (Exception ex) { throw (ex); } finally { conn.Close(); } }
private void RubLevelRecord_CellContentClick(object sender, DataGridViewCellEventArgs e) { RubricLevelClass Rub = new RubricLevelClass(); ListofClasses lt = new ListofClasses(); int index = RubLevelRecord.CurrentCell.RowIndex; DataGridViewRow r = RubLevelRecord.Rows[index]; int id = Convert.ToInt32(r.Cells[0].Value); if (RubLevelRecord.Columns[e.ColumnIndex].Name == "Delete") { DialogResult result = MessageBox.Show("Do You Want to delete data against the id ?" + id, "Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result.Equals(DialogResult.OK)) { Rub.Delete(id); MessageBox.Show("Data has been Deleted successfully"); RubLevelRecord.DataSource = null; RubricLevelindex_Load(sender, e); } else { return; } } if (RubLevelRecord.Columns[e.ColumnIndex].Name == "Edit") { Details.Text = r.Cells[1].Value.ToString(); MeasurementcomboBox1.Text = r.Cells[2].Value.ToString(); globalindex = id; } }
private void RubricLevelindex_Load(object sender, EventArgs e) { ListofClasses lt = new ListofClasses(); RubricLevelClass Rlb = new RubricLevelClass(); Rlb.RubricLRecord(); RubLevelRecord.DataSource = lt.RLC; }
private void Save_Click(object sender, EventArgs e) { RubricLevelClass RLC = new RubricLevelClass(); RLC.Edit(globalindex, Details.Text.Trim(), MeasurementcomboBox1.Text); RubLevelRecord.DataSource = null; RubricLevelindex_Load(sender, e); Details.Text = " "; MeasurementcomboBox1.Text = " "; }
/// <summary> /// This function used to Add tne RubricLevel in the RubricLevelList /// </summary> /// <param name="rl">Object of the Rubric</param> public void AddRubricLevelList(RubricLevelClass rl) { RLC.Add(rl); }