public void SetEvent(Schedule s, int EventId, int classroomId, int i, int j) { Event e = s.getEventByID(EventId); int t = e.Duration; eventi[EventId, 2] = i; eventi[EventId, 3] = j; eventi[EventId, 1] = classroomId; int l = eventi[EventId, 0]; foreach (string g in s.getEventByID(EventId).getGroups()) { int gId = s.findGroup(g).Id; for (int k = 0; k < t; k++) { grupe[gId, i, j + k] = EventId; } } for (int k = 0; k < t; k++) { sobe[classroomId, i, j + k] = EventId; } for (int k = 0; k < t; k++) { profesori[l, i, j + k] = EventId; } //e.getCourse().setEvent(i, j, e); for (int k = 0; k < t; k++) { kolegiji[e.getCourse().getID(), i, j + k]++; } }
/* Removes an Event from Scedules of all the groups, lecturers * and classrooms assosciated with that event */ public void RemoveEvent(Schedule s, int EventId) { Event e = s.getEventByID(EventId); //e.getClassroom().week[]--; int t = e.Duration; int i = eventi[EventId, 2]; int j = eventi[EventId, 3]; int c = eventi[EventId, 1]; int l = eventi[EventId, 0]; foreach (string g in s.getEventByID(EventId).getGroups()) { int gId = s.findGroup(g).Id; for (int k = 0; k < t; k++) { grupe[gId, i, j + k] = 0; } } for (int k = 0; k < t; k++) { sobe[c, i, j + k] = 0; } for (int k = 0; k < t; k++) { profesori[l, i, j + k] = 0; } for (int k = 0; k < t; k++) { kolegiji[e.getCourse().getID(), i, j + k] --; } //e.getCourse().removeEvent(i, j, t); eventi[EventId, 2] = 0; eventi[EventId, 3] = 0; }