public int CountOfHours(Lesson L, Group G) { int count = 0; foreach (Lesson l in this.Lessons.Where(les => les.Semester == L.Semester).Where(les => les.Subject == L.Subject).Where(les => les.Groups.IndexOf(G) > -1).ToList()) { if (l.Type == 0) count += 2; else count++; } return count; }
public void AddGroup(Group G) { foreach (Lesson l in G.Lessons) if (l.Conflict(this)) { message += "Група " + G.Title + " занята\n"; break; } groups.Add(G); G.Lessons.Add(this); }
private void WriteSchedule(Group G, Excel.Worksheet WorkSheet, int position) { int n = 4 + position; char C = (char)(100 + position); var excelCell = (Excel.Range)WorkSheet.Cells[1, n]; excelCell.Value2 = G.Title; excelCell.Borders[Excel.XlBordersIndex.xlEdgeRight].Weight = "3"; excelCell.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = "3"; for (int i = 1; i <= 80; i += 4) { excelCell = WorkSheet.get_Range(C + (i + 1).ToString(), C + (i + 4).ToString()); excelCell.Borders[Excel.XlBordersIndex.xlEdgeRight].Weight = "3"; excelCell.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = "3"; } foreach (Lesson l in G.Lessons.Where(l => l.Semester == semester).ToList()) { int m = l.Day * 16 + l.Number * 4 + 2; int offset = 0; int shift = 0; if (l.Type != 0) { offset = 1; excelCell = (Excel.Range)WorkSheet.Cells[m + 1, n]; excelCell.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = "3"; if (l.Type != 1) shift = 2; } excelCell = (Excel.Range)WorkSheet.Cells[m + shift, n]; excelCell.Value2 = l.TitleSubject; for (int i = 0; i < l.Teachers.Count(); i++) { excelCell = (Excel.Range)WorkSheet.Cells[m + 2 - offset + shift, n]; excelCell.Value2 += l.Teachers[i].FullName() + " "; excelCell.Value2 += l.Classrooms[i].Title + " "; } } }
int LoadHours(Teacher T, Group G) { Load load = new Load(); foreach (Load l in this.Loads) { if ((l.Teacher == T) && (l.Group == G) && (l.Semester == this.Semester)) { load = l; break; } } return load.WeeklyHour; }
public List<Subject> GetSubjectsForGroup(Group G) { if (G == null) return new List<Subject>(); EntitySet<Subject> subjects = new EntitySet<Subject>(); var query = from s in G.Loads.Where(l => l.Semester == semester) select s.Subject; foreach (Subject s in query) subjects.Add(s); return subjects.ToList<Subject>(); }
public void GetFormSchedule(Group G) { if (G == null) return; ScheduleView form = new ScheduleView(); form.Text = G.Title; List<Lesson> query = (from l in Lessons where G.IsMember(l.Groups) && (l.Semester == semester) select l).ToList<Lesson>(); form.panel1.Controls.Clear(); foreach (Lesson l in query) { VisualLesson c = new VisualLesson(); form.panel1.Controls.Add(c); c.Lesson = l; c.Mode = ViewMode.ForGroup; } form.ShowDialog(); }
public void ShowFor(Group G) { RefreshFact(); FactBind.DataSource = fact. Where(l => l.Groups.IndexOf(G) != -1). ToList(); }