Beispiel #1
0
 public void GetFormSchedule(Classroom C)
 {
     if (C == null) return;
     ScheduleView form = new ScheduleView();
     form.Text = C.Title;
     List<Lesson> query = (from l in C.Lessons
                           where (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.ForClassroom;
     }
     form.ShowDialog();
 }
Beispiel #2
0
 public void AddClassroom(Classroom C)
 {
     foreach (Lesson l in C.Lessons)
         if (l.Conflict(this))
         {
             message += "Аудиторія " + C.Title + " занята\n";
             break;
         }
     classrooms.Add(C);
     C.Lessons.Add(this);
 }
Beispiel #3
0
        public void GetExcelSchedule(Classroom C)
        {
            Excel.Application excelApp = new Excel.Application();
            Excel.Workbooks excelAppWorkBooks = excelApp.Workbooks;
            Excel.Workbook excelAppWorkBook = excelApp.Workbooks.Open(ExcelTemplatePath,
                              Type.Missing, Type.Missing, Type.Missing,
                             "WWWWW", "WWWWW", Type.Missing, Type.Missing, Type.Missing,
                              Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                              Type.Missing, Type.Missing);

            Excel.Sheets excelSheets = excelAppWorkBook.Worksheets;
            Excel.Worksheet excelWorkSheet = (Excel.Worksheet)excelSheets[1];

            int n = 4;
            var excelCell = (Excel.Range)excelWorkSheet.Cells[1, n];
            excelCell.Value2 = C.Title;
            excelCell.Borders[Excel.XlBordersIndex.xlEdgeRight].Weight = "3";
            excelCell.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = "3";

            foreach (Lesson l in C.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)excelWorkSheet.Cells[m + 1, n];
                    excelCell.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = "3";
                    if (l.Type != 1) shift = 2;

                }
                excelCell = (Excel.Range)excelWorkSheet.Cells[m + shift, n];
                excelCell.Value2 = l.TitleSubject;
                excelCell = (Excel.Range)excelWorkSheet.Cells[m + 2 - offset + shift, n];
                excelCell.Value2 += l.TitleGroups + " ";
                excelCell.Value2 += l.TitleTeachers;
            }
            excelApp.Visible = true;
        }