示例#1
0
        private void ImportExcelWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            // run all background tasks here
            try
            {
                foreach (var name in fileNames)
                {
                    var schedule = ExcelParser.GetScheduleFromExcel(name);
                    foreach (KeyValuePair <ScheduleRecordDto, List <int> > entry in schedule)
                    {
                        bool isAdded = ScheduleRecordDao.AddIfNotExists(entry.Key);

                        if (!isAdded)
                        {
                            continue;
                        }

                        foreach (var weekNumber in entry.Value)
                        {
                            //TSR
                            if (weekNumber == 8)
                            {
                                continue;
                            }

                            WeekScheduleDao.AddWeekSchedule(weekNumber: weekNumber, scheduleRecordId: entry.Key.Id);
                        }
                    }
                }
            }
            catch (InvalidInputException ex)
            {
                ShowPopup(ex.Message);
            }
        }
示例#2
0
        private void FillDropDownsInfo()
        {
            buildings.ItemsSource        = ClassRoomsDao.GetAllBuildings();
            classRoomNumbers.ItemsSource = ClassRoomsDao.GetAllNumbers();

            var allSpecialties = SpecialtyDao.GetAllSpecialties();
            var allSubjects    = ScheduleRecordDao.GetAllSubjects();
            var allYears       = ScheduleRecordDao.GetAllYears();

            teacherSpecialtyCb.ItemsSource      = allSpecialties;
            teacherSubjectCb.ItemsSource        = allSubjects;
            teacherYearOfStudyingCb.ItemsSource = allYears;

            studentSpecialtyCb.ItemsSource      = allSpecialties;
            studentSubjectCb.ItemsSource        = allSubjects;
            studentYearOfStudyingCb.ItemsSource = allYears;

            var allWeeks = WeeksDao.GetFormattedWeeks();

            mquery2Weeks.ItemsSource = allWeeks;

            var selectWeeks = new string[allWeeks.Length + 1];

            selectWeeks[0] = "Всі тижні";
            Array.Copy(allWeeks, 0, selectWeeks, 1, allWeeks.Length);
            teacherWeekSelect.ItemsSource   = selectWeeks;
            teacherWeekSelect.SelectedIndex = 0;

            mquery1Weeks.ItemsSource   = selectWeeks;
            mquery1Weeks.SelectedIndex = 0;

            teacherNameSelect.ItemsSource = TeacherDao.GetFormattedTeachers();

            studentWeekSelect.ItemsSource      = selectWeeks;
            studentWeekSelect.SelectedIndex    = 0;
            studentSpecialtySelect.ItemsSource = allSpecialties;
            studentCourseSelect.ItemsSource    = allYears;
        }