private void WybierzOcene_SelectionChanged(object sender, MouseButtonEventArgs e) { if (this.contentDataGrid.SelectedIndex >= 0 && this.contentDataGrid.AlternationCount >= 0) { choosenStudentGrade = (StudentGradesDataView)this.contentDataGrid.SelectedItems[0]; choosenMembershipID = choosenStudentGrade.MembershipID; CreateIndeksOcena(); } }
public List <StudentGradesDataView> DataBaseShowStudentGradesData(User user) { command = new MySqlCommand($"CALL wyswietl_oceny_studenta('{user.UserID}')", this.conection); reader = command.ExecuteReader(); List <StudentGradesDataView> studentGradesDatas = new List <StudentGradesDataView>(); if (reader.HasRows) { while (reader.Read()) { StudentGradesDataView studentGradesData = new StudentGradesDataView(); studentGradesData.MembershipID = int.Parse(reader.GetValue(0).ToString()); studentGradesData.Name = reader.GetValue(1).ToString(); studentGradesData.Surname = reader.GetValue(2).ToString(); studentGradesData.NameOfCourse = reader.GetValue(3).ToString(); studentGradesData.Ects = int.Parse(reader.GetValue(4).ToString()); studentGradesData.GroupID = int.Parse(reader.GetValue(5).ToString()); if (!DBNull.Value.Equals(reader.GetValue(6))) { studentGradesData.Grade = float.Parse(reader.GetValue(6).ToString()); } else { studentGradesData.Grade = 0.0F; } if (!DBNull.Value.Equals(reader.GetValue(7))) { studentGradesData.GradeStatus = char.Parse(reader.GetValue(7).ToString()); } else { studentGradesData.GradeStatus = 'E'; } studentGradesDatas.Add(studentGradesData); } } reader.Close(); return(studentGradesDatas); }