// delete rows from clos private void gvClo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { if (AskYesNo() == false) { return; } int selectedrowindex = gvClo.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = gvClo.Rows[selectedrowindex]; string _id = Convert.ToString(selectedRow.Cells["id"].Value); AJ_DataClass ajdbClass = new AJ_DataClass(); string s = ajdbClass.DeleteFromDatabase("delete from clo where id='" + _id + "'"); ajdbClass.popGrid(gvClo, "select id,name from clo"); ajdbClass.popCmb(cmbClo, "select * from clo", "id", "name"); lblrubricLevels.Text = "Rubrics Level - Settings Clo:" + cmbClo.Text; } }
/// <summary> /// Load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { // fill combos ajdbClass.popCmb(cmbClo, "select * from clo", "id", "name"); ajdbClass.popCmb(cmbRubrics, "select * from Rubric where CloId='" + cmbClo.SelectedValue + "'", "id", "Details"); ajdbClass.popCmb(cmbStatus, "select * from Lookup where category='STUDENT_STATUS'", "Lookupid", "Name"); ajdbClass.popCmb(cmbRubAsses, "select * from Rubric ", "id", "details"); ajdbClass.popCmb(cmbStudent, "SELECT * FROM STUDENT", "id", "FirstName"); ajdbClass.popCmb(cmbAseesRE, "SELECT * FROM Assessment ", " Assessment.Id", "Title"); ajdbClass.popCmb(cmbAssesR, "SELECT * FROM AssessmentComponent where AssessmentId='" + cmbAseesRE.SelectedValue + "'", " AssessmentComponent.Id", "Name"); ajdbClass.popCmb(cmbRubRes, "select * from RubricLevel", "Id", "Details"); ajdbClass.popCmb(cmbAssesment, "SELECT * FROM Assessment ", " Assessment.Id", "Title"); // fill data grid view ajdbClass.popGrid(gvClo, "select id,name from clo"); ajdbClass.popGrid(gvRub, "select id,details from Rubric where cloid='" + cmbClo.SelectedValue + "'"); ajdbClass.popGrid(gvRubSettings, "select id,details,MeasurementLevel from RubricLevel where RubricId='" + cmbRubrics.SelectedValue + "'"); string qry = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " + " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId "; ajdbClass.popGrid(gvStudents, qry); txtRubricSetDetails.Text = ""; txtRubricSetLevel.Text = ""; ajdbClass.popGrid(gvAssesment, "SELECT Assessment.Id, Title, DateCreated, TotalMarks, TotalWeightage FROM Assessment"); gvAttandance.DataSource = GetAttendanceRecord(); ajdbClass.popGrid(gvAssesComp, "select AssessmentComponent.Id, Name, Assessment.Title,Rubric.details as Rubric ,AssessmentComponent.TotalMarks from AssessmentComponent inner join Rubric on AssessmentComponent.RubricId=Rubric.Id INNER JOIN Assessment ON AssessmentComponent.AssessmentId = Assessment.Id "); ajdbClass.popGrid(gvResult, "select FirstName,Assessment.Title,AssessmentComponent.Name,EvaluationDate,RubricLevel.details as Rubric from Student INNER JOIN StudentResult ON Student.Id = StudentResult.StudentId INNER JOIN RubricLevel ON StudentResult.RubricMeasurementId = RubricLevel.Id INNER JOIN AssessmentComponent ON StudentResult.AssessmentComponentId = AssessmentComponent.Id INNER JOIN Assessment ON AssessmentComponent.AssessmentId = Assessment.Id"); }