public AdministrateurViewModel(INavigationService navigationService)
        {
            _navigationService = navigationService;
            dataAccess = new DataAccess();
            _admin = new ObservableCollection<Admin>();
            admin = new Admin();

        }
 public PageAdminViewModel(INavigationService navigationService = null)
 {
     _navigationService = navigationService;
     dataAccess = new DataAccess();
     _problem = new ObservableCollection<RendezVous>();
     _perma = new Permanence();
     getAllPerma();
     getAllProblem();
 }
 public MainPageViewModel(INavigationService navigationService = null)
 {
     _navigationService = navigationService;
     dataAccess = new DataAccess();
     _faq = new ObservableCollection<FAQ>();
     getAllFAQ();
     _permanence = new Permanence();
     getAllPerma();
 }
 public async void getAllProblem()
 {
     if (CheckNet())
     {
         dataAccess = new DataAccess();
         List<RendezVous> lstProblem = await dataAccess.getAllProblem();
         foreach (var item in lstProblem)
         {
             if (item.idPerma == _permanence.idPerma)
                 RendezVous.Add(item);
         }
     }
 }
 public async void getAllPerma()
 {
     if (CheckNet())
     {
         dataAccess = new DataAccess();
         List<Permanence> lstPerma = await dataAccess.getAllPerma();
         DateTime dateAjd = DateTime.Today;
         foreach (var item in lstPerma)
         {
             DateTime td = Convert.ToDateTime(item.datePerma);
             if (td > dateAjd && _permanence.heureDebutPerma == 0)
             {
                 _permanence = item;
             }
         }
     }
     else
         exit();
 }
        private void newInscription()
         {
            dataAccess = new DataAccess();
            creerObject();
            if (LastName == null)
            {
                var messageDialog = new MessageDialog("Last name cannot be empty!");
                messageDialog.ShowAsync();
            }
            else if (!ValidLastName(lastName))
            {
                var messageDialog = new MessageDialog("Bad Last name!");
                messageDialog.ShowAsync();
            }
            else if (FirstName == null)
            {
                var messageDialog = new MessageDialog("First name cannot be empty!");
                messageDialog.ShowAsync();
            }

            else if (!ValidLastName(firstName))
            {
                var messageDialog = new MessageDialog("Bad First name!");
                messageDialog.ShowAsync();
            }

            else if (EmailAdress == null)
            {
                var messageDialog = new MessageDialog("Email addresss cannot be empty!");
                messageDialog.ShowAsync();
            }

            else if (!ValidEmailAddress(emailAdress))
            {
                var messageDialog = new MessageDialog("Bad Email Address!");
                messageDialog.ShowAsync();
            }
            
        /*    else if (!ValidPhone(phone))
            {
                var messageDialog = new MessageDialog("Bad Phone number!");
                messageDialog.ShowAsync();
            }*/

           else if (phone>9999999999 || phone < 0)
            {
                var messageDialog = new MessageDialog("Phone number cannot be greater than 10!");
                messageDialog.ShowAsync();
            }

            else if (Problem == null)
            {
                var messageDialog = new MessageDialog("Problem cannot be empty!");
                messageDialog.ShowAsync();
            }

            else
            {
                dataAccess.NewRendezVous(rdv);
                _navigationService.NavigateTo("MainPage");
            }




         }