/// <summary>
        /// Supprimer une note
        /// </summary>
        public void DeleteNote()
        {
            DataServiceNote dsNote = new DataServiceNote();

            dsNote.DeleteNote(Note);
            GoBackCommand.Execute(null);
        }
Esempio n. 2
0
        public void DeleteNote(Note noteSelected)
        {
            DataServiceNote dsNote = new DataServiceNote();

            Trip.Notes.Remove(noteSelected);
            dsNote.DeleteNote(noteSelected);

            TripCommand.Execute(null);
        }
Esempio n. 3
0
        public void DeleteNotes(List <object> noteList)
        {
            DataServiceNote dsNote = new DataServiceNote();

            foreach (Note note in noteList)
            {
                Trip.Notes.Remove(note);
                dsNote.DeleteNote(note);
            }

            TripCommand.Execute(null);
        }
        private void AddNoteInDB()
        {
            // Workaround to retrieve the REAL associated trip.
            // When the app is tombstoned, it creates a copy of the current trip.
            // So when comes the time to save the note in the database, it saves a new trip
            // and duplicate all existing notes attached to this new trip !
            // The result is an Absolute Mess...

            // Calling the current trip method make sure that we deal with the correct data
            // and not simply a copy.
            Note.Trip.Notes.Add(Note);

            DataServiceNote dsNote = new DataServiceNote();

            dsNote.addNote(Note);
        }
        public void DeletePOI(PointOfInterest poi)
        {
            if (DeletePOIObject)
            {
                // For some reasons, Picture table doesn't refresh properly
                // We have to remove each element in the array manually
                DataServicePicture dsPicture = new DataServicePicture();
                foreach (Picture pic in dsPicture.LoadPicturesByPoiId(poi.Id))
                {
                    Trip.Pictures.Remove(pic);
                    dsPicture.DeletePicture(pic);
                }

                DataServiceNote dsNotes = new DataServiceNote();
                foreach (Note note in dsNotes.LoadNotesByPoiId(poi.Id))
                {
                    Trip.Notes.Remove(note);
                    dsNotes.DeleteNote(note);
                }
            }
            else
            {
                // For some reasons, Picture table doesn't refresh properly
                // We have to remove each element in the array manually
                DataServicePicture dsPicture = new DataServicePicture();
                foreach (Picture pic in dsPicture.LoadPicturesByPoiId(poi.Id))
                {
                    pic.PointOfInterest = null;
                }

                DataServiceNote dsNotes = new DataServiceNote();
                foreach (Note note in dsNotes.LoadNotesByPoiId(poi.Id))
                {
                    note.PointOfInterest = null;
                }
            }

            DataServicePoi dsPoi = new DataServicePoi();

            Trip.PointsOfInterests.Remove(poi);
            PointOfInterestList.Remove(poi);

            dsPoi.DeletePoi(poi, false);

            TripCommand.Execute(null);
        }
        public NoteViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register <Tuple <int, List <Note> > >(this,
                                                                    tuple =>
            {
                DataServiceNote dsNote = new DataServiceNote();
                this.Note = dsNote.getNoteById(tuple.Item1);
                NoteList  = tuple.Item2;
                TripId    = Note.Trip.Id;
            });

            Messenger.Default.Register <int>(this,
                                             note =>
            {
                DataServiceNote dsNote = new DataServiceNote();
                this.Note = dsNote.getNoteById(note);
                TripId    = Note.Trip.Id;
            });
            this._navigationService = navigationService;
        }
        private Note GetNoteInDB(int noteId)
        {
            DataServiceNote dsNote = new DataServiceNote();

            return(dsNote.getNoteById(noteId));
        }
        private void UpdateExistingNote()
        {
            DataServiceNote dsNote = new DataServiceNote();

            dsNote.UpdateNote(Note);
        }