Ejemplo n.º 1
0
 public static void ToggleViaggio(Flyer flyer, Viaggio viaggio)
 {
     if (flyer.Viaggi.Any(v => v.Id == viaggio.Id))
         flyer.Viaggi.Remove(viaggio);
     else
         flyer.Viaggi.Add(viaggio);
 }
Ejemplo n.º 2
0
 public FlyerEditView(Flyer flyer)
 {
     Id = flyer.Id;
     Titolo = flyer.Titolo;
     Descrizione = flyer.Descrizione;
     idAgenzia = flyer.Agenzia.Id;
 }
Ejemplo n.º 3
0
        public static List<ViaggioSelectView> getViaggiSelezionabili(Flyer flyer, List<Viaggio> viaggi)
        {
            List<ViaggioSelectView> viaggiSelezionabili = new List<ViaggioSelectView>();

            foreach (var viaggio in viaggi)
            {
                bool selected = false;

                if (flyer.Viaggi != null && flyer.Viaggi.Any(v => v.Id == viaggio.Id))
                    selected = true;

                ViaggioSelectView viaggioSelezionabile = new ViaggioSelectView() { viaggio = viaggio, isSelected = selected, isSelectable = true, idFlyer = flyer.Id, isDetailExternal = false };
                viaggiSelezionabili.Add(viaggioSelezionabile);
            }

            return viaggiSelezionabili;
        }
Ejemplo n.º 4
0
 public void Delete(Flyer flyer)
 {
     using (var manager = new OperationManager())
     {
         try
         {
             manager.BeginOperation();
             base.delete<Flyer>(flyer);
             manager.CommitOperation();
             logger.Info("Flyer {0} eliminato con successo", flyer.Id);
         }
         catch (Exception ex)
         {
             string message = "Errore nella cancellazione del flyer";
             logger.ErrorException(message, ex);
             throw new Exception(message, ex);
         }
     }
 }
Ejemplo n.º 5
0
 public ActionResult ShowTile(Flyer flyer, bool isShort, bool isEditable, bool isDetailAjax)
 {
     return PartialView(new FlyerTiled() { flyer = flyer, isShort = isShort, isEditable = isEditable, isDetailAjax = isDetailAjax });
 }
Ejemplo n.º 6
0
        private Flyer setFlyerInEdit(int idFlyer)
        {
            Flyer flyer = null;
            if (idFlyer == 0) // nuovo flyer
                flyer = new Flyer() { Agenzia = Session.getLoggedAgenzia(), Viaggi = new List<Viaggio>() };
            else //flyer già esistente
                flyer = flyerRepo.GetById(idFlyer);

            Session.setFlyerInModifica(flyer);

            return flyer;
        }
Ejemplo n.º 7
0
 public void Save(Flyer flyer)
 {
     using (var om = new OperationManager())
     {
         try
         {
             om.BeginOperation();
             base.update<Flyer>(flyer);
             om.CommitOperation();
             logger.Info("Dati del flyer {0} salvati con successo", flyer.Id);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = "Errore nel salvataggio del flyer";
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }