コード例 #1
0
        public List <Kurs> getKursy()
        {
            kursy = new List <Kurs>();
            List <string> kursy_str = File.ReadAllLines(filePath).ToList();

            foreach (var r in kursy_str)
            {
                string[] enteries = r.Split(',');
                Kurs     kurs     = new Kurs();
                kurs.id   = int.Parse(enteries[0]);
                kurs.name = enteries[1];


                List <string>  students     = new List <string>();
                DAO_Student    ds           = new DAO_Student();
                List <Student> dao_students = ds.getStudenci();
                for (int i = 2; i < enteries.Length; i++)
                {
                    for (int j = 0; j < dao_students.Count; j++)
                    {
                        if (int.Parse(enteries[i]) == dao_students[j].id)
                        {
                            students.Add(dao_students[j].id.ToString() + "," + dao_students[j].imie + "," + dao_students[j].nazwisko + "," + dao_students[j].indeks);
                        }
                    }
                }
                kurs.students = students;

                kursy.Add(kurs);
            }
            return(kursy);
        }
コード例 #2
0
        public void synchronizeStudenci()
        {
            DAO_Kurs_DB d = new DAO_Kurs_DB();

            d.clearConnection();
            clearStudenci();

            DAO_Student    ds       = new DAO_Student();
            List <Student> studenci = ds.getStudenci();

            foreach (Student s in studenci)
            {
                addFullStudent(s.id, s.imie, s.nazwisko, s.indeks);
            }
        }