Esempio n. 1
0
        public static void UkloniStudentaSaPredmeta(Student student)
        {
            //pronadjemo predmet sa kojeg zelimo da ukloniko studenta
            Predmet predmet = PredmetUI.PronadjiPredmetPoId();

            UkloniStudentaSaPredmeta(student, predmet);
        }
Esempio n. 2
0
 /** METODA ZA UCITAVANJE PODATAKA****/
 public static void UcitajPohadjanjaIzDatoteke(string nazivDatoteke)
 {
     if (File.Exists(nazivDatoteke))
     {
         using (StreamReader reader1 = File.OpenText(nazivDatoteke))
         {
             string linija = "";
             while ((linija = reader1.ReadLine()) != null)
             {
                 string[] pohadjanja = linija.Split(',');
                 int      idStudenta = Int32.Parse(pohadjanja[0]);
                 int      idPredmeta = Int32.Parse(pohadjanja[1]);
                 Student  st         = StudentUI.PronadjiStudentaPoId(idStudenta);
                 Predmet  pr         = PredmetUI.PronadjiPredmetPoId(idPredmeta);
                 if (st != null && pr != null)
                 {
                     st.Predmeti.Add(pr);
                     pr.Studenti.Add(st);
                 }
             }
         }
     }
     else
     {
         Console.WriteLine("Datoteka ne postoji ili putanja nije ispravna.");
     }
 }
Esempio n. 3
0
        public static void DodajStudentaNaPredmet(Student student)
        {
            //pronadjemo predmet na koji zelimo da dodamo studenta
            Predmet predmet = PredmetUI.PronadjiPredmetPoId();

            DodajStudentaNaPredmet(student, predmet);
        }
Esempio n. 4
0
        public static void DodajStudentaNaPredmet()
        {
            // najpre pronadjemo studenta kojeg zelimo da dodamo na predmet
            Student student = StudentUI.PronadjiStudentaPoIndeksu();

            if (student != null)
            {
                //pronadjemo predmet na koji zelimo da dodamo studenta
                Predmet predmet = PredmetUI.PronadjiPredmetPoId();
                if (predmet != null)
                {
                    DodajStudentaNaPredmet(student, predmet);
                }
            }
        }
Esempio n. 5
0
        public static void IspisiStudenteZaPredmet()
        {
            // najpre pronadjemo predmet za koji zelimo ispis studenata
            Predmet predmet = PredmetUI.PronadjiPredmetPoId();

            if (predmet != null)
            {
                List <Student> studenti = predmet.Studenti;

                foreach (Student s in studenti)
                {
                    Console.WriteLine(s);
                }
            }
        }