Beispiel #1
0
 private void OnDeleteCommand(object o)
 {
     try
     {
         DeleteView      supprimer = new DeleteView();
         DeleteViewModel modele    = new DeleteViewModel(supprimer);
         supprimer.DataContext = modele;
         supprimer.ShowDialog();
         if (!modele.NormalEnd)
         {
             return;
         }
         // if (modele.Nom == " ") { throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n")); }
         if (!modele.TestI)
         {
             Event.Intervenants.RemoveAt(Event.Intervenants.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom)));
             UpdateListeSpeaker();
         }
         else
         {
             Event.Inscrits.RemoveAt(Event.Inscrits.ToList().FindIndex(Internaute => (Internaute.Nom == Spectator.Nom)));
             UpdateListeSpectator();
         }
         NotifyPropertyChanged("ListeSpectator");
         NotifyPropertyChanged("ListeSpeaker");
     }
     catch (Exception E)
     {
         ExceptionViewModel v = new ExceptionViewModel(E);
         ExceptionView      ExceptionWindow = new ExceptionView();
         ExceptionWindow.DataContext = v;
         ExceptionWindow.ShowDialog();
     }
 }
Beispiel #2
0
        private async void DeleteTeacher()
        {
            TeacherEx teacherExss = SelectedUser as TeacherEx; //interresant. Alle personer kan findes ved at typecast fra user.

            //  TeacherEx teacherExss = ObjectHolder.Instance.TeacherList.FirstOrDefault(te => te.Id == selectedUser.Id);

            if (teacherExss.ClassList.Count != 0)
            {
                var okornot = MessageBox.Show("Du kan ikke slette denne underviser, idet den har elever knyttet til sig." +
                                              "du skal derfor først tilknytte en ny klasse til dine elever i denne klasse.\n" +
                                              "Et nyt view vil åbnes, hvis du trykker ok.", "Sletning",
                                              MessageBoxButton.OKCancel);

                if (okornot == MessageBoxResult.OK)
                {
                    DeleteView deleteView = new DeleteView(null, teacherExss);
                    deleteView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    deleteView.ShowDialog();
                    deleteView.Closing += deleteView_Closing;
                }
            }
            else if (teacherExss.ClassList.Count == 0)
            {
                await AreYouSureYouWantToDeleteUser(SelectedUser.Userrole); // vigtigt fordi den ellers g[r ind og lukker forbindelsen for sletningen af underviseren, hvis der ikke er tilknyttet born til ham.
            }

            await GetTeachers();
            await GetClasses();
        }
 public DeleteViewModel(DeleteView supprimer)
 {
     IntervenantCommand = new DelegateCommand(OnIntervenantAction, CanExecuteIntervenant);
     InternauteCommand  = new DelegateCommand(OnInternauteAction, CanExecuteInternaute);
     NormalCloseCommand = new DelegateCommand(OnNormalCloseAction, CanExecuteNormalClose);
     TestI     = true;
     NormalEnd = false;
 }
Beispiel #4
0
        // GET: Contact/Delete/5
        public ActionResult Delete(int id)
        {
            Contact    c     = ServiceLocator.Instance.ContactService.Get(id);
            DeleteView model = new DeleteView()
            {
                Id = c.Id, Fname = c.Fname, Lname = c.Lname, Tel = c.Tel, Email = c.Email
            };

            return(View(model));
        }
        protected void GetDeleteInformation(long id, string name)
        {
            DeleteView = new DeleteView()
            {
                Id   = id,
                Name = name
            };

            ShowDeleteModal();
        }
Beispiel #6
0
        public HomeController()
        {
            config_model         = new Config();
            config_model.Notify += Notify;
            imageWeb_model       = new ImageWebInfo();
            // log_model = new Log();
            photo_model      = new Photo(config_model.OutputDirectory);
            deleteView_model = new DeleteView(m_path, m_name, dict);

            //deletePoto_model=new DeletePhoto();
        }
Beispiel #7
0
        public async void DeleteClass(Object o)
        {
            bool result = false;

            if (SelectedClass.StudentsList.Count != 0)
            {
                var okornot = MessageBox.Show("Du kan ikke slette denne klasse, idet den har elever knyttet til sig." +
                                              "du skal derfor først tilknytte en ny klasse til dine elever i denne klasse.\n" +
                                              "Et nyt view vil åbnes, hvis du trykker ok.", "Sletning",
                                              MessageBoxButton.OKCancel);

                if (okornot == MessageBoxResult.OK)
                {
                    DeleteView deleteView = new DeleteView(SelectedClass);
                    deleteView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    deleteView.ShowDialog();
                    deleteView.Closing += deleteView_Closing;
                    await GetClasses();
                }
            }

            else if (SelectedClass.StudentsList.Count == 0)
            {
                var messageboxResult = MessageBox.Show("Ønsker du at slette klassen: " + SelectedClass.Name + "?", "Sletning", MessageBoxButton.YesNo);
                if (messageboxResult == MessageBoxResult.Yes)
                {
                    result = await BusinessLogic.Instance.DeleteClass(SelectedClass.Id);
                }
            }

            if (result)
            {
                MessageBox.Show("Klassen blev fjernet!");
                await GetClasses();
            }
        }
Beispiel #8
0
        void DeleteRepairMethod(object arg)
        {
            DeleteView myDeleteView = new DeleteView(selectedRepair);

            myDeleteView.ShowDialog();
        }
Beispiel #9
0
 protected void GetDeleteInformation(long id, string name)
 {
     DeleteView = new DeleteView(id, name);
     DisplayDeleteModal();
 }