private void AddDepartmentAndClassTeacherButton_Click(object sender, EventArgs e)
        {
            if (DepartmentNumberTextBox.Text.Length == 0)
            {
                Warning();
            }
            else
            {
                string[] parts      = GetCurrentClassTeacher().Split('-');
                string   name       = parts[0];
                string   surname    = parts[1];
                int      TeachersId = TeacherRepository.GetIdByName(name, surname);

                int ClassNumber = GetCurrentClassNumber();
                int ClassesId   = ClassesRepository.GetIdByNumber(ClassNumber);

                try
                {
                    int  Title             = int.Parse(DepartmentNumberTextBox.Text);
                    bool isDepartmentAdded = DepartmentsRepository.AddDepartment(Title, TeachersId, ClassesId);
                    if (isDepartmentAdded == true)
                    {
                        PopulateDepartmentsComboBox();
                        DepartmentNumberTextBox.Text = "";
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Molimo unesite broj odjeljenja");
                }
            }
        }
 public StudentsController(StudentRepository studentRepository,
                           ClassesRepository classesRepository,
                           StudentViewModelValidator studentViewModelValidator)
 {
     _studentRepository         = studentRepository;
     _classesRepository         = classesRepository;
     _studentViewModelValidator = studentViewModelValidator;
 }
Example #3
0
 public ClassController(ClassesRepository classesRepository, ClassesService classesService, IMapper mapper, FileHelper fileHelper, PaginatedMetaService paginatedMetaService)
 {
     _classesRepository    = classesRepository;
     _classesService       = classesService;
     _mapper               = mapper;
     _fileHelper           = fileHelper;
     _paginatedMetaService = paginatedMetaService;
 }
Example #4
0
 public SubjectsController(SubjectRepository subjectRepository,
                           ClassesRepository classesRepository,
                           SubjectsViewModelValidator subjectsViewModelValidator)
 {
     _subjectRepository          = subjectRepository;
     _classesRepository          = classesRepository;
     _subjectsViewModelValidator = subjectsViewModelValidator;
 }
 public TimeTableController(TimeTableManager timeTableManager, TimeTableRepository timeTableRepository, SubjectRepository subjectRepository, FacultyRepository facultyRepository, ClassesRepository classesRepository, TimeTableViewModelValidator tableViewModelValidator)
 {
     _timeTableManager        = timeTableManager;
     _timeTableRepository     = timeTableRepository;
     _subjectRepository       = subjectRepository;
     _facultyRepository       = facultyRepository;
     _classesRepository       = classesRepository;
     _tableViewModelValidator = tableViewModelValidator;
 }
Example #6
0
        // GET: Classes
        public ActionResult Show()
        {
            var classes = ClassesRepository.GetClasses();
            var vm      = new ClassesViewModel()
            {
                AllClasses = classes
            };

            return(View(vm));
        }
 public TimeTableManager(TimeTableRepository timeTableRepository,
                         ClassesRepository classesRepository,
                         SubjectRepository subjectRepository,
                         FacultyRepository facultyRepository,
                         StudentRepository studentRepository)
 {
     _timeTableRepository = timeTableRepository;
     _classesRepository   = classesRepository;
     _subjectRepository   = subjectRepository;
     _facultyRepository   = facultyRepository;
     _studentRepository   = studentRepository;
 }
Example #8
0
        // CONSTRUCTOR
        public SectionsModel()
        {
            TeacherRepository _teacherRep = new TeacherRepository();

            BasicContants.StoredProcedure = "GetFullTeacherName";
            Teachers    = _teacherRep.Get();
            TeacherList = Teachers.ToTeacherSelectListItems(TeacherID);

            ClassesRepository _classRep = new ClassesRepository();

            Classes   = _classRep.Get();
            ClassList = Classes.ToClassSelectListItems(ClassID);
        }
Example #9
0
 public ActionResult AddClass(ClassesViewModel vm)
 {
     try
     {
         ClassesRepository.AddClass(vm.ClassToAdd);
         TempData["userAdded"] = "1";
     }
     catch (Exception ex)
     {
         TempData["userAdded"] = "0";
     }
     return(RedirectToAction("Show"));
 }
Example #10
0
        public ActionResult UpdateClasses(ClassesViewModel vm)
        {
            try
            {
                ClassesRepository.UpdateClasses(vm.AllClasses);
                TempData["success"] = "1";
            }
            catch (Exception ex)
            {
                TempData["success"] = "0";
            }

            return(RedirectToAction("Show"));
        }
 public AttendanceManager(AttendanceRepository attendaceRepository,
                          TimeTableManager tableManager,
                          ClassesRepository classesRepository,
                          SubjectRepository subjectRepository,
                          FacultyRepository facultyRepository,
                          StudentRepository studentRepository)
 {
     _attendanceRepository = attendaceRepository;
     _timeTableManager     = tableManager;
     _classesRepository    = classesRepository;
     _subjectRepository    = subjectRepository;
     _facultyRepository    = facultyRepository;
     _studentRepository    = studentRepository;
 }
Example #12
0
 public ClassesController(ClassesRepository classesRepository, CourseViewModelValidator courseViewModelValidator)
 {
     ClassesRepository         = classesRepository;
     _courseViewModelValidator = courseViewModelValidator;
 }
 public RoutineController(RoutineRepository routineRepository, ClassesRepository classesRepository)
 {
     _routineRepository = routineRepository;
     _classRepository   = classesRepository;
 }
Example #14
0
 public ClassesServiceImpl(ClassesRepository classesRepository, ClassesMaker classesMaker, IHostingEnvironment hostingEnvironment)
 {
     _classesRepository  = classesRepository;
     _classesMaker       = classesMaker;
     _hostingEnvironment = hostingEnvironment;
 }
        private void PopulateClassNumbersComboBox()
        {
            string ClassesQuery = ClassesRepository.GetQuery();

            Lists.FillDropDownList1(ClassesQuery, "Number", ClassNumbersComboBox);
        }
Example #16
0
        private static void WriteSubjectStats(Application oXL, int semester)
        {
            var classes = ClassesRepository.GetClasses();

            classes.Reverse();
            int y = 1;

            int count = 1;

            foreach (var cl in classes)
            {
                Microsoft.Office.Interop.Excel.Worksheet newWorksheet;
                newWorksheet      = (Microsoft.Office.Interop.Excel.Worksheet)oXL.Application.Worksheets.Add();
                newWorksheet.Name = cl.Number + DB.ConvertClassLetter(cl.Letter);

                newWorksheet.Range[newWorksheet.Cells[2, 1], newWorksheet.Cells[2, 10]].Merge();
                newWorksheet.Cells[2, 1] = cl.Number + DB.ConvertClassLetter(cl.Letter);


                for (int p = 0; p <= 1; p++)
                {
                    int    totalIzpitani   = 0;
                    int    total2          = 0;
                    int    total3          = 0;
                    int    total4          = 0;
                    int    total5          = 0;
                    int    total6          = 0;
                    int    totalNeizpitani = 0;
                    double totalAverage    = 0;
                    int    totalGrades     = 0;

                    int tableHeadersX = x - 2;
                    int tableHeadersY = y;
                    var stats         = Helpers.StatsHelpers.GetSubjectsStats(semester, cl.Id, Convert.ToBoolean(p));

                    newWorksheet.Range[newWorksheet.Cells[x - 3, 1], newWorksheet.Cells[x - 3, 10]].Merge();
                    if (p == 0)
                    {
                        newWorksheet.Cells[x - 3, tableHeadersY] = "ЗАДЪЛЖИТЕЛНА И ПРОФИЛИРАНА ПОДГОТОВКА";
                    }
                    else
                    {
                        newWorksheet.Cells[x - 3, tableHeadersY] = "ЗАДЪЛЖИТЕЛНОИЗБИРАЕМА ПОДГОТОВКА";
                    }

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX + 1, tableHeadersY]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "№";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX + 1, tableHeadersY]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "Предмет";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX + 1, tableHeadersY]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "Изпитани";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX, tableHeadersY + 4]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "Оценки";

                    newWorksheet.Cells[tableHeadersX + 1, tableHeadersY] = "2";
                    tableHeadersY++;
                    newWorksheet.Cells[tableHeadersX + 1, tableHeadersY] = "3";
                    tableHeadersY++;
                    newWorksheet.Cells[tableHeadersX + 1, tableHeadersY] = "4";
                    tableHeadersY++;
                    newWorksheet.Cells[tableHeadersX + 1, tableHeadersY] = "5";
                    tableHeadersY++;
                    newWorksheet.Cells[tableHeadersX + 1, tableHeadersY] = "6";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX + 1, tableHeadersY]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "Неизпитани";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX, tableHeadersY], newWorksheet.Cells[tableHeadersX + 1, tableHeadersY]].Merge();
                    newWorksheet.Cells[tableHeadersX, tableHeadersY] = "Среден успех";
                    tableHeadersY++;

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX - 1, 1], newWorksheet.Cells[tableHeadersX + 1, 10]].Font.Bold = true;



                    foreach (var subject in stats)
                    {
                        newWorksheet.Cells[x, y] = count;
                        y++;
                        newWorksheet.Cells[x, y] = subject.Subject.Title;
                        y++;
                        newWorksheet.Cells[x, y] = subject.StudentsWithGrades;
                        totalIzpitani           += subject.StudentsWithGrades;
                        y++;

                        for (int i = 2; i <= 6; i++)
                        {
                            newWorksheet.Cells[x, y] = subject.Grades.Where(g => g.Grade1 == i).Count();
                            y++;
                        }

                        int studentsWithoutGrades = subject.AllStudents - subject.StudentsWithGrades;
                        newWorksheet.Cells[x, y] = studentsWithoutGrades;
                        totalNeizpitani         += studentsWithoutGrades;
                        y++;
                        newWorksheet.Cells[x, y] = Math.Round(subject.Average, 2);
                        if (subject.Average != 0)
                        {
                            totalAverage += subject.Average;
                            totalGrades++;
                        }

                        x++;
                        y = 1;
                        count++;
                    }

                    newWorksheet.Cells[x, 2]  = "Всичко";
                    newWorksheet.Cells[x, 3]  = totalIzpitani;
                    newWorksheet.Cells[x, 4]  = total2;
                    newWorksheet.Cells[x, 5]  = total3;
                    newWorksheet.Cells[x, 6]  = total4;
                    newWorksheet.Cells[x, 7]  = total5;
                    newWorksheet.Cells[x, 8]  = total6;
                    newWorksheet.Cells[x, 9]  = totalNeizpitani;
                    newWorksheet.Cells[x, 10] = Math.Round(totalAverage / totalGrades, 2);

                    newWorksheet.Range[newWorksheet.Cells[tableHeadersX - 1, 1], newWorksheet.Cells[x, 10]].Borders.LineStyle
                          = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                    count = 1;
                    x    += 5;
                    y     = 1;
                }

                x -= 5;
                WriteAttendanceStats(newWorksheet, semester, cl.Id);

                if (cl.Teachers.Count() != 0)
                {
                    x += 2;
                    newWorksheet.Cells[x, 1] = "Класен ръководител";
                    newWorksheet.Cells[x, 2] = cl.Teachers.FirstOrDefault().Name;
                    newWorksheet.Range[newWorksheet.Cells[x, 1], newWorksheet.Cells[x, 2]].Font.Bold = true;
                    newWorksheet.Range[newWorksheet.Cells[x, 1], newWorksheet.Cells[x, 2]].Borders.LineStyle
                        = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                }

                newWorksheet.get_Range("A1", "Q200").VerticalAlignment   = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
                newWorksheet.get_Range("A1", "Q200").HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter;
                newWorksheet.get_Range("A1", "Q200").Columns.AutoFit();
                newWorksheet.get_Range("A1", "Q200").Rows.AutoFit();

                x     = 7;
                y     = 1;
                count = 1;
            }
        }