private bool VerificaCampi(bool notify = false)
 {
     if (EditorSelezionato < 0)
     {
         if (notify)
         {
             notification.ShowMessageDialog("Verifica dati", "Seleziona l'editor con cui pubblicare la notizia");
         }
         return(false);
     }
     if (string.IsNullOrEmpty(TitoloNews) || string.IsNullOrEmpty(TitoloNews.Trim()))
     {
         if (notify)
         {
             notification.ShowMessageDialog("Verifica dati", "Inserire un titolo");
         }
         return(false);
     }
     if (string.IsNullOrEmpty(CorpoNews) || string.IsNullOrEmpty(CorpoNews.Trim()))
     {
         if (notify)
         {
             notification.ShowMessageDialog("Verifica dati", "Il messaggio della notizia non può essere vuoto");
         }
         return(false);
     }
     return(true);
 }
Exemple #2
0
 private bool VerificaDati(bool notifyOn = false)
 {
     if (this.CategoriaIndexSelected < 0)
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi selezionare una categoria");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (this.CittaSelezionata == null)
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi selezionare la città dell'editor");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(this.IndirizzoEditor.Trim()))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire l'indirizzo dell'editor");
         }
         IsRegisterButtonEnable = false;
         return(true);
     }
     if (!validation.EmailValidation(IndirizzoEmail))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire un indirizzo email valido");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(Telefono.Trim()))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire un numero di telefono");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     return(true);
 }
Exemple #3
0
        private async void LoadEditor()
        {
            int retry = 0;

            IsBusyActive = true;
            bool responseOk = false;

            do
            {
                var envelop = await postApp.GetEditorInfo(CurrentEditorId);

                if (envelop.response == StatusCodes.OK)
                {
                    responseOk = true;
                    Editor     = envelop.content;
                }
            }while (!responseOk && retry < 3);
            IsBusyActive = false;

            if (responseOk == false)
            {
                notification.ShowMessageDialog("Errore di connessione", "Non è stato possibile caricare le informazioni dell'editor.\nControlla la connessione o contatta l'assistenza");
            }
            else
            {
                LoadNews();
            }
        }
        private async void CaricaComuni()
        {
            IsBusyActive = true;
            var envelop = await postApp.GetComuniConEditors();

            if (envelop.response == StatusCodes.OK)
            {
                foreach (var item in envelop.content)
                {
                    Editors.Add(item, new ObservableCollection <Editor>());
                }
                RaisePropertyChanged(() => Editors);
            }
            else
            {
                notification.ShowMessageDialog("Errore", "Si è verificato un errore durante il caricamento dei comuni");
            }
            IsBusyActive = false;
        }
        private async void CaricaElencoScuole()
        {
            IsBusyActive = true;
            ElencoScuole?.Clear();
            var response = await api.GetMieScuoleWriter();

            if (response.response == StatusCodes.OK)
            {
                foreach (var item in response.content)
                {
                    ElencoScuole.Add(item);
                }
                RaisePropertyChanged(() => ElencoScuole);
                if (!ElencoScuole.Any())
                {
                    notification.ShowMessageDialog("Scuole disponibili", "Non sei autorizzato a postare per nessuna scuola.\nSe questo è un errore, riprova più tardi o contatta l'assistenza.", () => navigation.NavigateTo(ViewModelLocator.MainPage));
                    return;
                }
                else if (ElencoScuole.Count == 1)
                {
                    ScuolaSelezionata = -1;
                }
            }
            else
            {
                notification.ConfirmDialog("Scuole disponibili", $"Si è verificato un errore di comunicazione.\nErrore: {response.response}", (action) =>
                {
                    if (action)
                    {
                        CaricaElencoScuole();
                    }
                    else
                    {
                        navigation.NavigateTo(ViewModelLocator.MainPage);
                    }
                }, "Riprova", "Chiudi");
            }
            IsBusyActive = false;
        }
 private bool VerificaDati(bool notify = false)
 {
     if (string.IsNullOrEmpty(NomeDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il nome del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(CognomeDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il cognome del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(UsernameDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la username del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(PasswordDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la password del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(NomeScuola.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il nome della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (CittaSelezionata == null)
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la città della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(IndirizzoEmail.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci l'indirizzo email della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(Telefono.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il numero di telefono della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     IsRegisterButtonEnable = true;
     return(true);
 }