private Lesson LessonFromAtom(AtomLesson atom) { Lesson l = new Lesson(); l.Day = atom.Day; l.Type = atom.Type; l.Number = atom.Number; l.Semester = atom.Semester; l.AddGroup(Program.Groups.Where(g => g.ID == atom.GroupID).ToList().First()); l.AddTeacher(Program.Teachers.Where(t => t.ID == atom.TeacherID).ToList().First()); l.AddClassroom(Program.Classrooms.Where(c => c.ID == atom.ClassroomID).ToList().First()); l.Subject = (Program.Subjects.Where(s => s.ID == atom.SubjectID)).ToList<Subject>().First(); return l; }
private AtomLesson GetAtom() { AtomLesson atom = new AtomLesson(); atom.Number = number; atom.Type = type; atom.Day = day; atom.Semester = semester; return atom; }
public List<AtomLesson> GetReplacementsAtoms() { List<AtomLesson> list = new List<AtomLesson>(); OleDbDataAdapter adapter = new OleDbDataAdapter( "SELECT * FROM Replacement", dataContext.Connection as OleDbConnection); DataTable table = new DataTable(); adapter.Fill(table); var tmp = table.Select(); foreach (DataRow row in tmp) { AtomLesson a = new AtomLesson { ID = Convert.ToInt32(row[0]), GroupID = Convert.ToInt32(row[1]), ClassroomID = Convert.ToInt32(row[2]), SubjectID = Convert.ToInt32(row[3]), TeacherID = Convert.ToInt32(row[4]), Number = Convert.ToInt32(row[5]), Day = Convert.ToInt32(row[6]), Type = Convert.ToInt32(row[7]), Semester = Convert.ToInt32(row[8]) }; list.Add(a); } return list; }