Exemplo n.º 1
0
 public bool AddDayToEvent(long eventNumber, DateTime giorno)
 {
     try
     {
         Evento myEvent = GetEventFromNumber(eventNumber);
         EventoGiorni newDay = new EventoGiorni();
         newDay.DataGiorno = giorno;
         newDay.OraInGioco = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 10, 0, 0);
         newDay.OraFuoriGioco = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 2, 0, 0);
         myEvent.EventoGiornis.Add(newDay);
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemplo n.º 2
0
 public bool InsertNewEventComplete(string title, string description, double costo, int totalPx, List<DateTime> days, DateTime InGame, DateTime OutGame, DateTime standardInGame, DateTime standardOutGame)
 {
     try
     {
         Evento res = new Evento();
         res.Costo = (float)costo;
         res.DataEvento = days[0].Date;
         res.Descrizione = description;
         res.PuntiAssegnati = totalPx;
         res.TitoloEvento = title;
         for (int i = 0; i < days.Count; i++)
         {
             EventoGiorni singleDay = new EventoGiorni();
             singleDay.DataGiorno = days[i];
             if (i == 0)
             {
                 singleDay.OraInGioco = InGame;
             }
             else
             {
                 singleDay.OraInGioco = standardInGame;
             }
             if (i == days.Count - 1)
             {
                 singleDay.OraFuoriGioco = OutGame;
             }
             else
             {
                 singleDay.OraFuoriGioco = standardOutGame;
             }
             res.EventoGiornis.Add(singleDay);
         }
         context.Eventoes.AddObject(res);
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// Create a new EventoGiorni object.
 /// </summary>
 /// <param name="cdEvento">Initial value of the CdEvento property.</param>
 /// <param name="dataGiorno">Initial value of the DataGiorno property.</param>
 /// <param name="oraInGioco">Initial value of the OraInGioco property.</param>
 /// <param name="oraFuoriGioco">Initial value of the OraFuoriGioco property.</param>
 public static EventoGiorni CreateEventoGiorni(global::System.Int64 cdEvento, global::System.DateTime dataGiorno, global::System.DateTime oraInGioco, global::System.DateTime oraFuoriGioco)
 {
     EventoGiorni eventoGiorni = new EventoGiorni();
     eventoGiorni.CdEvento = cdEvento;
     eventoGiorni.DataGiorno = dataGiorno;
     eventoGiorni.OraInGioco = oraInGioco;
     eventoGiorni.OraFuoriGioco = oraFuoriGioco;
     return eventoGiorni;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the EventoGiornis EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEventoGiornis(EventoGiorni eventoGiorni)
 {
     base.AddObject("EventoGiornis", eventoGiorni);
 }
Exemplo n.º 5
0
 public Evento InsertNewEventComplete(string title, string description, int totalPx, List<DateTime> days, DateTime InGame, DateTime OutGame, DateTime standardInGame, DateTime standardOutGame)
 {
     Evento res = null;
     using (HolonetEntities context = new HolonetEntities(_connectionString))
     {
         res = new Evento();
         res.Costo = totalPx;
         res.DataEvento = days[0].Date;
         res.Descrizione = description;
         res.PuntiAssegnati = totalPx;
         res.TitoloEvento = title;
         for (int i = 0; i < days.Count; i++)
         {
             EventoGiorni singleDay = new EventoGiorni();
             singleDay.DataGiorno = days[i];
             if (i == 0)
             {
                 singleDay.OraInGioco = InGame;
             }
             else
             {
                 singleDay.OraInGioco = standardInGame;
             }
             if (i == days.Count - 1)
             {
                 singleDay.OraFuoriGioco = OutGame;
             }
             else
             {
                 singleDay.OraFuoriGioco = standardOutGame;
             }
             res.EventoGiornis.Add(singleDay);
         }
         context.Eventoes.AddObject(res);
         context.SaveChanges();
     }
     return res;
 }