Beispiel #1
0
        public WidokStudenta(Student s)
        {
            this.ID              = (sbyte)s.Id_student;
            this.Imie            = s.Imie;
            this.Nazwisko        = s.Nazwisko;
            this.Email           = s.Email;
            this.NrAlbumu        = s.NrAlbumu;
            this.DataRozpoczecia = s.DataRozpoczecia;
            this.Grupa           = RepoGrupy.PobierzGrupeOId(s.IdGrupy);
            this.Oceny           = RepoOceny.PobierzOcenyStudenta((sbyte)s.Id_student);
            var Kursy = this.Oceny.Select(ocena => RepoKursy.PobierzKursID(ocena.Id_kurs)).ToArray();
            var wagi  = Kursy.Select(kurs => (double)(RepoPrzedmioty.PobierzPrzedmiot(kurs.Id_przedmiot).ECTS)).ToArray();
            var oceny = Oceny.Select(ocena => double.Parse(ocena.Wartosc, CultureInfo.InvariantCulture)).ToArray();

            this.Osiagniecia = new List <WidokOsiagniecia>();
            List <Osiagniecia> osiagniecia = RepoOsiagniecia.PobierzOsiagnieciaStudenta((sbyte)s.Id_student);

            foreach (Osiagniecia o in osiagniecia)
            {
                Osiagniecia.Add(new WidokOsiagniecia(o));
            }

            this.Przedmioty = new List <WidokPrzedmiotu>();
            this.Srednia    = oceny.Sum() * wagi.Sum() / wagi.Sum();
            this.Punkty     = this.Srednia * 10 + (this.Osiagniecia.Select(osiagniecie => (int)osiagniecie.Punkty).ToArray()).Sum();
            if (this.Punkty > 60)
            {
                this.Stypendium = "Tak";
            }
            else
            {
                this.Stypendium = "Nie";
            }
        }