private bool controllaFaseDelGiorno()
        {
            if (faseDelGiorno != null)
            {
                return(true);
            }

            FaseDelGiorno faseDelGiornoCorrente = FaseDelGiornoUtil.getFaseDelGiorno(DateTime.Now);

            StringBuilder msg = new StringBuilder("Attenzione : non hai assegnato nessuna fase del giorno");

            msg.AppendFormat(".\nVuoi assegnare automaticamente la fase {0} a tutte le foto che si stanno per scaricare?", faseDelGiornoCorrente.ToString().ToUpper());

            MessageBoxResult procediPure = MessageBoxResult.Cancel;

            dialogProvider.ShowConfirmationAnnulla(msg.ToString(), "Richiesta conferma",
                                                   (confermato) => {
                procediPure = confermato;
            });

            if (procediPure == MessageBoxResult.Yes)
            {
                faseDelGiorno = faseDelGiornoCorrente;
            }

            return((procediPure == MessageBoxResult.Yes) ||
                   (procediPure == MessageBoxResult.No));
        }
Пример #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                return(FaseDelGiornoUtil.getFaseDelGiorno((short)value));
            }

            return(null);
        }
Пример #3
0
        /// <summary>
        /// Carico lo stato dei metadati prendendolo dalle foto selezionate
        /// </summary>
        protected void caricareStatoMetadati()
        {
            bool   didascalieDiscordanti = false;
            string didascaliaNew         = null;

            bool   eventiDiscordanti = false;
            Guid?  eventoIdNew       = null;       // Non posso usare l'oggetto "Evento" perché entity framework sulle entità non idratate mi torna null anche se non è vero :-(
            Evento eventoNew         = null;

            bool  fasiDelGiornoDiscordanti = false;
            short?faseDelGiornoNew         = null;

            IEnumerator <Fotografia> itera = getEnumeratorElementiSelezionati();
            int conta = 0;

            while (itera.MoveNext())
            {
                Fotografia f = itera.Current;
                ++conta;

                // -- didascalia

                if (String.IsNullOrWhiteSpace(f.didascalia))
                {
                    if (didascaliaNew != null)
                    {
                        didascalieDiscordanti = true;
                    }
                }
                else
                {
                    if (f.didascalia != didascaliaNew && conta > 1)
                    {
                        didascalieDiscordanti = true;
                    }
                }
                didascaliaNew = String.IsNullOrWhiteSpace(f.didascalia) ? null : f.didascalia;

                // -- evento

                if (f.evento_id == null)
                {
                    if (eventoIdNew != null)
                    {
                        eventiDiscordanti = true;
                    }
                }
                else
                {
                    if (f.evento_id != eventoIdNew && conta > 1)
                    {
                        eventiDiscordanti = true;
                    }
                }
                eventoIdNew = f.evento_id;
                if (f.evento != null)
                {
                    eventoNew = f.evento;                      // Se la foto è staccata, questo è null (mentre il suo ID è valorizzato)
                }
                // -- fase del giorno

                if (f.faseDelGiorno == null)
                {
                    if (faseDelGiornoNew != null)
                    {
                        fasiDelGiornoDiscordanti = true;
                    }
                }
                else
                {
                    if (f.faseDelGiorno != faseDelGiornoNew && conta > 1)
                    {
                        fasiDelGiornoDiscordanti = true;
                    }
                }
                faseDelGiornoNew = f.faseDelGiorno;
            }


            // -- ora travaso i dati che sono concordanti
            MetadatiFoto metadatiNew = new MetadatiFoto();


            if (didascalieDiscordanti)
            {
                metadatiNew.didascalia    = null;
                metadatiNew.usoDidascalia = false;
            }
            else
            {
                metadatiNew.didascalia    = String.IsNullOrWhiteSpace(didascaliaNew) ? null : didascaliaNew;
                metadatiNew.usoDidascalia = (metadatiNew.didascalia != null);
            }

            if (eventiDiscordanti)
            {
                metadatiNew.evento    = null;
                metadatiNew.usoEvento = false;
            }
            else
            {
                if (eventoIdNew != null)
                {
                    if (eventoNew == null)
                    {
                        // L'oggetto era staccato. Lo rileggo
                        // Devo ricaricare l'oggetto evento dall'ID
                        IEntityRepositorySrv <Evento> repo = LumenApplication.Instance.getServizioAvviato <IEntityRepositorySrv <Evento> >();
                        metadatiNew.evento = repo.getById(eventoIdNew);
                    }
                    else
                    {
                        metadatiNew.evento = eventoNew;
                    }
                }
                metadatiNew.usoEvento = (metadatiNew.evento != null);
            }
            selettoreEventoViewModel.eventoSelezionato = metadatiNew.evento;              // ribalto questo valore nel vm del componente perché è li che sta il valore buono

            if (fasiDelGiornoDiscordanti)
            {
                metadatiNew.faseDelGiorno    = null;
                metadatiNew.usoFaseDelGiorno = false;
            }
            else
            {
                if (faseDelGiornoNew != null)
                {
                    metadatiNew.faseDelGiorno = FaseDelGiornoUtil.getFaseDelGiorno((short)faseDelGiornoNew);
                }
                metadatiNew.usoFaseDelGiorno = (metadatiNew.faseDelGiorno != null);
            }

            this.metadati = metadatiNew;
        }