/// <summary> /// Mise a jour des information pour un document /// </summary> /// <returns></returns> async Task ModificationDesInfos() { var validation = _documentValidator.Validate(_document); if (validation.IsValid) { bool isUserAccept = await Application.Current.MainPage.DisplayAlert(Messages.MessageEnregistrement, Messages.MessageValidation, "Enregistrer", "Annuler"); if (isUserAccept) { if (baseParametresViewModel.Notifications == true) { var date = (DateExp.Date.Month.ToString("00") + "-" + DateExp.Date.Day.ToString("00") + "-" + DateExp.Date.Year.ToString()); var time = Convert.ToDateTime(HeureExp.ToString()).ToString("HH:mm"); var dateTime = date + " " + time; var selectedDateTime = DateTime.ParseExact(dateTime, "MM-dd-yyyy HH:mm", CultureInfo.InvariantCulture); _localNotificationService.LocalNotification("Savall", DescriptionDocument, 0, selectedDateTime); _document.MisAjourEnBase(); await Application.Current.MainPage.DisplayAlert(Messages.MessageSucces, Messages.MessageOk, "OK"); await PopupNavigation.Instance.PopAsync(); MessagingCenter.Send <App>((App)Application.Current, "ActualiserListe"); } else { _localNotificationService.Cancel(0); _document.MisAjourEnBase(); await Application.Current.MainPage.DisplayAlert(Messages.MessageSucces, Messages.MessageOk, "OK"); await PopupNavigation.Instance.PopAsync(); MessagingCenter.Send <App>((App)Application.Current, "ActualiserListe"); } } } else { await Application.Current.MainPage.DisplayAlert(Messages.MessageTitleError, validation.Errors[0].ErrorMessage, "Ok"); } }
/// <summary> /// Enregistrer les documents utilisateur /// </summary> /// <returns></returns> async Task EnregistrementDuDocument() { var validation = _documentValidator.Validate(_document); if (validation.IsValid) { bool isUserAccept = await Application.Current.MainPage.DisplayAlert(Messages.MessageEnregistrement, Messages.MessageValidation, "Enregistrer", "Annuler"); if (isUserAccept) { if (baseParametresViewModel.Notifications == true) { var date = (DateExp.Date.Month.ToString("00") + "-" + DateExp.Date.Day.ToString("00") + "-" + DateExp.Date.Year.ToString()); var time = Convert.ToDateTime(HeureExp.ToString()).ToString("HH:mm"); var dateTime = date + " " + time; var selectedDateTime = DateTime.ParseExact(dateTime, "MM-dd-yyyy HH:mm", CultureInfo.InvariantCulture); _localNotificationService.LocalNotification("Savall", DescriptionDocument, 0, selectedDateTime); _document.EnregistrerEnBase(); var ldoc = new DatabaseHelper().TousLesDocuments().GetAwaiter().GetResult(); var doc = ldoc.FindLast(p => p.nomDocument != null); if (App.MembreActuel == null) { App.MembreActuel = App.user; } App.MembreActuel.AttribuerDocument(doc); await Application.Current.MainPage.DisplayAlert(Messages.MessageSucces, Messages.MessageOk, "OK"); await PopupNavigation.Instance.PopAsync(); MessagingCenter.Send <App>((App)Application.Current, "ActualiserListe"); } else { _localNotificationService.Cancel(0); _document.EnregistrerEnBase(); var ldoc = new DatabaseHelper().TousLesDocuments().GetAwaiter().GetResult(); var doc = ldoc.FindLast(p => p.nomDocument != null); if (App.MembreActuel == null) { App.MembreActuel = App.user; } App.MembreActuel.AttribuerDocument(doc); await Application.Current.MainPage.DisplayAlert(Messages.MessageSucces, Messages.MessageOk, "OK"); await PopupNavigation.Instance.PopAsync(); MessagingCenter.Send <App>((App)Application.Current, "ActualiserListe"); } } } else { await Application.Current.MainPage.DisplayAlert(Messages.MessageTitleError, validation.Errors[0].ErrorMessage, "Ok"); } }