예제 #1
0
 private void WybierzStudenta_SelectionChanged(object sender, MouseButtonEventArgs e)
 {
     if (this.contentDataGrid.SelectedIndex >= 0 && this.contentDataGrid.AlternationCount >= 0)
     {
         choosenStudent            = (LecturerStudentsDataView)this.contentDataGrid.SelectedItems[0];
         choosenStudentIndexNumber = choosenStudent.IndexNumber;
         choosenStudentGroupID     = choosenStudent.GroupID;
         CreateOcenianieOcena();
     }
 }
        public List <LecturerStudentsDataView> DataBaseShowLecturerStudentsByIndexNumber(User user, string IndexNumber)
        {
            command = new MySqlCommand($"CALL wyswietl_studentow_prowadzacego_po_numerze_indeksu('{user.UserID}', '{IndexNumber}')", this.conection);
            reader  = command.ExecuteReader();
            List <LecturerStudentsDataView> lecturerStudentsDatas = new List <LecturerStudentsDataView>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    LecturerStudentsDataView lecturerStudentsData = new LecturerStudentsDataView();
                    lecturerStudentsData.IndexNumber   = int.Parse(reader.GetValue(0).ToString());
                    lecturerStudentsData.NameOfCourse  = reader.GetValue(1).ToString();
                    lecturerStudentsData.GroupID       = int.Parse(reader.GetValue(2).ToString());
                    lecturerStudentsData.TypeOfClasses = char.Parse(reader.GetValue(3).ToString());
                    if (!DBNull.Value.Equals(reader.GetValue(4)))
                    {
                        lecturerStudentsData.Grade = float.Parse(reader.GetValue(4).ToString());
                    }
                    else
                    {
                        lecturerStudentsData.Grade = 0.0F;
                    }
                    if (!DBNull.Value.Equals(reader.GetValue(5)))
                    {
                        lecturerStudentsData.GradeStatus = char.Parse(reader.GetValue(5).ToString());
                    }
                    else
                    {
                        lecturerStudentsData.GradeStatus = 'E';
                    }
                    lecturerStudentsDatas.Add(lecturerStudentsData);
                }
            }
            reader.Close();
            return(lecturerStudentsDatas);
        }