Exemple #1
0
        public void SaveEnrollment()
        {
            try
            {
                var enrollmentsDictionary = _enrollments.ToDictionary(p => p.EnrollmentId);
                if (SelectedEnrollment != null)
                {
                    _enrollmentCommand.Upsert(SelectedEnrollment);

                    Enrollments.Clear();                                //Torlojuk a ListBox-ot
                    Enrollments.AddRange(_enrollmentCommand.GetList()); //Megjelenitjuk benne az uj listat
                    UpdateAppStatus("Enrollment saved.");
                }
            }
            catch (Exception ex)
            {
                UpdateAppStatus(ex.Message);
            }
        }
Exemple #2
0
        public MainViewModel()
        {
            SelectedEnrollment = _selectedEnrollment;

            try
            {
                _enrollmentCommand = new EnrollmentCommand(_connectionString);
                Enrollments.AddRange(_enrollmentCommand.GetList());

                StudentCommand studentCommand = new StudentCommand(_connectionString);
                Students.AddRange(studentCommand.GetList());

                CourseCommand courseCommand = new CourseCommand(_connectionString);
                Courses.AddRange(courseCommand.GetList());
            }
            catch (Exception ex)
            {
                UpdateAppStatus(ex.Message);
            }
        }
Exemple #3
0
        public void SaveEnrollment()
        {
            try
            {
                var enrollmentDictionary = _enrollments.ToDictionary(x => x.EnrollmentId);

                if (SelectedEnrollment != null)
                {
                    _enrollmentCommand.Upsert(SelectedEnrollment);

                    Enrollments.Clear();
                    Enrollments.AddRange(_enrollmentCommand.GetList());

                    UpdateAppStatus("Enrollment Saved");
                }
            }
            catch (Exception ex)
            {
                UpdateAppStatus(ex.Message);
            }
        }
Exemple #4
0
        public MainViewModel()
        {
            SelectedEnrollment = new EnrollmentModel();

            try
            {   //Ezekbol a Modellekbol csinaljuk itt, a ViewModellben a View szamara hasznalhato property-ket
                _enrollmentCommand = new EnrollmentCommand(_connectionString);
                Enrollments.AddRange(_enrollmentCommand.GetList());

                StudentCommand studentCommand = new StudentCommand(_connectionString);
                Students.AddRange(studentCommand.GetList());

                CourseCommand courseCommand = new CourseCommand(_connectionString);
                Courses.AddRange(courseCommand.GetList());//Adds a list from the DB to our list
            }
            catch (Exception ex)
            {
                //AppStatus = ex.Message;
                //Mindig, ha megvaltozik az AppStatus, akkor az AppStatus property ertesuljon rola. Alert the UI. (Lasd MainView.xaml, StatusBar)
                UpdateAppStatus(ex.Message);
            }
        }