TimeTableModel GetTimeTableById(int timetableId) { TimeTableModel timeTable = null; using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = @"SELECT * FROM TimeTables WHERE Id =@id"; cmd.Parameters.AddWithValue("@id", timetableId); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["Id"]); string day = reader["Day"].ToString(); var classId = reader["ClassId"] == DBNull.Value ? null : (object)reader["ClassId"].ToString(); var subjectId = reader["SubjectId"] == DBNull.Value ? null : (object)reader["SubjectId"].ToString(); ClassModel clazzz = this.GetClassById(classId.ToString()); SubjectModel sub = this.GetSubjectById(subjectId.ToString()); timeTable = new TimeTableModel(id, day, clazzz, sub); } } } } return timeTable; }
//repozytorium Timetable public void AddNewTimeTable(TimeTableModel timetable) { using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = "INSERT INTO TimeTables (Day, ClassId, SubjectId) VALUES(@Id, @Day, @ClassId, @SubjectId)"; cmd.Parameters.AddWithValue("@Day", timetable.Day); cmd.Parameters.AddWithValue("@ClassId", timetable.Class.Id); cmd.Parameters.AddWithValue("@SubjectId", timetable.Subject.Id); cmd.ExecuteNonQuery(); } } }
IList<TimeTableModel> GetAllTimeTable() { IList<TimeTableModel> timeTable = new List<TimeTableModel>(); using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = @"SELECT * FROM TimeTables"; using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["Id"]); string day = reader["Day"].ToString(); var classId = reader["ClassId"] == DBNull.Value ? null : (object)reader["ClassId"].ToString(); var subjectId = reader["SubjectId"] == DBNull.Value ? null : (object)reader["SubjectId"].ToString(); ClassModel clazzz = this.GetClassById(classId.ToString()); SubjectModel sub = this.GetSubjectById(subjectId.ToString()); var timetable = new TimeTableModel(id, day, clazzz, sub); timeTable.Add(timetable); } } } } return timeTable; }
public FakeLibrusManager() { this.classes.Add(new ClassModel("IA")); this.classes.Add(new ClassModel("IB")); this.classes.Add(new ClassModel("IC")); var clazz = this.GetClassById("IA"); this.students.Add(new StudentModel(1, "Aneta", "Dams", clazz, true)); this.students.Add(new StudentModel(2, "Karolina", "Kowalska", clazz, true)); this.students.Add(new StudentModel(3, "Anna", "Nowak", clazz, true)); this.students.Add(new StudentModel(4, "Mateusz", "Brzeziński", clazz, false)); this.students.Add(new StudentModel(5, "Justyna", "Karpińska", clazz, true)); var clazz1 = this.GetClassById("IB"); this.students.Add(new StudentModel(6, "Maciej", "Sikorski", clazz1, false)); this.students.Add(new StudentModel(7, "Paweł", "Nowakowski", clazz1, false)); this.students.Add(new StudentModel(8, "Adrian", "Rydzyński", clazz1, false)); this.students.Add(new StudentModel(9, "Monika", "Kwiatkowska", clazz1, true)); var clazz2 = this.GetClassById("IC"); this.students.Add(new StudentModel(10, "Anna", "Mrozowska", clazz2, true)); this.students.Add(new StudentModel(11, "Kamila", "Boruta", clazz2, true)); this.students.Add(new StudentModel(12, "Andrzej", "Gutowski", clazz2, false)); this.students.Add(new StudentModel(13, "Szymon", "Kołodziej", clazz2, false)); this.subjects.Add(new SubjectModel("AM", "Analiza Matematyczna")); this.subjects.Add(new SubjectModel("MD", "Matematyka Dyskretna")); this.subjects.Add(new SubjectModel("AiSD", "Algorytmy i struktury danych")); this.subjects.Add(new SubjectModel("SO", "Systemy Operacyjne")); this.subjects.Add(new SubjectModel("PI", "Programowanie I (C++)")); this.subjects.Add(new SubjectModel("AL", "Algebra Liniowa")); this.subjects.Add(new SubjectModel("SOS", "Środowisko Obliczeń Symblicznych")); this.subjects.Add(new SubjectModel("TJF", "Teoria Języków Formalnych")); this.subjects.Add(new SubjectModel("PII", "Programowanie II (C#)")); this.subjects.Add(new SubjectModel("PB", "Projekt Bazodanowy")); this.subjects.Add(new SubjectModel("LG", "Laboratorium Grafiki")); this.subjects.Add(new SubjectModel("PIII", "Programowanie III (Java)")); this.subjects.Add(new SubjectModel("TO", "Teoria Obliczalności")); int id = 0; Random gen = new Random(); id++; var date = "środa"; var table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("AM")); this.timeTables.Add(table); var start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("MD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("TJF")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; var date1 = "czwartek"; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("PII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("AM")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; var date2 = "piątek"; table = new TimeTableModel(id, date2, this.GetClassById("IA"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IB"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IC"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IA"), this.GetSubjectById("TJF")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IB"), this.GetSubjectById("AM")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IC"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; id++; var date3 = "poniedziałek"; table = new TimeTableModel(id, date3, this.GetClassById("IA"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IB"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IC"), this.GetSubjectById("MD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IA"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IB"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IC"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; id++; var date4 = "wtorek"; table = new TimeTableModel(id, date4, this.GetClassById("IA"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IB"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IC"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IA"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IB"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IC"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) pre.Present = true; else pre.Present = false; this.presences.Add(pre); } } }