コード例 #1
0
        private void RefreshExecute()
        {
            _firmenDB.RefreshDBContext();                             //Refresh DBContext

            FirmenList = _firmenDB.GetAllFirmen();                    //Get all Firmen into FirmenList

            SelectedFirmen = _firmenDB.RefreshEntity(SelectedFirmen); //Refresh the currently selected firmen

            //If currently selected Firmen had already been deleted in database by another user, then set to the first item in list
            if (SelectedFirmen == null)
            {
                MessageBox.Show("Die ausgewählten Daten sind nicht mehr in der Datenbank verfügbar.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                SelectedFirmen = FirmenList[0];
            }
        }
コード例 #2
0
        private void RefreshExecute()
        {
            _studentDB.RefreshDBContext(); //Refresh DBContext
            _firmenDB.RefreshDBContext();
            _dozentDB.RefreshDBContext();

            StudentList = _studentDB.GetAllStudents(); //Get all students into StudentList
            FirmaList   = _firmenDB.GetAllFirmen();    //Get all Firmen into FirmaList
            DozentList  = _dozentDB.GetAllDozents();   //Get all DozentNames into DozentList

            if (StudentList.Contains(SelectedStudent))
            {
                SelectedStudent = _studentDB.RefreshEntity(SelectedStudent); //Refresh the currently selected student
            }
            //If currently selected Student had already been deleted in database by another user, then set to the first item in list
            else
            {
                MessageBox.Show("Die ausgewählten Daten sind nicht mehr in der Datenbank verfügbar.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                SelectedStudent = StudentList[0];
            }
        }