Esempio n. 1
0
 private void InitSubjectList()
 {
     _displayedSubjects = new List <Subject>();
     foreach (Subject subject in _subjectRepository.GetAllSubjects())
     {
         _displayedSubjects.Add(subject);
     }
     SubjectList.ItemsSource       = _displayedSubjects;
     AwailableSubjects.ItemsSource = _displayedSubjects;
 }
Esempio n. 2
0
 public List <SubjectDM> GetAllSubjects()
 {
     try
     {
         return(_SubjectRepo.GetAllSubjects());
     }
     catch (Exception ex)
     {
         //Errors in this scope indicates system error (not validation errors)
         //If error not handled, log it and add system error
         if (!_GlobalErrors.ErrorHandled)
         {
             _Logger.Error(ex, "Database Error: Cannot Get All Subjects!");
             _GlobalErrors.AddSystemError("Database Error: Cannot Get All Subjects!");
             _GlobalErrors.ErrorHandled = true;
         }
         throw;
     }
 }
Esempio n. 3
0
        public AddNewSubjectToTimeTableDialog(List <DaysOfWeek> freeDays)
        {
            InitializeComponent();
            var connString = ConfigurationManager.ConnectionStrings["StudentDiaryConnectionString"].ConnectionString;

            _subjectRepository  = new SubjectRepository(connString);
            _pairTypeRepository = new PairTypeRepository(connString);

            AwailableDaysList.ItemsSource  = freeDays;
            AwailableDaysList.SelectedItem = freeDays[0];

            var awailableSubjects = _subjectRepository.GetAllSubjects();

            AwailableSubjectsList.ItemsSource  = awailableSubjects;
            AwailableSubjectsList.SelectedItem = awailableSubjects[0];

            var awailablePairTypes = _pairTypeRepository.GetAllPairTypes().ToList();

            AwailablePairTypesList.ItemsSource  = awailablePairTypes;
            AwailablePairTypesList.SelectedItem = awailablePairTypes[0];
        }
Esempio n. 4
0
        private static void MateriasListado()
        {
            LimpiarConsoleLine();
            Console.WriteLine("3 - 3) Listado de Materias.");
            var dicSubjectsByName = SubjectRepository.GetAllSubjects();

            if (dicSubjectsByName.Count < 1)
            {
                Console.WriteLine("");
                Console.WriteLine("Todavía no hay registrada ninguna materia.");
                Console.WriteLine("¿Algo más del menú de materias?, en caso contrario entra 'p' para ir al menú principal.");
            }
            else
            {
                int posicion = 1;
                foreach (Subject subject in dicSubjectsByName.Values)
                {
                    Console.WriteLine($"{posicion}-) La materia {subject.Name} la imparte el maestro {subject.Teacher}");
                    posicion++;
                }
            }
        }