Beispiel #1
0
 private void UpdateStudentData()
 {
     studentDate = DbService.DataBaseShowStudentData(signInUser);
     tableRowContentList[0].Text = studentDate.StudyFiled;
     tableRowContentList[1].Text = studentDate.Degree.ToString();
     tableRowContentList[2].Text = studentDate.Semestr.ToString();
     tableRowContentList[3].Text = studentDate.IndexNumber.ToString();
 }
        public StudentDataView DataBaseShowStudentData(User user)
        {
            command = new MySqlCommand($"CALL wyswietl_dane_studenta('{user.UserID}')", this.conection);
            reader  = command.ExecuteReader();
            StudentDataView studentData = new StudentDataView();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    studentData.StudyFiled  = reader.GetValue(0).ToString();
                    studentData.Degree      = int.Parse(reader.GetValue(1).ToString());
                    studentData.Semestr     = int.Parse(reader.GetValue(2).ToString());
                    studentData.IndexNumber = int.Parse(reader.GetValue(3).ToString());
                }
            }
            reader.Close();
            return(studentData);
        }